public virtual void test_createTrade_periods_adjust_payOffset() { FraConvention @base = ImmutableFraConvention.builder().index(GBP_LIBOR_3M).spotDateOffset(NEXT_SAME_BUS_DAY).paymentDateOffset(PLUS_TWO_DAYS).build(); LocalDate tradeDate = LocalDate.of(2016, 8, 11); FraTrade test = @base.createTrade(tradeDate, Period.ofMonths(1), Period.ofMonths(4), BUY, NOTIONAL_2M, 0.25d, REF_DATA); Fra expected = Fra.builder().buySell(BUY).notional(NOTIONAL_2M).startDate(date(2016, 9, 12)).endDate(date(2016, 12, 12)).paymentDate(AdjustableDate.of(date(2016, 9, 14), PLUS_TWO_DAYS.Adjustment)).fixedRate(0.25d).index(GBP_LIBOR_3M).build(); assertEquals(test.Info.TradeDate, tradeDate); assertEquals(test.Product, expected); }
//------------------------------------------------------------------------- public virtual void test_createTrade_periods() { FraConvention @base = ImmutableFraConvention.builder().index(GBP_LIBOR_3M).spotDateOffset(NEXT_SAME_BUS_DAY).build(); LocalDate tradeDate = LocalDate.of(2015, 5, 5); FraTrade test = @base.createTrade(tradeDate, Period.ofMonths(3), Period.ofMonths(6), BUY, NOTIONAL_2M, 0.25d, REF_DATA); Fra expected = Fra.builder().buySell(BUY).notional(NOTIONAL_2M).startDate(date(2015, 8, 5)).endDate(date(2015, 11, 5)).fixedRate(0.25d).index(GBP_LIBOR_3M).build(); assertEquals(test.Info.TradeDate, tradeDate); assertEquals(test.Product, expected); }
//------------------------------------------------------------------------- public virtual void coverage() { ImmutableFraConvention test = ImmutableFraConvention.builder().index(GBP_LIBOR_3M).build(); coverImmutableBean(test); ImmutableFraConvention test2 = ImmutableFraConvention.builder().index(GBP_LIBOR_3M).name("Test").currency(USD).spotDateOffset(PLUS_ONE_DAY).businessDayAdjustment(BDA_FOLLOW).paymentDateOffset(PLUS_TWO_DAYS).fixingDateOffset(MINUS_FIVE_DAYS).dayCount(ACT_360).discounting(FraDiscountingMethod.NONE).build(); coverBeanEquals(test, test2); coverPrivateConstructor(typeof(FraConventions)); coverPrivateConstructor(typeof(FraConventionLookup)); }
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); }
public virtual void test_builder_allSpecified() { ImmutableFraConvention test = ImmutableFraConvention.builder().name(GBP_LIBOR_3M.Name).index(GBP_LIBOR_3M).currency(GBP).spotDateOffset(PLUS_ONE_DAY).businessDayAdjustment(BDA_FOLLOW).paymentDateOffset(PLUS_TWO_DAYS).fixingDateOffset(MINUS_FIVE_DAYS).dayCount(ACT_360).discounting(FraDiscountingMethod.NONE).build(); assertEquals(test.Name, GBP_LIBOR_3M.Name); assertEquals(test.Index, GBP_LIBOR_3M); assertEquals(test.Currency, GBP); assertEquals(test.SpotDateOffset, PLUS_ONE_DAY); assertEquals(test.BusinessDayAdjustment, BDA_FOLLOW); assertEquals(test.PaymentDateOffset, PLUS_TWO_DAYS); assertEquals(test.FixingDateOffset, MINUS_FIVE_DAYS); assertEquals(test.DayCount, ACT_360); assertEquals(test.Discounting, FraDiscountingMethod.NONE); }
//------------------------------------------------------------------------- public virtual void test_builder_minSpecified() { ImmutableFraConvention test = ImmutableFraConvention.builder().index(GBP_LIBOR_3M).build(); assertEquals(test.Name, GBP_LIBOR_3M.Name); assertEquals(test.Index, GBP_LIBOR_3M); assertEquals(test.Currency, GBP); assertEquals(test.SpotDateOffset, GBP_LIBOR_3M.EffectiveDateOffset); assertEquals(test.BusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.PaymentDateOffset, DaysAdjustment.NONE); assertEquals(test.FixingDateOffset, GBP_LIBOR_3M.FixingDateOffset); assertEquals(test.DayCount, GBP_LIBOR_3M.DayCount); assertEquals(test.Discounting, ISDA); }
public virtual void test_serialization() { ImmutableFraConvention test = ImmutableFraConvention.builder().index(GBP_LIBOR_3M).build(); assertSerialization(test); }
//------------------------------------------------------------------------- public virtual void test_builder_noIndex() { assertThrowsIllegalArg(() => ImmutableFraConvention.builder().spotDateOffset(NEXT_SAME_BUS_DAY).build()); }