public virtual void test_zeroRatePointSensitivity_sensitivityCurrency() { IsdaCreditDiscountFactors test = IsdaCreditDiscountFactors.of(USD, VALUATION, CURVE); double relativeYearFraction = ACT_365F.relativeYearFraction(VALUATION, DATE_AFTER); double df = Math.Exp(-relativeYearFraction * CURVE.yValue(relativeYearFraction)); ZeroRateSensitivity expected = ZeroRateSensitivity.of(USD, relativeYearFraction, GBP, -df * relativeYearFraction); assertEquals(test.zeroRatePointSensitivity(DATE_AFTER, GBP), expected); }
//------------------------------------------------------------------------- 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); }