コード例 #1
0
        //-------------------------------------------------------------------------
        public virtual void test_createTrade()
        {
            FraTemplate @base     = FraTemplate.of(Period.ofMonths(3), Period.ofMonths(6), FRA_GBP_LIBOR_3M);
            LocalDate   tradeDate = LocalDate.of(2015, 5, 4);   // trade date is a holiday!
            FraTrade    test      = @base.createTrade(tradeDate, 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);
        }
コード例 #2
0
        public virtual void test_createTrade_paymentOffset()
        {
            FraConvention convention = ((ImmutableFraConvention)FRA_GBP_LIBOR_3M).toBuilder().paymentDateOffset(PLUS_TWO_DAYS).build();
            FraTemplate   @base      = FraTemplate.of(Period.ofMonths(3), Period.ofMonths(6), convention);
            LocalDate     tradeDate  = LocalDate.of(2015, 5, 4); // trade date is a holiday!
            FraTrade      test       = @base.createTrade(tradeDate, 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)).paymentDate(AdjustableDate.of(date(2015, 8, 7), PLUS_TWO_DAYS.Adjustment)).fixedRate(0.25d).index(GBP_LIBOR_3M).build();

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }