private TermDepositTrade(TradeInfo info, TermDeposit product)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     this.info    = info;
     this.product = product;
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            TermDeposit test1 = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build();

            coverImmutableBean(test1);
            TermDeposit test2 = TermDeposit.builder().buySell(BuySell.BUY).startDate(LocalDate.of(2015, 1, 21)).endDate(LocalDate.of(2015, 7, 21)).dayCount(ACT_360).notional(NOTIONAL).currency(EUR).rate(RATE).build();

            coverBeanEquals(test1, test2);
        }
Exemple #3
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         TermDeposit other = (TermDeposit)obj;
         return(JodaBeanUtils.equal(buySell, other.buySell) && JodaBeanUtils.equal(currency, other.currency) && JodaBeanUtils.equal(notional, other.notional) && JodaBeanUtils.equal(startDate, other.startDate) && JodaBeanUtils.equal(endDate, other.endDate) && JodaBeanUtils.equal(businessDayAdjustment, other.businessDayAdjustment) && JodaBeanUtils.equal(dayCount, other.dayCount) && JodaBeanUtils.equal(rate, other.rate));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            TermDeposit         @base           = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build();
            ResolvedTermDeposit test            = @base.resolve(REF_DATA);
            LocalDate           expectedEndDate = BDA_MOD_FOLLOW.adjust(END_DATE, REF_DATA);
            double expectedYearFraction         = ACT_365F.yearFraction(START_DATE, expectedEndDate);

            assertEquals(test.StartDate, START_DATE);
            assertEquals(test.EndDate, expectedEndDate);
            assertEquals(test.Notional, -NOTIONAL);
            assertEquals(test.YearFraction, expectedYearFraction, EPS);
            assertEquals(test.Interest, -RATE * expectedYearFraction * NOTIONAL, NOTIONAL * EPS);
            assertEquals(test.Rate, RATE);
            assertEquals(test.Currency, GBP);
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            TermDeposit test = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build();

            assertEquals(test.BuySell, SELL);
            assertEquals(test.StartDate, START_DATE);
            assertEquals(test.EndDate, END_DATE);
            assertEquals(test.BusinessDayAdjustment.get(), BDA_MOD_FOLLOW);
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.Rate, RATE);
            assertEquals(test.Currency, GBP);
            assertEquals(test.CrossCurrency, false);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(GBP));
            assertEquals(test.allCurrencies(), ImmutableSet.of(GBP));
        }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3237038:         // info
                    this.info_Renamed = (TradeInfo)newValue;
                    break;

                case -309474065:         // product
                    this.product_Renamed = (TermDeposit)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 public virtual void test_builder_wrongDates()
 {
     assertThrowsIllegalArg(() => TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(LocalDate.of(2014, 10, 19)).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(EUR).rate(RATE).build());
 }
        public virtual void test_serialization()
        {
            TermDeposit test = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build();

            assertSerialization(test);
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance of a Term Deposit trade.
 /// </summary>
 /// <param name="info">  the trade info </param>
 /// <param name="product">  the product </param>
 /// <returns> the trade </returns>
 public static TermDepositTrade of(TradeInfo info, TermDeposit product)
 {
     return(new TermDepositTrade(info, product));
 }
 /// <summary>
 /// Sets the term deposit product that was agreed when the trade occurred.
 /// <para>
 /// The product captures the contracted financial details of the trade.
 /// </para>
 /// </summary>
 /// <param name="product">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder product(TermDeposit product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(TermDepositTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
 }