Examples of SABRHaganVolatilityFunction


Examples of com.opengamma.analytics.financial.model.volatility.smile.function.SABRHaganVolatilityFunction

        10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {-0.15,
        -0.15, -0.15, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.00, 0.25, 0.10, 0.40, 0.00, 0.00, 0.00, 0.00, 0.10, 0.10, 0.10}, INTERPOLATOR_2D);
    final InterpolatedDoublesSurface nuSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0,
        10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {0.50, 0.50,
        0.50, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.45, 0.25, 0.25, 0.40, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35}, INTERPOLATOR_2D);
    return new SABRInterestRateParameters(alphaSurface, betaSurface, rhoSurface, nuSurface, DAY_COUNT, new SABRHaganVolatilityFunction());
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.smile.function.SABRHaganVolatilityFunction

  @Test
  public void testPriceChangeSABRFormula() {
    final YieldCurveBundle curves = TestsDataSetsSABR.createCurves1();
    // SABR Hagan volatility function
    final SABRInterestRateParameters sabrParameterHagan = TestsDataSetsSABR.createSABR1(new SABRHaganVolatilityFunction());
    final SABRInterestRateDataBundle sabrHaganBundle = new SABRInterestRateDataBundle(sabrParameterHagan, curves);
    final double priceHagan = CMS_COUPON_RECEIVER.accept(PVC, sabrHaganBundle);
    // From previous run
    assertEquals(8853.300, priceHagan, 1E-2);
    // No convexity adjustment
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.smile.function.SABRHaganVolatilityFunction

  @Test
  public void testPriceChangeSABRFormula() {
    final YieldCurveBundle curves = TestsDataSetsSABR.createCurves1();
    // SABR Hagan volatility function
    final SABRInterestRateParameters sabrParameterHagan = TestsDataSetsSABR.createSABR1(new SABRHaganVolatilityFunction());
    final SABRInterestRateDataBundle sabrHaganBundle = new SABRInterestRateDataBundle(sabrParameterHagan, curves);
    final double priceHagan = SWAPTION_LONG_PAYER.accept(PVC, sabrHaganBundle);
    // From previous run
    assertEquals(1905857.579, priceHagan, 1E-2);
    // SABR Hagan alternative volatility function
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.smile.function.SABRHaganVolatilityFunction

    final double alpha = 0.2;
    final double beta = 0.7;
    final double rho = -0.4;
    final double nu = 0.3;
    final SABRFormulaData data = new SABRFormulaData(alpha, beta, rho, nu);
    final SABRHaganVolatilityFunction sabr = new SABRHaganVolatilityFunction();

    final Function<Double, Double> densityFunc = new Function<Double, Double>() {
      @Override
      public Double evaluate(final Double... x) {
        final double t = x[0];
        final double k = x[1];
        final double[] d1 = new double[5];
        final double[][] d2 = new double[2][2];
        final double vol = sabr.getVolatilityAdjoint2(new EuropeanVanillaOption(k, t, false), 1.0, data, d1, d2);
        final double dSigmadK = d1[1];
        final double d2SigmadK2 = d2[1][1];
        final double dg = BlackFormulaRepository.dualGamma(1.0, k, t, vol);
        final double vanna = BlackFormulaRepository.dualVanna(1.0, k, t, vol);
        final double vega = BlackFormulaRepository.vega(1.0, k, t, vol);
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.