public virtual void test_of_period()
        {
            FixedInflationSwapTemplate test = FixedInflationSwapTemplate.of(TENOR_10Y, CONV);

            assertEquals(test.Tenor, TENOR_10Y);
            assertEquals(test.Convention, CONV);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FixedInflationSwapTemplate test = FixedInflationSwapTemplate.of(TENOR_10Y, CONV);

            coverImmutableBean(test);
            FixedInflationSwapTemplate test2 = FixedInflationSwapTemplate.of(TENOR_10Y, CONV2);

            coverBeanEquals(test, test2);
        }
Example #3
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FixedInflationSwapTemplate other = (FixedInflationSwapTemplate)obj;
         return(JodaBeanUtils.equal(tenor, other.tenor) && JodaBeanUtils.equal(convention, other.convention));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_createTrade()
        {
            FixedInflationSwapTemplate @base = FixedInflationSwapTemplate.of(TENOR_10Y, CONV);
            LocalDate tradeDate = LocalDate.of(2015, 5, 5);
            LocalDate startDate = date(2015, 5, 6);     // T+1
            LocalDate endDate   = date(2025, 5, 6);
            SwapTrade test      = @base.createTrade(tradeDate, BUY, NOTIONAL_2M, 0.25d, REF_DATA);
            Swap      expected  = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), INFL.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product.Legs.get(0), expected.Legs.get(0));
            assertEquals(test.Product.Legs.get(1), expected.Legs.get(1));
            assertEquals(test.Product, expected);
        }
        public virtual void test_serialization()
        {
            FixedInflationSwapTemplate test = FixedInflationSwapTemplate.of(TENOR_10Y, CONV);

            assertSerialization(test);
        }
Example #6
0
        //-------------------------------------------------------------------------

        /// <summary>
        /// Creates a template based on the specified tenor and convention.
        /// </summary>
        /// <param name="tenor">  the tenor of the swap </param>
        /// <param name="convention">  the market convention </param>
        /// <returns> the template </returns>
        public static FixedInflationSwapTemplate of(Tenor tenor, FixedInflationSwapConvention convention)
        {
            return(FixedInflationSwapTemplate.builder().tenor(tenor).convention(convention).build());
        }