public virtual void test_parameterSensitivity()
        {
            ZeroRateSensitivity            zeroPt   = ZeroRateSensitivity.of(USD, 10d, 5d);
            CreditCurveZeroRateSensitivity creditPt = CreditCurveZeroRateSensitivity.of(LEGAL_ENTITY_ABC, JPY, 2d, 3d);
            FxForwardSensitivity           fxPt     = FxForwardSensitivity.of(CurrencyPair.of(JPY, USD), USD, LocalDate.of(2017, 2, 14), 15d);
            CreditRatesProvider            test     = ImmutableCreditRatesProvider.builder().creditCurves(ImmutableMap.of(Pair.of(LEGAL_ENTITY_ABC, USD), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_USD), Pair.of(LEGAL_ENTITY_ABC, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY), Pair.of(LEGAL_ENTITY_DEF, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_DEF, CRD_DEF))).discountCurves(ImmutableMap.of(USD, DSC_USD, JPY, DSC_JPY)).recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY_ABC, RR_ABC, LEGAL_ENTITY_DEF, RR_DEF)).valuationDate(VALUATION).build();
            CurrencyParameterSensitivities computed = test.parameterSensitivity(zeroPt.combinedWith(creditPt).combinedWith(fxPt).build());
            CurrencyParameterSensitivities expected = DSC_USD.parameterSensitivity(zeroPt).combinedWith(LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY).parameterSensitivity(creditPt));

            assertTrue(computed.equalWithTolerance(expected, 1.0e-14));
        }
예제 #2
0
        //-------------------------------------------------------------------------
        // proper end-to-end FD tests are in pricer test
        public virtual void test_parameterSensitivity()
        {
            IsdaCreditDiscountFactors test  = IsdaCreditDiscountFactors.of(USD, VALUATION, CURVE);
            ZeroRateSensitivity       point = ZeroRateSensitivity.of(USD, 1d, 1d);

            assertEquals(test.parameterSensitivity(point).size(), 1);
        }
예제 #3
0
        //-------------------------------------------------------------------------
        public virtual void test_unitParameterSensitivity()
        {
            IsdaCreditDiscountFactors test = IsdaCreditDiscountFactors.of(USD, VALUATION, CURVE);
            ZeroRateSensitivity       sens = test.zeroRatePointSensitivity(DATE_AFTER);

            double relativeYearFraction             = ACT_365F.relativeYearFraction(VALUATION, DATE_AFTER);
            CurrencyParameterSensitivities expected = CurrencyParameterSensitivities.of(CURVE.yValueParameterSensitivity(relativeYearFraction).multipliedBy(sens.Currency, sens.Sensitivity));

            assertEquals(test.parameterSensitivity(sens), expected);
        }