Package com.opengamma.analytics.financial.model.volatility.smile.function

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


        k = 3.0 + j / 10.0;
        final EuropeanVanillaOption option = new EuropeanVanillaOption(k, t, true);
        final CEVFunctionData cevData = new CEVFunctionData(f, 1.0, sigma, beta);
        final double price = CEV.getPriceFunction(option).evaluate(cevData);
        final double vol = BLACK_IMPLIED_VOL.getImpliedVolatility(new BlackFunctionData(f, 1.0, sigma), option, price);
        final SABRFormulaData sabrData = new SABRFormulaData(sigma, beta, 0.0, 0.0);
        final double sabrVol = SABR.getVolatilityFunction(option, f).evaluate(sabrData);
        assertEquals(sabrVol, vol, 1e-4);//TODO this used to work with 1e-5????
      }
    }
  }
View Full Code Here


      final DoublesPair expiryMaturity = new DoublesPair(swaption.getTimeToExpiry(), maturity);
      final double alpha = sabrData.getSABRParameter().getAlpha(expiryMaturity);
      final double beta = sabrData.getSABRParameter().getBeta(expiryMaturity);
      final double rho = sabrData.getSABRParameter().getRho(expiryMaturity);
      final double nu = sabrData.getSABRParameter().getNu(expiryMaturity);
      final SABRFormulaData sabrParam = new SABRFormulaData(alpha, beta, rho, nu);
      final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, _cutOffStrike, swaption.getTimeToExpiry(), _mu);
      price = discountFactorSettle * pvbp * sabrExtrapolation.price(swaption) * (swaption.isLong() ? 1.0 : -1.0);
    }
    return price;
  }
View Full Code Here

    final DoublesPair expiryMaturity = new DoublesPair(swaption.getTimeToExpiry(), maturity);
    final double alpha = sabrData.getSABRParameter().getAlpha(expiryMaturity);
    final double beta = sabrData.getSABRParameter().getBeta(expiryMaturity);
    final double rho = sabrData.getSABRParameter().getRho(expiryMaturity);
    final double nu = sabrData.getSABRParameter().getNu(expiryMaturity);
    final SABRFormulaData sabrParam = new SABRFormulaData(alpha, beta, rho, nu);
    final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, _cutOffStrike, swaption.getTimeToExpiry(), _mu);
    final double price = sabrExtrapolation.price(swaption);
    result = result.multipliedBy(pvbp * price);
    result = result.plus(forwardDr.multipliedBy(discountFactorSettle * (pvbpDf * price + pvbp * sabrExtrapolation.priceDerivativeForward(swaption))));
    if (!swaption.isLong()) {
View Full Code Here

    final DoublesPair expiryMaturity = new DoublesPair(swaption.getTimeToExpiry(), maturity);
    final double alpha = sabrData.getSABRParameter().getAlpha(expiryMaturity);
    final double beta = sabrData.getSABRParameter().getBeta(expiryMaturity);
    final double rho = sabrData.getSABRParameter().getRho(expiryMaturity);
    final double nu = sabrData.getSABRParameter().getNu(expiryMaturity);
    final SABRFormulaData sabrParam = new SABRFormulaData(alpha, beta, rho, nu);
    final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, _cutOffStrike, swaption.getTimeToExpiry(), _mu);
    final double[] priceDSabr = new double[4];
    sabrExtrapolation.priceAdjointSABR(swaption, priceDSabr);
    final double omega = (swaption.isLong() ? 1.0 : -1.0);
    sensi.addAlpha(expiryMaturity, omega * discountFactorSettle * pvbp * priceDSabr[0]);
 
View Full Code Here

      for (int tIndex = 0; tIndex < nCaplets; tIndex++) {
        f = capletFwds[tIndex];
        t = capletExpiries[tIndex];
        final EuropeanVanillaOption option = new EuropeanVanillaOption(k, t, true);
        //TODO again this is SABR specific
        final SABRFormulaData data = new SABRFormulaData(cAlpha.getYValue(t), cBeta.getYValue(t), cRho.getYValue(t), cNu.getYValue(t));
        greeks[tIndex] = SABR.getVolatilityAdjoint(option, f, data); //2nd and 3rd entries are forward & strike sensitivity which we don't use
        capletVega[tIndex] = capletDF[tIndex] * BlackFormulaRepository.vega(f, k, t, greeks[tIndex][0]);

        int parmIndex = 0;
        for (final String name : _parameterNames) {
View Full Code Here

    final double rho = -0.25;

    final double forward = SWAP_PAYER.accept(PRC, CURVES);
    final double pvbp = METHOD_SWAP.presentValueBasisPoint(SWAP_PAYER, CURVE_5);

    final SABRFormulaData data = new SABRFormulaData(alpha, beta, rho, nu);

    final Function1D<SABRFormulaData, Double> funcSabrLongPayer = SABR_FUNCTION.getVolatilityFunction(SWAPTION_LONG_PAYER, forward);
    final double volatilityLongPayer = funcSabrLongPayer.evaluate(data);
    final BlackFunctionData dataBlackLP = new BlackFunctionData(forward, pvbp, volatilityLongPayer);
    final Function1D<BlackFunctionData, Double> funcBlackLongPayer = BLACK_FUNCTION.getPriceFunction(SWAPTION_LONG_PAYER);
View Full Code Here

    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) {
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.volatility.smile.function.SABRFormulaData

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.