public virtual void test_currentCash()
        {
            MultiCurrencyAmount cc1 = PRODUCT_PRICER.currentCash(CMS_ONE_LEG, RATES_PROVIDER, VOLATILITIES);
            MultiCurrencyAmount cc2 = PRODUCT_PRICER.currentCash(CMS_TWO_LEGS, RATES_PROVIDER, VOLATILITIES);

            assertEquals(cc1, MultiCurrencyAmount.of(CurrencyAmount.zero(EUR)));
            assertEquals(cc2, MultiCurrencyAmount.of(CurrencyAmount.zero(EUR)));
        }
        public virtual void test_currentCash_onPay()
        {
            MultiCurrencyAmount cc1     = TRADE_PRICER.currentCash(CMS_TRADE_PREMIUM, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY);
            MultiCurrencyAmount cc2     = TRADE_PRICER.currentCash(CMS_TRADE, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY);
            MultiCurrencyAmount ccProd1 = PRODUCT_PRICER.currentCash(CMS_ONE_LEG, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY);
            MultiCurrencyAmount ccProd2 = PRODUCT_PRICER.currentCash(CMS_TWO_LEGS, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY);

            assertEquals(cc1, ccProd1);
            assertEquals(cc2, ccProd2);
        }
Beispiel #3
0
        /// <summary>
        /// Calculates the current cash of the trade.
        /// </summary>
        /// <param name="trade">  the CMS trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="swaptionVolatilities">  the swaption volatilities </param>
        /// <returns> the current cash </returns>
        public virtual MultiCurrencyAmount currentCash(ResolvedCmsTrade trade, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
        {
            MultiCurrencyAmount ccCms = productPricer.currentCash(trade.Product, ratesProvider, swaptionVolatilities);

            if (!trade.Premium.Present)
            {
                return(ccCms);
            }
            Payment premium = trade.Premium.get();

            if (premium.Date.Equals(ratesProvider.ValuationDate))
            {
                ccCms = ccCms.plus(premium.Currency, premium.Amount);
            }
            return(ccCms);
        }