CouponONDiscountingMethod { public MultipleCurrencyAmount presentValue(final CouponON coupon, final MulticurveProviderInterface multicurve) { return presentValue(coupon, multicurve, OvernightForwardRateProvider.getInstance()); } private  CouponONDiscountingMethod(); static CouponONDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final CouponON coupon, final MulticurveProviderInterface multicurve); MultipleCurrencyAmount presentValue(
      final CouponON coupon,
      final MulticurveProviderInterface multicurve,
      final ForwardRateProvider<IndexON> forwardRateProvider); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final CouponON coupon, final MulticurveProviderInterface multicurve); double parRate(final CouponON coupon, final MulticurveProviderInterface multicurve); MultipleCurrencyMulticurveSensitivity parRateCurveSensitivity(final CouponON coupon, final MulticurveProviderInterface multicurve);  }
@Test public void presentValue() { final MultipleCurrencyAmount pvComputed = METHOD_CPN_OIS.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 * MULTICURVES.getDiscountFactor(CPN_OIS.getCurrency(), CPN_OIS.getPaymentTime()); assertEquals("CouponOISDiscountingMarketMethod: present value", pvExpected, pvComputed.getAmount(EONIA.getCurrency()), TOLERANCE_PV); }
@Test public void presentValueStarted() { final double fixing = 0.0015; final ZonedDateTimeDoubleTimeSeries TS_ON = ImmutableZonedDateTimeDoubleTimeSeries.ofUTC(new ZonedDateTime[] {DateUtils.getUTCDate(2011, 5, 20), DateUtils.getUTCDate(2011, 5, 23) }, new double[] { 0.0010, fixing }); final ZonedDateTime referenceDate = ScheduleCalculator.getAdjustedDate(EFFECTIVE_DATE, 1, TARGET); final CouponON cpnOISStarted = (CouponON) CPN_OIS_DEFINITION.toDerivative(referenceDate, TS_ON); final double notionalAccrued = NOTIONAL * (1 + fixing * EONIA.getDayCount().getDayCountFraction(EFFECTIVE_DATE, referenceDate)); assertEquals("CouponOISDiscountingMarketMethod: present value", notionalAccrued, cpnOISStarted.getNotionalAccrued(), TOLERANCE_PV); final MultipleCurrencyAmount pvComputed = METHOD_CPN_OIS.presentValue(cpnOISStarted, MULTICURVES); final double forward = MULTICURVES.getSimplyCompoundForwardRate(EONIA, cpnOISStarted.getFixingPeriodStartTime(), cpnOISStarted.getFixingPeriodEndTime(), cpnOISStarted.getFixingPeriodAccrualFactor()); final double pvExpected = (cpnOISStarted.getNotionalAccrued() * (1 + cpnOISStarted.getFixingPeriodAccrualFactor() * forward) - NOTIONAL) * MULTICURVES.getDiscountFactor(cpnOISStarted.getCurrency(), cpnOISStarted.getPaymentTime()); assertEquals("CouponOISDiscountingMarketMethod: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV); }
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD_CPN_OIS.presentValue(CPN_OIS, MULTICURVES); final MultipleCurrencyAmount pvCalculator = CPN_OIS.accept(PVDC, MULTICURVES); assertEquals("CouponFixedDiscountingMarketMethod: present value", pvMethod.getAmount(EUR), pvCalculator.getAmount(EUR), TOLERANCE_PV); }