Esempio n. 1
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            TermDepositTemplate test1 = TermDepositTemplate.of(DEPOSIT_PERIOD, CONVENTION);

            coverImmutableBean(test1);
            TermDepositTemplate test2 = TermDepositTemplate.of(Period.ofMonths(6), ImmutableTermDepositConvention.of("GBP-Dep", GBP, BDA_MOD_FOLLOW, ACT_365F, DaysAdjustment.ofBusinessDays(2, GBLO)));

            coverBeanEquals(test1, test2);
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------
        public virtual void test_builder_full()
        {
            ImmutableTermDepositConvention test = ImmutableTermDepositConvention.builder().name("Test").businessDayAdjustment(BDA_MOD_FOLLOW).currency(EUR).dayCount(ACT_360).spotDateOffset(PLUS_TWO_DAYS).build();

            assertEquals(test.Name, "Test");
            assertEquals(test.BusinessDayAdjustment, BDA_MOD_FOLLOW);
            assertEquals(test.Currency, EUR);
            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.SpotDateOffset, PLUS_TWO_DAYS);
        }
Esempio n. 3
0
        public virtual void test_of()
        {
            ImmutableTermDepositConvention test = ImmutableTermDepositConvention.of("EUR-Deposit", EUR, BDA_MOD_FOLLOW, ACT_360, PLUS_TWO_DAYS);

            assertEquals(test.Name, "EUR-Deposit");
            assertEquals(test.BusinessDayAdjustment, BDA_MOD_FOLLOW);
            assertEquals(test.Currency, EUR);
            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.SpotDateOffset, PLUS_TWO_DAYS);
        }
Esempio n. 4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ImmutableTermDepositConvention test1 = ImmutableTermDepositConvention.of("EUR-Deposit", EUR, BDA_MOD_FOLLOW, ACT_360, PLUS_TWO_DAYS);

            coverImmutableBean(test1);
            ImmutableTermDepositConvention test2 = ImmutableTermDepositConvention.of("GBP-Deposit", GBP, BDA_MOD_FOLLOW, ACT_365F, DaysAdjustment.ofBusinessDays(0, GBLO));

            coverBeanEquals(test1, test2);

            coverPrivateConstructor(typeof(TermDepositConventions));
            coverPrivateConstructor(typeof(StandardTermDepositConventions));
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ImmutableTermDepositConvention other = (ImmutableTermDepositConvention)obj;
         return(JodaBeanUtils.equal(currency, other.currency) && JodaBeanUtils.equal(name, other.name) && JodaBeanUtils.equal(businessDayAdjustment, other.businessDayAdjustment) && JodaBeanUtils.equal(dayCount, other.dayCount) && JodaBeanUtils.equal(spotDateOffset, other.spotDateOffset));
     }
     return(false);
 }
Esempio n. 6
0
        //-------------------------------------------------------------------------
        public virtual void test_toTrade()
        {
            TermDepositConvention convention     = ImmutableTermDepositConvention.builder().name("EUR-Dep").businessDayAdjustment(BDA_MOD_FOLLOW).currency(EUR).dayCount(ACT_360).spotDateOffset(PLUS_TWO_DAYS).build();
            LocalDate             tradeDate      = LocalDate.of(2015, 1, 22);
            Period           period3M            = Period.ofMonths(3);
            BuySell          buy                 = BuySell.BUY;
            double           notional            = 2_000_000d;
            double           rate                = 0.0125;
            TermDepositTrade trade               = convention.createTrade(tradeDate, period3M, buy, notional, rate, REF_DATA);
            LocalDate        startDateExpected   = PLUS_TWO_DAYS.adjust(tradeDate, REF_DATA);
            LocalDate        endDateExpected     = startDateExpected.plus(period3M);
            TermDeposit      termDepositExpected = TermDeposit.builder().buySell(buy).currency(EUR).notional(notional).startDate(startDateExpected).endDate(endDateExpected).businessDayAdjustment(BDA_MOD_FOLLOW).rate(rate).dayCount(ACT_360).build();
            TradeInfo        tradeInfoExpected   = TradeInfo.of(tradeDate);

            assertEquals(trade.Product, termDepositExpected);
            assertEquals(trade.Info, tradeInfoExpected);
        }
Esempio n. 7
0
        public virtual void test_serialization()
        {
            ImmutableTermDepositConvention test = ImmutableTermDepositConvention.of("EUR-Deposit", EUR, BDA_MOD_FOLLOW, ACT_360, PLUS_TWO_DAYS);

            assertSerialization(test);
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "spotAndConv") public void test_spotAndConv(ImmutableTermDepositConvention convention, int spotT, com.opengamma.strata.basics.date.BusinessDayConvention conv)
        public virtual void test_spotAndConv(ImmutableTermDepositConvention convention, int spotT, BusinessDayConvention conv)
        {
            assertEquals(convention.SpotDateOffset.Days, spotT);
            assertEquals(convention.BusinessDayAdjustment.Convention, conv);
        }
 //-----------------------------------------------------------------------
 /// <summary>
 /// Obtains a convention based on the specified currency, business day adjustment,
 /// day count convention and spot date offset.
 /// </summary>
 /// <param name="name">  the name of the convention, such as 'GBP-Deposit-ON' </param>
 /// <param name="currency">  the currency, in which the payments are made </param>
 /// <param name="businessDayAdjustment"> the business day adjustment to apply to the start and end date </param>
 /// <param name="dayCount"> the day count convention, used to convert dates to a numerical value </param>
 /// <param name="spotDateOffset"> the offset of the spot value date from the trade date </param>
 /// <returns> the convention </returns>
 public static ImmutableTermDepositConvention of(string name, Currency currency, BusinessDayAdjustment businessDayAdjustment, DayCount dayCount, DaysAdjustment spotDateOffset)
 {
     return(ImmutableTermDepositConvention.builder().name(name).currency(currency).businessDayAdjustment(businessDayAdjustment).dayCount(dayCount).spotDateOffset(spotDateOffset).build());
 }