DepositIborDiscountingMethod { public MultipleCurrencyAmount presentValue(final DepositIbor deposit, final MulticurveProviderInterface multicurves) { ArgumentChecker.notNull(deposit, "Deposit"); ArgumentChecker.notNull(multicurves, "Multicurves"); final double dfEnd = multicurves.getDiscountFactor(deposit.getCurrency(), deposit.getEndTime()); final double pv = deposit.getAccrualFactor() * (deposit.getRate() - multicurves.getSimplyCompoundForwardRate(deposit.getIndex(), deposit.getStartTime(), deposit.getEndTime(), deposit.getAccrualFactor())) * dfEnd; return MultipleCurrencyAmount.of(deposit.getCurrency(), pv); } private  DepositIborDiscountingMethod(); static DepositIborDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final DepositIbor deposit, final MulticurveProviderInterface multicurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final DepositIbor deposit, final MulticurveProviderInterface multicurves); double parRate(final DepositIbor deposit, final MulticurveProviderInterface multicurve); double parSpread(final DepositIbor deposit, final MulticurveProviderInterface multicurve); MulticurveSensitivity parSpreadCurveSensitivity(final DepositIbor deposit, final MulticurveProviderInterface multicurve);  }
@Test public void presentValueTrade() { final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12); final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate); final MultipleCurrencyAmount pvComputed = METHOD_DEPOSIT.presentValue(deposit, PROVIDER_MULTICURVES); final double dfEnd = PROVIDER_MULTICURVES.getDiscountFactor(deposit.getCurrency(), deposit.getEndTime()); final double forward = PROVIDER_MULTICURVES.getSimplyCompoundForwardRate(deposit.getIndex(), deposit.getStartTime(), deposit.getEndTime(), deposit.getAccrualFactor()); final double pvExpected = deposit.getAccrualFactor() * (deposit.getRate() - forward) * dfEnd; assertEquals("DepositCounterpartDiscountingMethod: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV); }
@Test public void presentValueMethodVsCalculator() { final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12); final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate); final MultipleCurrencyAmount pvMethod = METHOD_DEPOSIT.presentValue(deposit, PROVIDER_MULTICURVES); final MultipleCurrencyAmount pvCalculator = deposit.accept(PVC, PROVIDER_MULTICURVES); assertEquals("DepositCounterpartDiscountingMethod: present value", pvMethod, pvCalculator); }