Exemple #1
0
        public virtual void test_parameterSensitivity()
        {
            RepoCurveDiscountFactors       @base    = RepoCurveDiscountFactors.of(DSC_FACTORS, GROUP);
            RepoCurveZeroRateSensitivity   sensi    = @base.zeroRatePointSensitivity(DATE_AFTER, USD);
            CurrencyParameterSensitivities computed = @base.parameterSensitivity(sensi);
            CurrencyParameterSensitivities expected = DSC_FACTORS.parameterSensitivity(DSC_FACTORS.zeroRatePointSensitivity(DATE_AFTER, USD));

            assertEquals(computed, expected);
        }
        //-------------------------------------------------------------------------
        public CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
        {
            CurrencyParameterSensitivities sens = CurrencyParameterSensitivities.empty();

            foreach (PointSensitivity point in pointSensitivities.Sensitivities)
            {
                if (point is RepoCurveZeroRateSensitivity)
                {
                    RepoCurveZeroRateSensitivity pt      = (RepoCurveZeroRateSensitivity)point;
                    RepoCurveDiscountFactors     factors = repoCurveDiscountFactors(pt.RepoGroup, pt.CurveCurrency);
                    sens = sens.combinedWith(factors.parameterSensitivity(pt));
                }
                else if (point is IssuerCurveZeroRateSensitivity)
                {
                    IssuerCurveZeroRateSensitivity pt      = (IssuerCurveZeroRateSensitivity)point;
                    IssuerCurveDiscountFactors     factors = issuerCurveDiscountFactors(pt.LegalEntityGroup, pt.CurveCurrency);
                    sens = sens.combinedWith(factors.parameterSensitivity(pt));
                }
            }
            return(sens);
        }