@Override public Map<String, List<DoublesPair>> visitForexForward( final ForexForward fx, final YieldCurveBundle curves) { final Map<String, List<DoublesPair>> senseP1 = visit(fx.getPaymentCurrency1(), curves); final Map<String, List<DoublesPair>> senseP2 = visit(fx.getPaymentCurrency2(), curves); // Note the sensitivities add rather than subtract here because the FX Forward is set up as a // notional in one currency PLUS a notional in another with the opposite sign return InterestRateCurveSensitivityUtils.addSensitivity( senseP1, multiplySensitivity(senseP2, fx.getSpotForexRate())); }
// TODO: review @Override public Double visitForexForward(final ForexForward fx, final YieldCurveBundle curves) { // TODO this is not a par rate, it is a forward FX rate final YieldAndDiscountCurve curve1 = curves.getCurve(fx.getPaymentCurrency1().getFundingCurveName()); final YieldAndDiscountCurve curve2 = curves.getCurve(fx.getPaymentCurrency2().getFundingCurveName()); final double t = fx.getPaymentTime(); return fx.getSpotForexRate() * curve2.getDiscountFactor(t) / curve1.getDiscountFactor(t); }