public virtual void test_currentCash_onPay() { MultiCurrencyAmount cc1 = PRODUCT_PRICER.currentCash(CMS_ONE_LEG, RATES_PROVIDER_ON_PAY); MultiCurrencyAmount cc2 = PRODUCT_PRICER.currentCash(CMS_TWO_LEGS, RATES_PROVIDER_ON_PAY); CurrencyAmount ccCms = CMS_LEG_PRICER.currentCash(CMS_LEG, RATES_PROVIDER_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)); }
/// <summary> /// Calculates the current cash of the product. /// </summary> /// <param name="cms"> the CMS product </param> /// <param name="ratesProvider"> the rates provider </param> /// <returns> the current cash </returns> public virtual MultiCurrencyAmount currentCash(ResolvedCms cms, RatesProvider ratesProvider) { CurrencyAmount ccCmsLeg = cmsLegPricer.currentCash(cms.CmsLeg, ratesProvider); if (!cms.PayLeg.Present) { return(MultiCurrencyAmount.of(ccCmsLeg)); } CurrencyAmount ccPayLeg = swapPricer.LegPricer.currentCash(cms.PayLeg.get(), ratesProvider); return(MultiCurrencyAmount.of(ccPayLeg).plus(ccCmsLeg)); }
//------------------------------------------------------------------------- public virtual void test_currentCash() { CurrencyAmount computed = LEG_PRICER.currentCash(COUPON_LEG, RATES_PROVIDER); assertEquals(computed, CurrencyAmount.zero(EUR)); }