Package com.opengamma.analytics.financial.equity.variance.pricing

Examples of com.opengamma.analytics.financial.equity.variance.pricing.DisplacedDiffusionModel


    final double vol1 = DELTA_VOLSURFACE.getVolatility(expiry1, delta1);
    final double strike1 = BlackFormulaRepository.impliedStrike(delta1, true, forward, expiry1, vol1);
    final double delta2 = 0.5;
    final double vol2 = DELTA_VOLSURFACE.getVolatility(expiry1, delta2);
    final double strike2 = BlackFormulaRepository.impliedStrike(delta2, true, forward, expiry1, vol2);
    final DisplacedDiffusionModel logBlack = new DisplacedDiffusionModel(forward, expiry1, strike1, vol1, strike2, vol2);

    assertEquals(logBlack.getVol(), 0.25, 1e-9);
    assertEquals(logBlack.getShift(), 0.0, 1e-9);
  }
View Full Code Here


    final double vol1 = constVolSurf.getVolatility(expiry1, delta1);
    final double strike1 = BlackFormulaRepository.impliedStrike(delta1, true, forward, expiry1, vol1);
    final double delta2 = 0.5;
    final double vol2 = constVolSurf.getVolatility(expiry1, delta2);
    final double strike2 = BlackFormulaRepository.impliedStrike(delta2, true, forward, expiry1, vol2);
    final DisplacedDiffusionModel logBlack = new DisplacedDiffusionModel(forward, expiry1, strike1, vol1, strike2, vol2);

    assertEquals(logBlack.getVol(), 0.25, 1e-9);
    assertEquals(logBlack.getShift(), 0.0, 1e-9);
  }
View Full Code Here

  public void testOnSmileySurface() {
    final double forward = FORWARD_CURVE.getForward(expiry5);
    final VectorRootFinder testSolver = new BroydenVectorRootFinder(1.0e-6, 1.0e-6, 50000);
    final double vol1 = STRIKE_VOLSURFACE.getVolatility(expiry5, 40);
    final double vol2 = STRIKE_VOLSURFACE.getVolatility(expiry5, 41);
    final DisplacedDiffusionModel logBlack = new DisplacedDiffusionModel(forward, expiry5, 40, vol1, 41, vol2, 0.26, 0.01, testSolver);

    //TODO really - more magic numbers
    assertEquals(0.21148605807417542, logBlack.getVol(), 1e-8);
    assertEquals(8.183093915461424, logBlack.getShift(), 1e-8);

    final DisplacedDiffusionModel logBlackDef = new DisplacedDiffusionModel(forward, expiry5, 40, vol1, 41, vol2);
    assertEquals(logBlackDef.getVol(), logBlack.getVol(), 1e-8);
    assertEquals(logBlackDef.getShift(), logBlack.getShift(), 1e-8);

  }
View Full Code Here

    final BlackVolatilitySurface<?> volSurface = new BlackVolatilitySurfaceStrike(FunctionalDoublesSurface.from(surf));
    final double forward = FORWARD_CURVE.getForward(expiry5);
    final double vol1 = volSurface.getVolatility(expiry5, 40);
    final double vol2 = volSurface.getVolatility(expiry5, 41);
    final DisplacedDiffusionModel logBlackDef = new DisplacedDiffusionModel(forward, expiry5, 40, vol1, 41, vol2);
    assertEquals(sigma, logBlackDef.getVol(), 1e-8);
    assertEquals(displacement, logBlackDef.getShift(), 1e-6);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.equity.variance.pricing.DisplacedDiffusionModel

Copyright © 2018 www.massapicom. 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.