CouponONSpreadDiscountingMethod { public MultipleCurrencyAmount presentValue(final CouponONSpread coupon, final MulticurveProviderInterface multicurve) { ArgumentChecker.notNull(coupon, "Coupon"); ArgumentChecker.notNull(multicurve, "Market"); final double ratio = 1.0 + coupon.getFixingPeriodAccrualFactor() * multicurve.getSimplyCompoundForwardRate(coupon.getIndex(), coupon.getFixingPeriodStartTime(), coupon.getFixingPeriodEndTime(), coupon.getFixingPeriodAccrualFactor()); final double df = multicurve.getDiscountFactor(coupon.getCurrency(), coupon.getPaymentTime()); final double pv = (coupon.getNotionalAccrued() * ratio + coupon.getSpreadAmount() - coupon.getNotional()) * df; return MultipleCurrencyAmount.of(coupon.getCurrency(), pv); } private  CouponONSpreadDiscountingMethod(); static CouponONSpreadDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final CouponONSpread coupon, final MulticurveProviderInterface multicurve); MultipleCurrencyAmount presentValue(
      final CouponONSpread coupon,
      final MulticurveProviderInterface multicurve,
      final ForwardRateProvider<IndexON> forwardRateProvider); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final CouponONSpread coupon, final MulticurveProviderInterface multicurve); double parRate(final CouponONSpread coupon, final MulticurveProviderInterface multicurve); MultipleCurrencyMulticurveSensitivity parRateCurveSensitivity(final CouponONSpread coupon, final MulticurveProviderInterface multicurve);  }
@Test public void presentValue() { final MultipleCurrencyAmount pvComputed = METHOD_CPN_ON.presentValue(CPN_OIS, MULTICURVES); final double forward = MULTICURVES.getSimplyCompoundForwardRate(EONIA, CPN_OIS.getFixingPeriodStartTime(), CPN_OIS.getFixingPeriodEndTime(), CPN_OIS.getFixingPeriodAccrualFactor()); final double pvExpected = (NOTIONAL * CPN_OIS.getFixingPeriodAccrualFactor() * forward + SPREAD_AMOUNT) * MULTICURVES.getDiscountFactor(CPN_OIS.getCurrency(), CPN_OIS.getPaymentTime()); assertEquals("CouponOISDiscountingMarketMethod: present value", pvExpected, pvComputed.getAmount(EONIA.getCurrency()), TOLERANCE_PV); }
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD_CPN_ON.presentValue(CPN_OIS, MULTICURVES); final MultipleCurrencyAmount pvCalculator = CPN_OIS.accept(PVDC, MULTICURVES); assertEquals("CouponFixedDiscountingMarketMethod: present value", pvMethod.getAmount(EUR), pvCalculator.getAmount(EUR), TOLERANCE_PV); }