//-------------------------------------------------------------------------
        /// <summary>
        /// Computes the present value sensitivity to the normal 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="ratesProvider">  the rates provider </param>
        /// <param name="volatilities">  the volatilities </param>
        /// <param name="futurePrice">  the price of the underlying future, in decimal form </param>
        /// <returns> the price sensitivity </returns>
        public IborFutureOptionSensitivity presentValueSensitivityModelParamsVolatility(ResolvedIborFutureOptionTrade futureOptionTrade, RatesProvider ratesProvider, NormalIborFutureOptionVolatilities volatilities, double futurePrice)
        {
            ResolvedIborFutureOption    product          = futureOptionTrade.Product;
            IborFutureOptionSensitivity priceSensitivity = futureOptionPricer.priceSensitivityModelParamsVolatility(product, ratesProvider, volatilities, futurePrice);
            double factor = futureOptionPricer.marginIndex(product, 1) * futureOptionTrade.Quantity;

            return(priceSensitivity.multipliedBy(factor));
        }
示例#2
0
        //-------------------------------------------------------------------------
        public virtual void test_multipliedBy()
        {
            IborFutureOptionSensitivity @base    = IborFutureOptionSensitivity.of(NAME, 12d, date(2015, 8, 28), 0.98, 0.99, GBP, 32d);
            IborFutureOptionSensitivity expected = IborFutureOptionSensitivity.of(NAME, 12d, date(2015, 8, 28), 0.98, 0.99, GBP, 32d * 3.5d);
            IborFutureOptionSensitivity test     = @base.multipliedBy(3.5d);

            assertEquals(test, expected);
        }