Examples of EuropeanVanillaOption


Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

      final double f = forward * rFwds[i];
      deltas[i] = BlackFormulaRepository.delta(f, strike, expiry, sigmas[i], isCall);
      dualDeltas[i] = BlackFormulaRepository.dualDelta(f, strike, expiry, sigmas[i], isCall);
    }

    final double impVol = getVolatility(new EuropeanVanillaOption(strike, expiry, isCall), forward, data);
    final double vega = BlackFormulaRepository.vega(forward, strike, expiry, impVol);
    final double delta = BlackFormulaRepository.delta(forward, strike, expiry, impVol, isCall);
    final double dualDelta = BlackFormulaRepository.dualDelta(forward, strike, expiry, impVol, isCall);

    final double[] res = new double[nParms + 3];
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

    for (int i = 0; i < n; i++) {
      deltas[i] = BlackFormulaRepository.delta(forward * rFwds[i], strike, expiry, sigmas[i], isCall);
    }

    final double impVol = getVolatility(new EuropeanVanillaOption(strike, expiry, isCall), forward, data);
    final double vega = BlackFormulaRepository.vega(forward, strike, expiry, impVol);

    return getModelAjoint(forward, strike, expiry, data, deltas, vega);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

  }

  @ExternalFunction
  public double getVolatility(final double forward, final double strike, final double timeToExpiry, final double alpha, final double beta, final double rho, final double nu) {
    Validate.isTrue(forward > 0, "Forward must be > 0");
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strike, timeToExpiry, true);
    final SABRFormulaData data = new SABRFormulaData(alpha, beta, rho, nu);
    return getVolatility(option, forward, data);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

    final double pvbpModified = METHOD_SWAP.presentValueBasisPoint(swaption.getUnderlyingSwap(), dayCountModification,
        calendar, multicurves);
    final double forwardModified = PRDC.visitFixedCouponSwap(swaption.getUnderlyingSwap(), dayCountModification, multicurves);
    final double strikeModified = METHOD_SWAP.couponEquivalent(swaption.getUnderlyingSwap(), pvbpModified, multicurves);
    final double maturity = swaption.getMaturityTime();
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strikeModified, swaption.getTimeToExpiry(), swaption.isCall());
    // Implementation note: option required to pass the strike (in case the swap has non-constant coupon).
    final BlackPriceFunction blackFunction = new BlackPriceFunction();
    final double volatility = blackMulticurves.getBlackParameters().getVolatility(swaption.getTimeToExpiry(), maturity);
    final BlackFunctionData dataBlack = new BlackFunctionData(forwardModified, pvbpModified, volatility);
    final Function1D<BlackFunctionData, Double> func = blackFunction.getPriceFunction(option);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

    // Derivative of the forward and pvbp with respect to the rates.
    final MulticurveSensitivity pvbpModifiedDr = METHOD_SWAP.presentValueBasisPointCurveSensitivity(swaption.getUnderlyingSwap(), dayCountModification,
        calendar, multicurves);
    final MulticurveSensitivity forwardModifiedDr = PRCSDC.visitFixedCouponSwap(swaption.getUnderlyingSwap(), dayCountModification, multicurves);
    // Implementation note: strictly speaking, the strike equivalent is curve dependent; that dependency is ignored.
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strikeModified, swaption.getTimeToExpiry(), swaption.isCall());
    // Implementation note: option required to pass the strike (in case the swap has non-constant coupon).
    final BlackPriceFunction blackFunction = new BlackPriceFunction();
    final double volatility = blackMulticurves.getBlackParameters().getVolatility(swaption.getTimeToExpiry(), maturity);
    final BlackFunctionData dataBlack = new BlackFunctionData(forwardModified, 1.0, volatility);
    final double[] bsAdjoint = blackFunction.getPriceAdjoint(option, dataBlack);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

    final MulticurveProviderInterface multicurves = blackMulticurves.getMulticurveProvider();
    final double pvbpModified = METHOD_SWAP.presentValueBasisPoint(swaption.getUnderlyingSwap(), dayCountModification, calendar, multicurves);
    final double forwardModified = PRDC.visitFixedCouponSwap(swaption.getUnderlyingSwap(), dayCountModification, multicurves);
    final double strikeModified = METHOD_SWAP.couponEquivalent(swaption.getUnderlyingSwap(), pvbpModified, multicurves);
    final double maturity = swaption.getMaturityTime();
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strikeModified, swaption.getTimeToExpiry(), swaption.isCall());
    // Implementation note: option required to pass the strike (in case the swap has non-constant coupon).
    final DoublesPair point = new DoublesPair(swaption.getTimeToExpiry(), maturity);
    final BlackPriceFunction blackFunction = new BlackPriceFunction();
    final double volatility = blackMulticurves.getBlackParameters().getVolatility(point);
    final BlackFunctionData dataBlack = new BlackFunctionData(forwardModified, 1.0, volatility);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

   * @return The volatility.
   */
  public double getVolatility(final double expiryTime, final double maturity, final double strike, final double forward) {
    final DoublesPair expiryMaturity = new DoublesPair(expiryTime, maturity);
    final SABRFormulaData data = new SABRFormulaData(getAlpha(expiryMaturity), getBeta(expiryMaturity), getRho(expiryMaturity), getNu(expiryMaturity));
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strike, expiryTime, true);
    final Function1D<SABRFormulaData, Double> funcSabrLongPayer = _sabrFunction.getVolatilityFunction(option, forward);
    return funcSabrLongPayer.evaluate(data);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

  public double[] getVolatilityAdjoint(final double expiryTime, final double maturity, final double strike, final double forward) {
    ArgumentChecker.isTrue(_sabrFunction instanceof SABRHaganVolatilityFunction, "Adjoint volatility available only for Hagan formula");
    final SABRHaganVolatilityFunction sabrHaganFunction = (SABRHaganVolatilityFunction) _sabrFunction;
    final DoublesPair expiryMaturity = new DoublesPair(expiryTime, maturity);
    final SABRFormulaData data = new SABRFormulaData(getAlpha(expiryMaturity), getBeta(expiryMaturity), getRho(expiryMaturity), getNu(expiryMaturity));
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strike, expiryTime, true);
    final double[] result = sabrHaganFunction.getVolatilityAdjoint(option, forward, data);
    return result;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

    ArgumentChecker.notNull(sabrData, "sabr data");
    final double pvbpModified = METHOD_SWAP.presentValueBasisPoint(swaption.getUnderlyingSwap(), sabrData.getSABRParameter().getDayCount(), sabrData);
    final double forwardModified = PRC.visitFixedCouponSwap(swaption.getUnderlyingSwap(), sabrData.getSABRParameter().getDayCount(), sabrData);
    final double strikeModified = METHOD_SWAP.couponEquivalent(swaption.getUnderlyingSwap(), pvbpModified, sabrData);
    final double maturity = swaption.getMaturityTime();
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strikeModified, swaption.getTimeToExpiry(), swaption.isCall());
    // Implementation note: option required to pass the strike (in case the swap has non-constant coupon).
    if (strikeModified <= _cutOffStrike) { // No extrapolation
      final BlackPriceFunction blackFunction = new BlackPriceFunction();
      final double volatility = sabrData.getSABRParameter().getVolatility(swaption.getTimeToExpiry(), maturity, strikeModified, forwardModified);
      final BlackFunctionData dataBlack = new BlackFunctionData(forwardModified, pvbpModified, volatility);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption

    final double maturity = swaption.getMaturityTime();
    // Derivative of the forward and pvbp with respect to the rates.
    final InterestRateCurveSensitivity pvbpModifiedDr = METHOD_SWAP.presentValueBasisPointCurveSensitivity(swaption.getUnderlyingSwap(), dayCountModification, sabrData);
    final InterestRateCurveSensitivity forwardModifiedDr = new InterestRateCurveSensitivity(PRSC.visitFixedCouponSwap(swaption.getUnderlyingSwap(), dayCountModification, sabrData));
    // Implementation note: option required to pass the strike (in case the swap has non-constant coupon).
    final EuropeanVanillaOption option = new EuropeanVanillaOption(strikeModified, swaption.getTimeToExpiry(), swaption.isCall());
    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);
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.