/// <summary>
        /// Calculates the present value curve sensitivity of the CMS product by simple forward estimation.
        /// <para>
        /// The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.
        ///
        /// </para>
        /// </summary>
        /// <param name="cms">  the CMS product </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <returns> the present value sensitivity </returns>
        public virtual PointSensitivityBuilder presentValueSensitivity(ResolvedCms cms, RatesProvider ratesProvider)
        {
            PointSensitivityBuilder pvSensiCmsLeg = cmsLegPricer.presentValueSensitivity(cms.CmsLeg, ratesProvider);

            if (!cms.PayLeg.Present)
            {
                return(pvSensiCmsLeg);
            }
            PointSensitivityBuilder pvSensiPayLeg = swapPricer.LegPricer.presentValueSensitivity(cms.PayLeg.get(), ratesProvider);

            return(pvSensiCmsLeg.combinedWith(pvSensiPayLeg));
        }
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value of the CMS product by simple forward estimation.
        /// </summary>
        /// <param name="cms">  the CMS product </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <returns> the present value </returns>
        public virtual MultiCurrencyAmount presentValue(ResolvedCms cms, RatesProvider ratesProvider)
        {
            CurrencyAmount pvCmsLeg = cmsLegPricer.presentValue(cms.CmsLeg, ratesProvider);

            if (!cms.PayLeg.Present)
            {
                return(MultiCurrencyAmount.of(pvCmsLeg));
            }
            CurrencyAmount pvPayLeg = swapPricer.LegPricer.presentValue(cms.PayLeg.get(), ratesProvider);

            return(MultiCurrencyAmount.of(pvCmsLeg).plus(pvPayLeg));
        }
        /// <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));
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates the currency exposure of the product.
 /// </summary>
 /// <param name="cms">  the CMS product </param>
 /// <param name="ratesProvider">  the rates provider </param>
 /// <returns> the currency exposure </returns>
 public virtual MultiCurrencyAmount currencyExposure(ResolvedCms cms, RatesProvider ratesProvider)
 {
     return(presentValue(cms, ratesProvider));
 }
Exemplo n.º 5
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));
 }