Examples of StaticReplicationDataBundle


Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

   * Test ConstantDoublesSurface delta surface at 1 and 10 years
   */
  @Test
  public void testConstantDoublesDeltaSurface() {
    final BlackVolatilitySurfaceDelta constVolSurf = new BlackVolatilitySurfaceDelta(ConstantDoublesSurface.from(TEST_VOL), FORWARD_CURVE);
    final double testVar = PRICER.expectedVariance(swap1, new StaticReplicationDataBundle(constVolSurf, DISCOUNT, FORWARD_CURVE));
    final double testVar2 = PRICER.expectedVariance(swap10, new StaticReplicationDataBundle(constVolSurf, DISCOUNT, FORWARD_CURVE));
    final double targetVar = TEST_VOL * TEST_VOL;

    assertEquals(targetVar, testVar, TEST_TOL);
    assertEquals(targetVar, testVar2, TEST_TOL);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

   * Test ConstantDoublesSurface strike surface at 1 and 10 years
   */
  @Test
  public void testConstantDoublesStrikeSurface() {
    final BlackVolatilitySurfaceStrike constVolSurf = new BlackVolatilitySurfaceStrike(ConstantDoublesSurface.from(TEST_VOL));
    final double testVar = PRICER.expectedVariance(swap1, new StaticReplicationDataBundle(constVolSurf, DISCOUNT, FORWARD_CURVE));
    final double testVar2 = PRICER.expectedVariance(swap10, new StaticReplicationDataBundle(constVolSurf, DISCOUNT, FORWARD_CURVE));
    final double targetVar = TEST_VOL * TEST_VOL;
    assertEquals(targetVar, testVar, TEST_TOL);
    assertEquals(targetVar, testVar2, TEST_TOL);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

  public void testSurfaceWithoutStrikeExtrapolation() {
    final CombinedInterpolatorExtrapolator interpOnlyStrike = getInterpolator(Interpolator1DFactory.LINEAR);
    final Interpolator2D interp2D = new GridInterpolator2D(INTERPOLATOR_1D_EXPIRY, interpOnlyStrike);
    final InterpolatedDoublesSurface surface = new InterpolatedDoublesSurface(EXPIRIES, STRIKES, VOLS, interp2D);
    final BlackVolatilitySurfaceStrike volSurface = new BlackVolatilitySurfaceStrike(surface);
    PRICER.expectedVariance(swap1, new StaticReplicationDataBundle(volSurface, DISCOUNT, FORWARD_CURVE));
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

    final BlackVolatilitySurfaceDelta surfaceDelta = new BlackVolatilitySurfaceDelta(FunctionalDoublesSurface.from(surf), FORWARD_CURVE);
    final BlackVolatilitySurfaceLogMoneyness surfaceLogMoneyness = BlackVolatilitySurfaceConverter.toLogMoneynessSurface(surfaceDelta);
    final BlackVolatilitySurfaceMoneyness surfaceMoneyness = BlackVolatilitySurfaceConverter.toMoneynessSurface(surfaceLogMoneyness);
    final BlackVolatilitySurfaceStrike surfaceStrike = BlackVolatilitySurfaceConverter.toStrikeSurface(surfaceLogMoneyness);

    final StaticReplicationDataBundle marketStrike = new StaticReplicationDataBundle(surfaceStrike, DISCOUNT, FORWARD_CURVE);
    final StaticReplicationDataBundle marketLogMoneyness = new StaticReplicationDataBundle(surfaceLogMoneyness, DISCOUNT, FORWARD_CURVE);
    final StaticReplicationDataBundle marketMoneyness = new StaticReplicationDataBundle(surfaceMoneyness, DISCOUNT, FORWARD_CURVE);
    final StaticReplicationDataBundle marketDelta = new StaticReplicationDataBundle(surfaceDelta, DISCOUNT, FORWARD_CURVE);

    final double totalVarStrike = PRICER.expectedVariance(swap1, marketStrike);
    final double totalVarLogMoneyness = PRICER.expectedVariance(swap1, marketLogMoneyness);
    final double totalVarMoneyness = PRICER.expectedVariance(swap1, marketMoneyness);
    final double totalVarDelta = PRICER.expectedVariance(swap1, marketDelta);
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

        return BlackFormulaRepository.impliedVolatility(price, fwd, k, t, isCall);
      }
    };

    final BlackVolatilitySurface<Strike> surfaceStrike = new BlackVolatilitySurfaceStrike(FunctionalDoublesSurface.from(surf));
    final StaticReplicationDataBundle marketStrike = new StaticReplicationDataBundle(surfaceStrike, DISCOUNT, FORWARD_CURVE);

    final double compVar = PRICER.expectedVariance(swap1, marketStrike);
    final double compVarLimits = PRICER.expectedVariance(swap1, marketStrike);
    final double expected = w * sigma1 * sigma1 + (1 - w) * sigma2 * sigma2;
    assertEquals(expected, compVar, TEST_TOL);
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

    final BlackVolatilitySurface<Strike> surfaceStrike = new BlackVolatilitySurfaceStrike(FunctionalDoublesSurface.from(surf));

    //PDEUtilityTools.printSurface(null, surfaceStrike.getSurface(), 0.1, 4, 5, 300);

    final StaticReplicationDataBundle marketStrike = new StaticReplicationDataBundle(surfaceStrike, DISCOUNT, FORWARD_CURVE);

    final double compVar = PRICER.expectedVariance(swap2, marketStrike);

    double expected = 0;
    for (int i = 0; i < n; i++) {
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

  @Test
  public void testForwardSensitivityForDeltaStrikeParameterisation() {

    final InterpolatedDoublesSurface DELTA_SURFACE = new InterpolatedDoublesSurface(EXPIRIES, CALLDELTAs, VOLS, new GridInterpolator2D(INTERPOLATOR_1D_LINEAR, INTERPOLATOR_1D_DBLQUAD));
    final BlackVolatilitySurfaceDelta DELTA_VOL_SURFACE = new BlackVolatilitySurfaceDelta(DELTA_SURFACE, FORWARD_CURVE);
    final StaticReplicationDataBundle DELTA_MARKET = new StaticReplicationDataBundle(DELTA_VOL_SURFACE, FUNDING, FORWARD_CURVE);

    final double relShift = 0.1;

    final double deltaSkew = DELTA_CAL.calcForwardSensitivity(swap5y, DELTA_MARKET, relShift);
    final double deltaFlatLong = DELTA_CAL.calcForwardSensitivity(swap10y, DELTA_MARKET, relShift);
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

  @Test
  public void testBlackVegaForDeltaSurface() {

    final InterpolatedDoublesSurface DELTA_SURFACE = new InterpolatedDoublesSurface(EXPIRIES, CALLDELTAs, VOLS, new GridInterpolator2D(INTERPOLATOR_1D_LINEAR, INTERPOLATOR_1D_DBLQUAD));
    final BlackVolatilitySurfaceDelta DELTA_VOL_SURFACE = new BlackVolatilitySurfaceDelta(DELTA_SURFACE, FORWARD_CURVE);
    final StaticReplicationDataBundle DELTA_MARKET = new StaticReplicationDataBundle(DELTA_VOL_SURFACE, FUNDING, FORWARD_CURVE);

    // Compute the surface
    final NodalDoublesSurface vegaSurface = DELTA_CAL.calcBlackVegaForEntireSurface(swapStartsNow, DELTA_MARKET);
    // Sum up each constituent
    final double[] vegaBuckets = vegaSurface.getZDataAsPrimitive();
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

        additiveShift = false;
      }
      volSurfScen = market.getVolatilitySurface().withShift(shiftVol, additiveShift);
    }
   
    final StaticReplicationDataBundle marketScen = new StaticReplicationDataBundle(volSurfScen, market.getDiscountCurve(), fwdCurveScen);
   
    // Compute present value under scenario
    final double pvScen = derivative.accept(s_pvCalculator, marketScen);
   
    // Return with spec
View Full Code Here

Examples of com.opengamma.analytics.financial.equity.StaticReplicationDataBundle

    final Set<EquityIndexOption> vanillas = vanillaDecomposition(now, barrierSec, smoothing, overhedge);
    if (vanillas.iterator().next().getTimeToSettlement() < 0.0) {
      throw new OpenGammaRuntimeException("EquityBarrierOptionSecurity with expiry, " + barrierSec.getExpiry().getExpiry().toString() + ", has already settled.");
    }
    // 3. Build up the market data bundle
    final StaticReplicationDataBundle market = buildMarketBundle(underlyingId, executionContext, inputs, target, desiredValues);

    // 4. Properties of what's required of this function
    final ValueProperties resultProperties = desiredValue.getConstraints().copy().get();
    // 5. Compute Values and return
    return computeValues(vanillas, market, inputs, desiredValues, target.toSpecification(), resultProperties);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.