//------------------------------------------------------------------------- public virtual void test_discountFactor() { IsdaCreditDiscountFactors test = IsdaCreditDiscountFactors.of(USD, VALUATION, CURVE); double relativeYearFraction = ACT_365F.relativeYearFraction(VALUATION, DATE_AFTER); double expected = Math.Exp(-relativeYearFraction * CURVE.yValue(relativeYearFraction)); assertEquals(test.discountFactor(DATE_AFTER), expected); }
public virtual void test_zeroRate() { IsdaCreditDiscountFactors test = IsdaCreditDiscountFactors.of(USD, VALUATION, CURVE); double relativeYearFraction = ACT_365F.relativeYearFraction(VALUATION, DATE_AFTER); double discountFactor = test.discountFactor(DATE_AFTER); double zeroRate = test.zeroRate(DATE_AFTER); assertEquals(Math.Exp(-zeroRate * relativeYearFraction), discountFactor); }