Beispiel #1
0
        public virtual void test_builder()
        {
            ImmutableIborFutureConvention test = ImmutableIborFutureConvention.builder().name("USD-IMM").index(USD_LIBOR_3M).dateSequence(QUARTERLY_IMM).build();

            assertEquals(test.Name, "USD-IMM");
            assertEquals(test.Index, USD_LIBOR_3M);
            assertEquals(test.DateSequence, QUARTERLY_IMM);
            assertEquals(test.BusinessDayAdjustment, BDA);
        }
Beispiel #2
0
        //-------------------------------------------------------------------------
        public virtual void test_of()
        {
            ImmutableIborFutureConvention test = ImmutableIborFutureConvention.of(USD_LIBOR_3M, QUARTERLY_IMM);

            assertEquals(test.Name, "USD-LIBOR-3M-Quarterly-IMM");
            assertEquals(test.Index, USD_LIBOR_3M);
            assertEquals(test.DateSequence, QUARTERLY_IMM);
            assertEquals(test.BusinessDayAdjustment, BDA);
        }
Beispiel #3
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ImmutableIborFutureConvention test = ImmutableIborFutureConvention.of(USD_LIBOR_3M, QUARTERLY_IMM);

            coverImmutableBean(test);
            ImmutableIborFutureConvention test2 = ImmutableIborFutureConvention.builder().index(USD_LIBOR_3M).dateSequence(MONTHLY_IMM).businessDayAdjustment(BDA).build();

            coverBeanEquals(test, test2);

            coverPrivateConstructor(typeof(IborFutureConventions));
            coverPrivateConstructor(typeof(StandardIborFutureConventions));
        }
Beispiel #4
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ImmutableIborFutureConvention other = (ImmutableIborFutureConvention)obj;
         return(JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(name, other.name) && JodaBeanUtils.equal(dateSequence, other.dateSequence) && JodaBeanUtils.equal(businessDayAdjustment, other.businessDayAdjustment));
     }
     return(false);
 }
Beispiel #5
0
        public virtual void test_toTrade()
        {
            LocalDate            date       = LocalDate.of(2015, 10, 20);
            Period               start      = Period.ofMonths(2);
            int                  number     = 2; // Future should be 20 Dec 15 + 2 IMM = effective 15-Jun-2016, fixing 13-Jun-2016
            IborFutureConvention convention = ImmutableIborFutureConvention.of(USD_LIBOR_3M, QUARTERLY_IMM);
            double               quantity   = 3;
            double               price      = 0.99;
            SecurityId           secId      = SecurityId.of("OG-Future", "GBP-LIBOR-3M-Jun16");
            IborFutureTrade      trade      = convention.createTrade(date, secId, start, number, quantity, NOTIONAL_1M, price, REF_DATA);

            assertEquals(trade.Product.FixingDate, LocalDate.of(2016, 6, 13));
            assertEquals(trade.Product.Index, USD_LIBOR_3M);
            assertEquals(trade.Product.Notional, NOTIONAL_1M);
            assertEquals(trade.Product.AccrualFactor, 0.25);
            assertEquals(trade.Quantity, quantity);
            assertEquals(trade.Price, price);
        }
Beispiel #6
0
 public virtual void test_builder_incomplete()
 {
     assertThrowsIllegalArg(() => ImmutableIborFutureConvention.builder().index(USD_LIBOR_3M).build());
     assertThrowsIllegalArg(() => ImmutableIborFutureConvention.builder().dateSequence(QUARTERLY_IMM).build());
 }
Beispiel #7
0
        public virtual void test_serialization()
        {
            IborFutureConvention test = ImmutableIborFutureConvention.of(USD_LIBOR_3M, QUARTERLY_IMM);

            assertSerialization(test);
        }
Beispiel #8
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates a convention based on the specified index and the sequence of dates.
 /// <para>
 /// The standard market convention is based on the index.
 /// The business day adjustment is set to be 'Following' using the effective date calendar from the index.
 /// The convention name will default to the name of the index suffixed by the
 /// name of the date sequence.
 ///
 /// </para>
 /// </summary>
 /// <param name="index">  the index, the calendar for the adjustment is extracted from the index </param>
 /// <param name="dateSequence">  the sequence of dates </param>
 /// <returns> the convention </returns>
 public static ImmutableIborFutureConvention of(IborIndex index, DateSequence dateSequence)
 {
     return(ImmutableIborFutureConvention.builder().index(index).dateSequence(dateSequence).build());
 }