InterestRateFutureOptionMarginSecuritySABRMethod extends InterestRateFutureOptionMarginSecurityGenericMethod<SABRSTIRFuturesProviderInterface> { public double priceFromFuturePrice(final InterestRateFutureOptionMarginSecurity security, final SABRSTIRFuturesProviderInterface sabrData, final double priceFuture) { ArgumentChecker.notNull(security, "Option security"); ArgumentChecker.notNull(sabrData, "SABR data"); final double rateStrike = 1.0 - security.getStrike(); final EuropeanVanillaOption option = new EuropeanVanillaOption(rateStrike, security.getExpirationTime(), !security.isCall()); final double forward = 1 - priceFuture; final double delay = security.getUnderlyingFuture().getTradingLastTime() - security.getExpirationTime(); final double volatility = sabrData.getSABRParameters().getVolatility(new double[] {security.getExpirationTime(), delay, rateStrike, forward }); final BlackFunctionData dataBlack = new BlackFunctionData(forward, 1.0, volatility); final double priceSecurity = BLACK_FUNCTION.getPriceFunction(option).evaluate(dataBlack); return priceSecurity; } private  InterestRateFutureOptionMarginSecuritySABRMethod(); static InterestRateFutureOptionMarginSecuritySABRMethod getInstance(); double priceFromFuturePrice(final InterestRateFutureOptionMarginSecurity security, final SABRSTIRFuturesProviderInterface sabrData, final double priceFuture); @Override double price(final InterestRateFutureOptionMarginSecurity security, final SABRSTIRFuturesProviderInterface sabrData); @Override MulticurveSensitivity priceCurveSensitivity(final InterestRateFutureOptionMarginSecurity security, final SABRSTIRFuturesProviderInterface sabrData); PresentValueSABRSensitivityDataBundle priceSABRSensitivity(final InterestRateFutureOptionMarginSecurity security, final SABRSTIRFuturesProviderInterface sabrData);  }
@Test public void priceFromFuturePriceMidCurve() { final double priceFuture = 0.9905; final double priceOption = METHOD_OPT_FUT_SEC_SABR.priceFromFuturePrice(OPTION_EDU2, SABR_MULTICURVES, priceFuture); final double delay = EDU2.getTradingLastTime() - EXPIRATION_TIME; final double volatility = SABR_PARAMETERS.getVolatility(EXPIRATION_TIME, delay, 1 - STRIKE, 1 - priceFuture); final BlackPriceFunction blackFunction = new BlackPriceFunction(); final BlackFunctionData dataBlack = new BlackFunctionData(1 - priceFuture, 1.0, volatility); final EuropeanVanillaOption option = new EuropeanVanillaOption(1 - STRIKE, EXPIRATION_TIME, !IS_CALL); final double priceOptionExpected = blackFunction.getPriceFunction(option).evaluate(dataBlack); assertEquals("Future option with SABR volatilities: option price from future price", priceOptionExpected, priceOption); }
@Test public void priceFromFuturePriceStandard() { final double expirationTime = ACT_ACT.getDayCountFraction(REFERENCE_DATE, LAST_TRADING_DATE); final InterestRateFutureOptionMarginSecurity optionEDU2Standard = new InterestRateFutureOptionMarginSecurity(EDU2, expirationTime, STRIKE, IS_CALL); final double priceFuture = 0.9905; final double priceOption = METHOD_OPT_FUT_SEC_SABR.priceFromFuturePrice(optionEDU2Standard, SABR_MULTICURVES, priceFuture); final double delay = 0.0; final double volatility = SABR_PARAMETERS.getVolatility(expirationTime, delay, 1 - STRIKE, 1 - priceFuture); final BlackPriceFunction blackFunction = new BlackPriceFunction(); final BlackFunctionData dataBlack = new BlackFunctionData(1 - priceFuture, 1.0, volatility); final EuropeanVanillaOption option = new EuropeanVanillaOption(1 - STRIKE, expirationTime, !IS_CALL); final double priceOptionExpected = blackFunction.getPriceFunction(option).evaluate(dataBlack); assertEquals("Future option with SABR volatilities: option price from future price", priceOptionExpected, priceOption); }