ForwardRateAgreementDiscountingMethod { public MultipleCurrencyAmount presentValue(final ForwardRateAgreement fra, final MulticurveProviderInterface multicurve) { ArgumentChecker.notNull(fra, "FRA"); ArgumentChecker.notNull(multicurve, "Multiurves"); final double discountFactorSettlement = multicurve.getDiscountFactor(fra.getCurrency(), fra.getPaymentTime()); final double forward = multicurve.getSimplyCompoundForwardRate(fra.getIndex(), fra.getFixingPeriodStartTime(), fra.getFixingPeriodEndTime(), fra.getFixingYearFraction()); final double presentValue = discountFactorSettlement * fra.getPaymentYearFraction() * fra.getNotional() * (forward - fra.getRate()) / (1 + fra.getPaymentYearFraction() * forward); return MultipleCurrencyAmount.of(fra.getCurrency(), presentValue); } private  ForwardRateAgreementDiscountingMethod(); static ForwardRateAgreementDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final ForwardRateAgreement fra, final MulticurveProviderInterface multicurve); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final ForwardRateAgreement fra, final MulticurveProviderInterface multicurve); double parRate(final ForwardRateAgreement fra, final MulticurveProviderInterface multicurve); double parSpread(final ForwardRateAgreement fra, final MulticurveProviderInterface multicurve); MulticurveSensitivity parSpreadCurveSensitivity(final ForwardRateAgreement fra, final MulticurveProviderInterface multicurve);  }
@Test public void presentValue() { final double forward = FRA_METHOD.parRate(FRA, MULTICURVE); final double dfSettle = MULTICURVE.getDiscountFactor(CUR, FRA.getPaymentTime()); final double expectedPv = FRA.getNotional() * dfSettle * FRA.getPaymentYearFraction() * (forward - FRA_RATE) / (1 + FRA.getPaymentYearFraction() * forward); final MultipleCurrencyAmount pv = FRA_METHOD.presentValue(FRA, MULTICURVE); assertEquals("FRA discounting: present value", expectedPv, pv.getAmount(CUR), TOLERANCE_PV); }
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = FRA_METHOD.presentValue(FRA, MULTICURVE); final MultipleCurrencyAmount pvCalculator = FRA.accept(PVDC, MULTICURVE); assertEquals("FRA discounting: present value calculator vs method", pvCalculator.getAmount(CUR), pvMethod.getAmount(CUR), 1.0E-2); }
@Test public void presentValueBuySellParity() { final ForwardRateAgreementDefinition fraDefinitionSell = new ForwardRateAgreementDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR_PAYMENT, -NOTIONAL, FIXING_DATE, USDLIBOR3M, FRA_RATE, CALENDAR); final ForwardRateAgreement fraSell = (ForwardRateAgreement) fraDefinitionSell.toDerivative(REFERENCE_DATE); final MultipleCurrencyAmount pvBuy = FRA_METHOD.presentValue(FRA, MULTICURVE); final MultipleCurrencyAmount pvSell = FRA_METHOD.presentValue(fraSell, MULTICURVE); assertEquals("FRA discounting: present value - buy/sell parity", pvSell.getAmount(CUR), -pvBuy.getAmount(CUR), 1.0E-2); }