//------------------------------------------------------------------------- /// <summary> /// Computes the present value sensitivity to the Black volatility used in the pricing /// based on the price of the underlying future. /// <para> /// The result is a single sensitivity to the volatility used. /// The volatility is associated with the expiry/delay/strike/future price key combination. /// /// </para> /// </summary> /// <param name="futureOptionTrade"> the trade </param> /// <param name="discountingProvider"> the discounting provider </param> /// <param name="volatilities"> the volatilities </param> /// <param name="futurePrice"> the price of the underlying future </param> /// <returns> the price sensitivity </returns> public BondFutureOptionSensitivity presentValueSensitivityModelParamsVolatility(ResolvedBondFutureOptionTrade futureOptionTrade, LegalEntityDiscountingProvider discountingProvider, BlackBondFutureVolatilities volatilities, double futurePrice) { ResolvedBondFutureOption product = futureOptionTrade.Product; BondFutureOptionSensitivity priceSensitivity = productPricer.priceSensitivityModelParamsVolatility(product, discountingProvider, volatilities, futurePrice); double factor = productPricer.marginIndex(product, 1) * futureOptionTrade.Quantity; return(priceSensitivity.multipliedBy(factor)); }
//------------------------------------------------------------------------- public virtual void test_multipliedBy() { BondFutureOptionSensitivity @base = BondFutureOptionSensitivity.of(NAME, OPTION_EXPIRY, FUTURE_EXPIRY, STRIKE_PRICE, FUTURE_PRICE, GBP, SENSITIVITY); BondFutureOptionSensitivity expected = BondFutureOptionSensitivity.of(NAME, OPTION_EXPIRY, FUTURE_EXPIRY, STRIKE_PRICE, FUTURE_PRICE, GBP, SENSITIVITY * 3.5d); BondFutureOptionSensitivity test = @base.multipliedBy(3.5d); assertEquals(test, expected); }