ForexForwardPointsMethod { public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final Forex fx, final MulticurveProviderInterface multicurves, final DoublesCurve forwardRates, final Pair<Currency, Currency> ccyPair) { final double payTime = fx.getPaymentTime(); final double fwdRate = forwardRates.getYValue(payTime); final Currency ccy2; final double amount1; final double amount2; if (checkCurrency(fx, ccyPair)) { ccy2 = fx.getCurrency2(); amount1 = fx.getPaymentCurrency1().getAmount(); amount2 = fx.getPaymentCurrency2().getAmount(); } else { ccy2 = fx.getCurrency1(); amount1 = fx.getPaymentCurrency2().getAmount(); amount2 = fx.getPaymentCurrency1().getAmount(); } final double df2 = multicurves.getDiscountFactor(ccy2, payTime); final double pvBar = 1.0; final double df2Bar = (amount2 + amount1 * fwdRate) * pvBar; final DoublesPair s = DoublesPair.of(payTime, -payTime * df2 * df2Bar); final List<DoublesPair> list = new ArrayList<>(); list.add(s); final Map<String, List<DoublesPair>> result = new HashMap<>(); result.put(multicurves.getName(ccy2), list); return MultipleCurrencyMulticurveSensitivity.of(ccy2, MulticurveSensitivity.ofYieldDiscounting(result)); } private  ForexForwardPointsMethod(); static ForexForwardPointsMethod getInstance(); MultipleCurrencyAmount presentValue(final Forex fx, final MulticurveProviderInterface multicurves, final DoublesCurve forwardRates, final Pair<Currency, Currency> ccyPair); MultipleCurrencyAmount presentValue(final Forex fx, final MulticurveForwardPointsProviderInterface multicurvesForward); MultipleCurrencyAmount currencyExposure(final Forex fx, final MulticurveProviderInterface multicurves, final DoublesCurve forwardRates, final Pair<Currency, Currency> ccyPair); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final Forex fx, final MulticurveProviderInterface multicurves, final DoublesCurve forwardRates,
      final Pair<Currency, Currency> ccyPair); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final Forex fx, final MulticurveForwardPointsProviderInterface multicurvesForward); double[] presentValueForwardPointsSensitivity(final Forex fx, final MulticurveProviderInterface multicurves, final DoublesCurve forwardRates, final Pair<Currency, Currency> ccyPair);  }
@Test public void presentValueCurveSensitivity() { final MultipleCurrencyParameterSensitivity pvpsExact = PS_FFP_C.calculateSensitivity(FX, MULTICURVES_FWD, MULTICURVES.getAllNames()); final MultipleCurrencyParameterSensitivity pvpsFD = PS_FFP_FDC.calculateSensitivity(FX, MULTICURVES_FWD); AssertSensitivityObjects.assertEquals("ForexForwardPointsMethod: presentValueCurveSensitivity ", pvpsExact, pvpsFD, TOLERANCE_PV_DELTA); }
@Test public void presentValueCurveSensitivityMethodVsCalculator() { final MultipleCurrencyMulticurveSensitivity pvcsMethod1 = METHOD_FX_PTS.presentValueCurveSensitivity(FX, MULTICURVES, FWD_RATES, PAIR); final MultipleCurrencyMulticurveSensitivity pvcsMethod2 = METHOD_FX_PTS.presentValueCurveSensitivity(FX, MULTICURVES_FWD); AssertSensitivityObjects.assertEquals("ForexForwardPointsMethod: presentValueCurveSensitivity", pvcsMethod1, pvcsMethod2, TOLERANCE_PV_DELTA); }
@Test public void presentValueCurveSensitivityIndirectOrderMethodVsCalculator() { final MultipleCurrencyMulticurveSensitivity pvcsMethod1 = METHOD_FX_PTS.presentValueCurveSensitivity(FX_INDIRECT, MULTICURVES, FWD_RATES, PAIR); final MultipleCurrencyMulticurveSensitivity pvcsMethod2 = METHOD_FX_PTS.presentValueCurveSensitivity(FX_INDIRECT, MULTICURVES_FWD); AssertSensitivityObjects.assertEquals("ForexForwardPointsMethod: presentValueCurveSensitivity", pvcsMethod1, pvcsMethod2, TOLERANCE_PV_DELTA); }