public virtual void test_toTemplate_badDateOrder() { FraConvention @base = FraConvention.of(GBP_LIBOR_3M); LocalDate tradeDate = LocalDate.of(2015, 5, 5); LocalDate startDate = date(2015, 4, 5); LocalDate endDate = date(2015, 7, 5); LocalDate paymentDate = date(2015, 8, 7); assertThrowsIllegalArg(() => @base.toTrade(tradeDate, startDate, endDate, paymentDate, BUY, NOTIONAL_2M, 0.25d)); }
public virtual void test_toTrade_dates_paymentOffset() { FraConvention @base = ImmutableFraConvention.builder().index(GBP_LIBOR_3M).spotDateOffset(NEXT_SAME_BUS_DAY).paymentDateOffset(PLUS_TWO_DAYS).build(); LocalDate tradeDate = LocalDate.of(2015, 5, 5); LocalDate startDate = date(2015, 8, 5); LocalDate endDate = date(2015, 11, 5); LocalDate paymentDate = date(2015, 8, 7); FraTrade test = @base.toTrade(tradeDate, startDate, endDate, paymentDate, BUY, NOTIONAL_2M, 0.25d); Fra expected = Fra.builder().buySell(BUY).notional(NOTIONAL_2M).startDate(date(2015, 8, 5)).endDate(date(2015, 11, 5)).paymentDate(AdjustableDate.of(paymentDate, PLUS_TWO_DAYS.Adjustment)).fixedRate(0.25d).index(GBP_LIBOR_3M).build(); assertEquals(test.Info.TradeDate, tradeDate); assertEquals(test.Product, expected); }