Exemplo n.º 1
0
        public virtual void test_of_period()
        {
            OvernightIborSwapTemplate test = OvernightIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV);

            assertEquals(test.PeriodToStart, Period.ofMonths(3));
            assertEquals(test.Tenor, TENOR_10Y);
            assertEquals(test.Convention, CONV);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            OvernightIborSwapTemplate test = OvernightIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV);

            coverImmutableBean(test);
            OvernightIborSwapTemplate test2 = OvernightIborSwapTemplate.of(Period.ofMonths(2), TENOR_2Y, CONV2);

            coverBeanEquals(test, test2);
        }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------
        public virtual void test_createTrade()
        {
            OvernightIborSwapTemplate @base = OvernightIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV);
            LocalDate tradeDate             = LocalDate.of(2015, 5, 5);
            LocalDate startDate             = date(2015, 8, 7);
            LocalDate endDate  = date(2025, 8, 7);
            SwapTrade test     = @base.createTrade(tradeDate, BUY, NOTIONAL_2M, 0.25d, REF_DATA);
            Swap      expected = Swap.of(ON_LEG.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), IBOR.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
Exemplo n.º 4
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         OvernightIborSwapTemplate other = (OvernightIborSwapTemplate)obj;
         return(JodaBeanUtils.equal(periodToStart, other.periodToStart) && JodaBeanUtils.equal(tenor, other.tenor) && JodaBeanUtils.equal(convention, other.convention));
     }
     return(false);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Obtains a template based on the specified period, tenor and convention.
 /// <para>
 /// The period from the spot date to the start date is specified.
 ///
 /// </para>
 /// </summary>
 /// <param name="periodToStart">  the period between the spot date and the start date </param>
 /// <param name="tenor">  the tenor of the swap </param>
 /// <param name="convention">  the market convention </param>
 /// <returns> the template </returns>
 public static OvernightIborSwapTemplate of(Period periodToStart, Tenor tenor, OvernightIborSwapConvention convention)
 {
     return(OvernightIborSwapTemplate.builder().periodToStart(periodToStart).tenor(tenor).convention(convention).build());
 }
Exemplo n.º 6
0
 //-------------------------------------------------------------------------
 public virtual void test_builder_notEnoughData()
 {
     assertThrowsIllegalArg(() => OvernightIborSwapTemplate.builder().tenor(TENOR_2Y).build());
 }
Exemplo n.º 7
0
        public virtual void test_serialization()
        {
            OvernightIborSwapTemplate test = OvernightIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV);

            assertSerialization(test);
        }