Esempio n. 1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value sensitivity of the Overnight rate future trade.
        /// <para>
        /// The present value sensitivity of the trade is the sensitivity of the present value to
        /// the underlying curves.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <returns> the present value curve sensitivity of the trade </returns>
        public virtual PointSensitivities presentValueSensitivity(ResolvedOvernightFutureTrade trade, RatesProvider ratesProvider)
        {
            ResolvedOvernightFuture product          = trade.Product;
            PointSensitivities      priceSensi       = productPricer.priceSensitivity(product, ratesProvider);
            PointSensitivities      marginIndexSensi = productPricer.marginIndexSensitivity(product, priceSensi);

            return(marginIndexSensi.multipliedBy(trade.Quantity));
        }
        //-------------------------------------------------------------------------
        public virtual void test_marginIndexSensitivity()
        {
            double             notional         = FUTURE.Notional;
            double             accrualFactor    = FUTURE.AccrualFactor;
            PointSensitivities priceSensitivity = PRICER.priceSensitivity(FUTURE, RATES_PROVIDER);
            PointSensitivities sensiComputed    = PRICER.marginIndexSensitivity(FUTURE, priceSensitivity);

            assertTrue(sensiComputed.equalWithTolerance(priceSensitivity.multipliedBy(accrualFactor * notional), TOL * notional));
        }