public virtual void test_currentCash_onPay()
        {
            MultiCurrencyAmount cc1   = PRODUCT_PRICER.currentCash(CMS_ONE_LEG, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY);
            MultiCurrencyAmount cc2   = PRODUCT_PRICER.currentCash(CMS_TWO_LEGS, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY);
            CurrencyAmount      ccCms = CMS_LEG_PRICER.currentCash(CMS_LEG, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY);
            CurrencyAmount      ccPay = SWAP_LEG_PRICER.currentCash(PAY_LEG, RATES_PROVIDER_ON_PAY);

            assertEquals(cc1, MultiCurrencyAmount.of(ccCms));
            assertEquals(cc2, MultiCurrencyAmount.of(ccCms).plus(ccPay));
        }
Пример #2
0
        /// <summary>
        /// Calculates the current cash of the product.
        /// </summary>
        /// <param name="cms">  the CMS product </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="swaptionVolatilities">  the swaption volatilities </param>
        /// <returns> the current cash </returns>
        public virtual MultiCurrencyAmount currentCash(ResolvedCms cms, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
        {
            CurrencyAmount ccCmsLeg = cmsLegPricer.currentCash(cms.CmsLeg, ratesProvider, swaptionVolatilities);

            if (!cms.PayLeg.Present)
            {
                return(MultiCurrencyAmount.of(ccCmsLeg));
            }
            CurrencyAmount ccPayLeg = payLegPricer.currentCash(cms.PayLeg.get(), ratesProvider);

            return(MultiCurrencyAmount.of(ccPayLeg).plus(ccCmsLeg));
        }
Пример #3
0
        //-------------------------------------------------------------------------
        public virtual void test_currentCash()
        {
            CurrencyAmount computed = LEG_PRICER.currentCash(FLOOR_LEG, RATES_PROVIDER, VOLATILITIES);

            assertEquals(computed, CurrencyAmount.zero(EUR));
        }