public virtual void test_pvExplain()
        {
            ExplainMap explain1 = PRODUCT_PRICER.explainPresentValue(CMS_ONE_LEG, RATES_PROVIDER, VOLATILITIES);

            assertEquals(explain1.get(ExplainKey.ENTRY_TYPE).get(), "CmsSwap");
            assertEquals(explain1.get(ExplainKey.LEGS).get().size(), 1);
            ExplainMap explain2 = PRODUCT_PRICER.explainPresentValue(CMS_TWO_LEGS, RATES_PROVIDER, VOLATILITIES);

            assertEquals(explain2.get(ExplainKey.ENTRY_TYPE).get(), "CmsSwap");
            assertEquals(explain2.get(ExplainKey.LEGS).get().size(), 2);
            ExplainMap explainCms   = CMS_LEG_PRICER.explainPresentValue(CMS_LEG, RATES_PROVIDER, VOLATILITIES);
            ExplainMap explainOther = SWAP_LEG_PRICER.explainPresentValue(CMS_TWO_LEGS.PayLeg.get(), RATES_PROVIDER);

            assertEquals(explain2.get(ExplainKey.LEGS).get().get(0), explainCms);
            assertEquals(explain2.get(ExplainKey.LEGS).get().get(1), explainOther);
        }
示例#2
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Explains the present value of the CMS trade.
 /// <para>
 /// This returns explanatory information about the calculation.
 ///
 /// </para>
 /// </summary>
 /// <param name="cms">  the CMS product </param>
 /// <param name="ratesProvider">  the rates provider </param>
 /// <param name="swaptionVolatilities">  the swaption volatilities </param>
 /// <returns> the explain PV map </returns>
 public virtual ExplainMap explainPresentValue(ResolvedCms cms, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
 {
     return(productPricer.explainPresentValue(cms, ratesProvider, swaptionVolatilities));
 }