CouponFixedFxResetDiscountingMethod { public MultipleCurrencyAmount presentValue(final CouponFixedFxReset coupon, final MulticurveProviderInterface multicurve) { Validate.notNull(coupon, "Coupon"); Validate.notNull(multicurve, "multicurve"); Currency ccyPayment = coupon.getCurrency(); Currency ccyReference = coupon.getReferenceCurrency(); double tp = coupon.getPaymentTime(); double t0 = coupon.getFxDeliveryTime(); double todayFxRate = multicurve.getFxRate(ccyReference, ccyPayment); double amount = coupon.paymentAmount(todayFxRate); double dfCcyPaymentAtPayment = multicurve.getDiscountFactor(ccyPayment, tp); double dfCcyReferenceAtDelivery = multicurve.getDiscountFactor(ccyReference, t0); double dfCcyPaymentAtDelivery = multicurve.getDiscountFactor(ccyPayment, t0); double pv = amount * dfCcyPaymentAtPayment * dfCcyReferenceAtDelivery / dfCcyPaymentAtDelivery; return MultipleCurrencyAmount.of(ccyPayment, pv); } private  CouponFixedFxResetDiscountingMethod(); static CouponFixedFxResetDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final CouponFixedFxReset coupon, 
      final MulticurveProviderInterface multicurve); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final CouponFixedFxReset coupon, 
      final MulticurveProviderInterface multicurve); MultipleCurrencyAmount currencyExposure(final CouponFixedFxReset coupon, 
      final MulticurveProviderInterface multicurves);  }
@Test public void presentValue() { double fxToday = MULTICURVE.getFxRate(CUR_REF, CUR_PAY); double amount = CPN.paymentAmount(fxToday); double dfXTp = MULTICURVE.getDiscountFactor(CUR_PAY, CPN.getPaymentTime()); double dfYT0 = MULTICURVE.getDiscountFactor(CUR_REF, CPN.getFxDeliveryTime()); double dfXT0 = MULTICURVE.getDiscountFactor(CUR_PAY, CPN.getFxDeliveryTime()); double pvExpected = amount * dfXTp * dfYT0 / dfXT0; MultipleCurrencyAmount pvComputed = METHOD_CPN_FIXED_FX.presentValue(CPN, MULTICURVE); assertTrue("CouponFixedFxResetDiscountingMethod: present value", pvComputed.size() == 1); assertEquals("CouponFixedFxResetDiscountingMethod: present value", pvExpected, pvComputed.getAmount(CUR_PAY), TOLERANCE_PV); }
@Test public void presentValueCalculatorVsMethod() { MultipleCurrencyAmount pvMethod = METHOD_CPN_FIXED_FX.presentValue(CPN, MULTICURVE); MultipleCurrencyAmount pvCalculator = CPN.accept(PVDC, MULTICURVE); assertEquals("CouponFixedFxResetDiscountingMethod: present value", pvMethod.getAmount(CUR_PAY), pvCalculator.getAmount(CUR_PAY), TOLERANCE_PV); }