Beispiel #1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value of the CMS product.
        /// <para>
        /// The present value of the product is the value on the valuation date.
        /// </para>
        /// <para>
        /// CMS leg and pay leg are typically in the same currency. Thus the present value is expressed as a
        /// single currency amount in most cases.
        ///
        /// </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 present value </returns>
        public virtual MultiCurrencyAmount presentValue(ResolvedCms cms, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
        {
            CurrencyAmount pvCmsLeg = cmsLegPricer.presentValue(cms.CmsLeg, ratesProvider, swaptionVolatilities);

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

            return(MultiCurrencyAmount.of(pvCmsLeg).plus(pvPayLeg));
        }
Beispiel #2
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value curve sensitivity of the CMS product.
        /// <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>
        /// <param name="swaptionVolatilities">  the swaption volatilities </param>
        /// <returns> the present value sensitivity </returns>
        public virtual PointSensitivityBuilder presentValueSensitivityRates(ResolvedCms cms, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
        {
            PointSensitivityBuilder pvSensiCmsLeg = cmsLegPricer.presentValueSensitivityRates(cms.CmsLeg, ratesProvider, swaptionVolatilities);

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

            return(pvSensiCmsLeg.combinedWith(pvSensiPayLeg));
        }
Beispiel #3
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Explains the present value of the CMS product.
        /// <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)
        {
            ExplainMapBuilder builder = ExplainMap.builder();

            builder.put(ExplainKey.ENTRY_TYPE, "CmsSwap");
            IList <ExplainMap> legsExplain = new List <ExplainMap>();

            legsExplain.Add(cmsLegPricer.explainPresentValue(cms.CmsLeg, ratesProvider, swaptionVolatilities));
            if (cms.PayLeg.Present)
            {
                legsExplain.Add(payLegPricer.explainPresentValue(cms.PayLeg.get(), ratesProvider));
            }
            builder.put(ExplainKey.LEGS, legsExplain);
            return(builder.build());
        }
Beispiel #4
0
 /// <summary>
 /// Calculates the present value sensitivity to the strike value.
 /// <para>
 /// The present value sensitivity of the product is the sensitivity of the present value to the strike value.
 /// This is not relevant for CMS coupons and an exception is thrown in the underlying pricer.
 ///
 /// </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 present value sensitivity </returns>
 public virtual double presentValueSensitivityStrike(ResolvedCms cms, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
 {
     return(cmsLegPricer.presentValueSensitivityStrike(cms.CmsLeg, ratesProvider, swaptionVolatilities));
 }
Beispiel #5
0
 /// <summary>
 /// Calculates the present value sensitivity to the SABR model parameters.
 /// <para>
 /// The present value sensitivity of the product is the sensitivity of the present value
 /// to the SABR model parameters, alpha, beta, rho and nu.
 ///
 /// </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 present value sensitivity </returns>
 public virtual PointSensitivityBuilder presentValueSensitivityModelParamsSabr(ResolvedCms cms, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
 {
     return(cmsLegPricer.presentValueSensitivityModelParamsSabr(cms.CmsLeg, ratesProvider, swaptionVolatilities));
 }