ForexNonDeliverableForwardDiscountingMethod { public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final ForexNonDeliverableForward ndf, final MulticurveProviderInterface multicurves) { ArgumentChecker.notNull(ndf, "Non deliverable forward"); ArgumentChecker.notNull(multicurves, "Multi-curves provider"); final double df2 = multicurves.getDiscountFactor(ndf.getCurrency2(), ndf.getPaymentTime()); final double df1 = multicurves.getDiscountFactor(ndf.getCurrency1(), ndf.getPaymentTime()); final double spot = multicurves.getFxRate(ndf.getCurrency2(), ndf.getCurrency1()); final double pvBar = 1.0; final double df1Bar = -ndf.getNotionalCurrency2() * ndf.getExchangeRate() / spot * pvBar; final double df2Bar = ndf.getNotionalCurrency2() * pvBar; final Map<String, List<DoublesPair>> resultMap = new HashMap<>(); final List<DoublesPair> listDiscounting1 = new ArrayList<>(); listDiscounting1.add(DoublesPair.of(ndf.getPaymentTime(), -ndf.getPaymentTime() * df1 * df1Bar)); resultMap.put(multicurves.getName(ndf.getCurrency1()), listDiscounting1); final List<DoublesPair> listDiscounting2 = new ArrayList<>(); listDiscounting2.add(DoublesPair.of(ndf.getPaymentTime(), -ndf.getPaymentTime() * df2 * df2Bar)); resultMap.put(multicurves.getName(ndf.getCurrency2()), listDiscounting2); final MulticurveSensitivity result = MulticurveSensitivity.ofYieldDiscounting(resultMap); return MultipleCurrencyMulticurveSensitivity.of(ndf.getCurrency2(), result); } private  ForexNonDeliverableForwardDiscountingMethod(); static ForexNonDeliverableForwardDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final ForexNonDeliverableForward ndf, final MulticurveProviderInterface multicurves); MultipleCurrencyAmount currencyExposure(final ForexNonDeliverableForward ndf, final MulticurveProviderInterface multicurves); double forwardForexRate(final ForexNonDeliverableForward ndf, final MulticurveProviderInterface multicurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final ForexNonDeliverableForward ndf, final MulticurveProviderInterface multicurves);  }
@Test public void presentValueCurveSensitivity() { final MultipleCurrencyMulticurveSensitivity pvcsNDF = METHOD_NDF.presentValueCurveSensitivity(NDF, MULTICURVES).cleaned(); final MultipleCurrencyMulticurveSensitivity pvcsFX = METHOD_FX.presentValueCurveSensitivity(FOREX, MULTICURVES).cleaned(); final MultipleCurrencyMulticurveSensitivity pvcsFXConverted = pvcsFX.converted(USD, FX_MATRIX).cleaned(); AssertSensitivityObjects.assertEquals("ForexNonDeliverableForwardDiscountingMethod: presentValueCurveSensitivity", pvcsFXConverted, pvcsNDF, TOLERANCE_PV); }