コード例 #1
0
        public virtual void test_presentValueSensitivity()
        {
            PointSensitivityBuilder pt1   = PRODUCT_PRICER.presentValueSensitivity(CMS_ONE_LEG, RATES_PROVIDER);
            PointSensitivityBuilder pt2   = PRODUCT_PRICER.presentValueSensitivity(CMS_TWO_LEGS, RATES_PROVIDER);
            PointSensitivityBuilder ptCms = CMS_LEG_PRICER.presentValueSensitivity(CMS_LEG, RATES_PROVIDER);
            PointSensitivityBuilder ptPay = SWAP_LEG_PRICER.presentValueSensitivity(PAY_LEG, RATES_PROVIDER);

            assertEquals(pt1, ptCms);
            assertEquals(pt2, ptCms.combinedWith(ptPay));
        }
コード例 #2
0
        public virtual void test_presentValueSensitivity()
        {
            PointSensitivities      pt1     = TRADE_PRICER.presentValueSensitivity(CMS_TRADE_PREMIUM, RATES_PROVIDER);
            PointSensitivities      pt2     = TRADE_PRICER.presentValueSensitivity(CMS_TRADE, RATES_PROVIDER);
            PointSensitivityBuilder ptProd1 = PRODUCT_PRICER.presentValueSensitivity(CMS_ONE_LEG, RATES_PROVIDER);
            PointSensitivityBuilder ptProd2 = PRODUCT_PRICER.presentValueSensitivity(CMS_TWO_LEGS, RATES_PROVIDER);
            PointSensitivityBuilder ptPrem  = PREMIUM_PRICER.presentValueSensitivity(PREMIUM, RATES_PROVIDER);

            assertEquals(pt1, ptProd1.combinedWith(ptPrem).build());
            assertEquals(pt2, ptProd2.build());
        }
コード例 #3
0
        /// <summary>
        /// Calculates the present value curve sensitivity of the CMS trade by simple forward estimation.
        /// <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 CMS trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <returns> the present value sensitivity </returns>
        public virtual PointSensitivities presentValueSensitivity(ResolvedCmsTrade trade, RatesProvider ratesProvider)
        {
            PointSensitivityBuilder pvSensiCms = productPricer.presentValueSensitivity(trade.Product, ratesProvider);

            if (!trade.Premium.Present)
            {
                return(pvSensiCms.build());
            }
            PointSensitivityBuilder pvSensiPremium = paymentPricer.presentValueSensitivity(trade.Premium.get(), ratesProvider);

            return(pvSensiCms.combinedWith(pvSensiPremium).build());
        }