//------------------------------------------------------------------------- /// <summary> /// Test cash flow for ISDA FRA Discounting method. /// </summary> public virtual void test_cashFlows_ISDA() { ResolvedFra fraExp = RFRA; SimpleRatesProvider prov = createProvider(fraExp); double fixedRate = FRA.FixedRate; double yearFraction = fraExp.YearFraction; double notional = fraExp.Notional; double expected = notional * yearFraction * (FORWARD_RATE - fixedRate) / (1.0 + yearFraction * FORWARD_RATE); DiscountingFraProductPricer test = DiscountingFraProductPricer.DEFAULT; CashFlows computed = test.cashFlows(fraExp, prov); assertEquals(computed.getCashFlows().size(), 1); assertEquals(computed.getCashFlows().size(), 1); assertEquals(computed.getCashFlows().get(0).PaymentDate, fraExp.PaymentDate); assertEquals(computed.getCashFlows().get(0).ForecastValue.Currency, fraExp.Currency); assertEquals(computed.getCashFlows().get(0).ForecastValue.Amount, expected, TOLERANCE); // test via FraTrade DiscountingFraTradePricer testTrade = new DiscountingFraTradePricer(test); assertEquals(testTrade.cashFlows(RFRA_TRADE, prov), test.cashFlows(fraExp, prov)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the future cash flow of the FRA trade. /// <para> /// There is only one cash flow on the payment date for the FRA trade. /// The expected currency amount of the cash flow is the same as <seealso cref="#forecastValue(ResolvedFraTrade, RatesProvider)"/>. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the cash flows </returns> public virtual CashFlows cashFlows(ResolvedFraTrade trade, RatesProvider provider) { return(productPricer.cashFlows(trade.Product, provider)); }