@Test /** Test the option price from the future price. Standard option. */ public void priceStandard() { final double expirationTime = ACT_ACT.getDayCountFraction(REFERENCE_DATE, LAST_TRADING_DATE); final InterestRateFutureOptionMarginSecurity optionEDU2Standard = new InterestRateFutureOptionMarginSecurity(EDU2, expirationTime, STRIKE, IS_CALL); final double priceOption = METHOD.optionPrice(optionEDU2Standard, SABR_BUNDLE); final InterestRateFutureSecurityDiscountingMethod methodFuture = InterestRateFutureSecurityDiscountingMethod.getInstance(); final double priceFuture = methodFuture.priceFromCurves(EDU2, CURVES_BUNDLE); final double priceOptionExpected = METHOD.optionPriceFromFuturePrice(optionEDU2Standard, SABR_BUNDLE, priceFuture); assertEquals( "Future option with SABR volatilities: option price", priceOptionExpected, priceOption); }
@Test /** Test the option price from the future price. Mid-curve one year option. */ public void priceFromFuturePriceMidCurve() { final double priceFuture = 0.9905; final double priceOption = METHOD.optionPriceFromFuturePrice(OPTION_EDU2, SABR_BUNDLE, priceFuture); final double delay = EDU2.getLastTradingTime() - EXPIRATION_TIME; final double volatility = SABR_PARAMETER.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 /** Test the option price from the future price. Standard option. */ 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.optionPriceFromFuturePrice(optionEDU2Standard, SABR_BUNDLE, priceFuture); final double delay = 0.0; final double volatility = SABR_PARAMETER.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); }