/** * Computes the option security price volatility sensitivity. The future price is computed without * convexity adjustment. * * @param security The future option security. * @param normalData The normal volatility and multi-curves provider. * @return The security price Black volatility sensitivity. */ public SurfaceValue priceNormalSensitivity( final InterestRateFutureOptionMarginSecurity security, final NormalSTIRFuturesSmileProviderInterface normalData) { ArgumentChecker.notNull(security, "Option security"); ArgumentChecker.notNull(normalData, "Normal data"); // Forward sweep final double priceFuture = METHOD_FUTURE.price(security.getUnderlyingFuture(), normalData.getMulticurveProvider()); final double strike = security.getStrike(); final EuropeanVanillaOption option = new EuropeanVanillaOption(strike, security.getExpirationTime(), security.isCall()); final double delay = security.getUnderlyingFuture().getLastTradingTime() - security.getExpirationTime(); final double volatility = normalData.getVolatility(security.getExpirationTime(), security.getStrike(), delay); final NormalFunctionData normalPoint = new NormalFunctionData(priceFuture, 1.0, volatility); // Backward sweep final double[] priceAdjoint = new double[3]; NORMAL_FUNCTION.getPriceAdjoint(option, normalPoint, priceAdjoint); final double priceBar = 1.0; final double volatilityBar = priceAdjoint[1] * priceBar; final DoublesPair expiryStrikeDelay = new DoublesPair(security.getExpirationTime(), strike); final SurfaceValue sensi = SurfaceValue.from(expiryStrikeDelay, volatilityBar); return sensi; }
/** * Computes the option security price curve sensitivity. The future price is computed without * convexity adjustment. It is supposed that for a given strike the volatility does not change * with the curves (sticky strike). * * @param security The future option security. * @param normalData The normal volatility and multi-curves provider. * @return The security price curve sensitivity. */ @Override public MulticurveSensitivity priceCurveSensitivity( final InterestRateFutureOptionMarginSecurity security, final NormalSTIRFuturesSmileProviderInterface normalData) { ArgumentChecker.notNull(security, "Option security"); ArgumentChecker.notNull(normalData, "Normal data"); // Forward sweep final double priceFuture = METHOD_FUTURE.price(security.getUnderlyingFuture(), normalData.getMulticurveProvider()); final EuropeanVanillaOption option = new EuropeanVanillaOption( security.getStrike(), security.getExpirationTime(), security.isCall()); final double delay = security.getUnderlyingFuture().getLastTradingTime() - security.getExpirationTime(); final double volatility = normalData.getVolatility(security.getExpirationTime(), security.getStrike(), delay); final NormalFunctionData normalPoint = new NormalFunctionData(priceFuture, 1.0, volatility); // Backward sweep final double[] priceAdjoint = new double[3]; NORMAL_FUNCTION.getPriceAdjoint(option, normalPoint, priceAdjoint); final double priceBar = 1.0; final double priceFutureBar = priceAdjoint[0] * priceBar; final MulticurveSensitivity priceFutureDerivative = METHOD_FUTURE.priceCurveSensitivity( security.getUnderlyingFuture(), normalData.getMulticurveProvider()); return priceFutureDerivative.multipliedBy(priceFutureBar); }
/** * Computes the option security price from future price. * * @param security The future option security. * @param normalData The normal volatility and multi-curves provider. * @param priceFuture The price of the underlying future. * @return The security price. */ public double priceFromFuturePrice( final InterestRateFutureOptionMarginSecurity security, final NormalSTIRFuturesSmileProviderInterface normalData, final double priceFuture) { ArgumentChecker.notNull(security, "Option security"); ArgumentChecker.notNull(normalData, "Normal data"); final EuropeanVanillaOption option = new EuropeanVanillaOption( security.getStrike(), security.getExpirationTime(), security.isCall()); final double delay = security.getUnderlyingFuture().getLastTradingTime() - security.getExpirationTime(); final double volatility = normalData.getVolatility(security.getExpirationTime(), security.getStrike(), delay); final NormalFunctionData normalPoint = new NormalFunctionData(priceFuture, 1.0, volatility); final double priceSecurity = NORMAL_FUNCTION.getPriceFunction(option).evaluate(normalPoint); return priceSecurity; }