Esempio n. 1
0
        //-------------------------------------------------------------------------
        public virtual void test_presentValueSensitivitySabrParameter()
        {
            PointSensitivityBuilder computed = LEG_PRICER.presentValueSensitivityModelParamsSabr(FLOOR_LEG, RATES_PROVIDER, VOLATILITIES);
            PointSensitivityBuilder expected = PointSensitivityBuilder.none();
            IList <CmsPeriod>       cms      = FLOOR_LEG.CmsPeriods;
            int size = cms.Count;

            for (int i = 0; i < size; ++i)
            {
                expected = expected.combinedWith(PERIOD_PRICER.presentValueSensitivityModelParamsSabr(cms[i], RATES_PROVIDER, VOLATILITIES));
            }
            assertEquals(computed, expected);
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates the present value sensitivity to the SABR model parameters.
 /// <para>
 /// The present value sensitivity of the leg is the sensitivity of the present value to
 /// the SABR model parameters, alpha, beta, rho and nu.
 ///
 /// </para>
 /// </summary>
 /// <param name="cmsLeg">  the CMS leg </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(ResolvedCmsLeg cmsLeg, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities)
 {
     validate(ratesProvider, swaptionVolatilities);
     return(cmsLeg.CmsPeriods.Select(cmsPeriod => cmsPeriodPricer.presentValueSensitivityModelParamsSabr(cmsPeriod, ratesProvider, swaptionVolatilities)).Aggregate(PointSensitivityBuilder.none(), PointSensitivityBuilder.combinedWith).normalize());
 }