Package com.opengamma.analytics.financial.model.volatility.surface

Examples of com.opengamma.analytics.financial.model.volatility.surface.PriceSurface


        final double fwd = forwardCurve.getForward(t);
        final double vol = impVol.getVolatility(t, k);
        return discountCurve.getDiscountFactor(t) * BlackFormulaRepository.price(fwd, k, t, vol, true);
      }
    };
    return new PriceSurface(FunctionalDoublesSurface.from(priceSurface));
  }
View Full Code Here


    final double[] mu = new double[] {0.0, 0.3, -0.5 };
    //    double[] w = new double[] {0.99, 0.01, 0.0000};
    //    double[] sigma = new double[] {0.3, 0.5, 0.8};
    //  double[] mu = new double[] {0.0, 0.0, -0.0};
    final MultiHorizonMixedLogNormalModelData data = new MultiHorizonMixedLogNormalModelData(w, sigma, mu);
    final PriceSurface priceSurf = MixedLogNormalVolatilitySurface.getPriceSurface(FWD_CURVE, DIS_CURVE, data);
    final LocalVolatilitySurfaceStrike locVol = MixedLogNormalVolatilitySurface.getLocalVolatilitySurface(FWD_CURVE, data);

    final double k = 14.0;
    final boolean isCall = true;

    final int tNodes = 50;
    final int nu = 20;
    final int xNodes = nu * tNodes;

    final EuropeanVanillaOption option = new EuropeanVanillaOption(k, T, isCall);
    final double pdePrice = PRICER.price(FWD_CURVE, RISK_FREE_CURVE, option, locVol, isCall, xNodes, tNodes, 0.05, 0.0, 8.0);
    final double mlnPrice = priceSurf.getPrice(T, k);

    //    double relErr = Math.abs((pdePrice - mlnPrice) / mlnPrice);
    //     System.out.println(mlnPrice + "\t" + pdePrice + "\t" + relErr);
    assertEquals(mlnPrice, pdePrice, 5e-3 * mlnPrice);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.volatility.surface.PriceSurface

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.