ForexNonDeliverableForwardDiscountingMethod { public MultipleCurrencyAmount currencyExposure(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 pv1 = -ndf.getNotionalCurrency2() * ndf.getExchangeRate() * df1; final double pv2 = ndf.getNotionalCurrency2() * df2; return MultipleCurrencyAmount.of(new Currency[] {ndf.getCurrency1(), ndf.getCurrency2()}, new double[] {pv1, pv2}); } 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 currencyExposure() { final MultipleCurrencyAmount ce = METHOD_NDF.currencyExposure(NDF, MULTICURVES); final double df1 = MULTICURVES.getDiscountFactor(KRW, NDF.getPaymentTime()); final double df2 = MULTICURVES.getDiscountFactor(USD, NDF.getPaymentTime()); final double ce1 = -NOMINAL_USD * df1 * FX_RATE; final double ce2 = NOMINAL_USD * df2; assertEquals("Currency exposure - non-deliverable forward", ce1, ce.getAmount(KRW), TOLERANCE_PV); assertEquals("Currency exposure - non-deliverable forward", ce2, ce.getAmount(USD), TOLERANCE_PV); }
@Test public void currencyExposureVsForex() { final MultipleCurrencyAmount ceNDF = METHOD_NDF.currencyExposure(NDF, MULTICURVES); final MultipleCurrencyAmount ceFX = METHOD_FX.currencyExposure(FOREX, MULTICURVES); assertEquals("Currency exposure - non-deliverable forward", ceFX, ceNDF); }
@Test public void currencyExposureMethodVsCalculator() { final MultipleCurrencyAmount ceMethod = METHOD_NDF.currencyExposure(NDF, MULTICURVES); final MultipleCurrencyAmount ceCalculator = NDF.accept(CEC, MULTICURVES); assertEquals("Currency exposure - non-deliverable forward", ceMethod, ceCalculator); }