예제 #1
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ResolvedTermDeposit test1 = ResolvedTermDeposit.builder().currency(GBP).notional(PRINCIPAL).startDate(START_DATE).endDate(END_DATE).yearFraction(YEAR_FRACTION).rate(RATE).build();

            coverImmutableBean(test1);
            ResolvedTermDeposit test2 = ResolvedTermDeposit.builder().currency(GBP).notional(-50000000).startDate(START_DATE).endDate(END_DATE).yearFraction(YEAR_FRACTION).rate(0.0145).build();

            coverBeanEquals(test1, test2);
        }
예제 #2
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            ResolvedTermDeposit test = ResolvedTermDeposit.builder().currency(GBP).notional(PRINCIPAL).startDate(START_DATE).endDate(END_DATE).yearFraction(YEAR_FRACTION).rate(RATE).build();

            assertEquals(test.Currency, GBP);
            assertEquals(test.Notional, PRINCIPAL);
            assertEquals(test.StartDate, START_DATE);
            assertEquals(test.EndDate, END_DATE);
            assertEquals(test.YearFraction, YEAR_FRACTION);
            assertEquals(test.Rate, RATE);
            assertEquals(test.Interest, RATE * YEAR_FRACTION * PRINCIPAL, PRINCIPAL * EPS);
        }
예제 #3
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedTermDeposit other = (ResolvedTermDeposit)obj;
         return(JodaBeanUtils.equal(currency, other.currency) && JodaBeanUtils.equal(notional, other.notional) && JodaBeanUtils.equal(startDate, other.startDate) && JodaBeanUtils.equal(endDate, other.endDate) && JodaBeanUtils.equal(yearFraction, other.yearFraction) && 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 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 = (ResolvedTermDeposit)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance of a resolved Term Deposit trade.
 /// </summary>
 /// <param name="info">  the trade info </param>
 /// <param name="product">  the product </param>
 /// <returns> the resolved trade </returns>
 public static ResolvedTermDepositTrade of(TradeInfo info, ResolvedTermDeposit product)
 {
     return(new ResolvedTermDepositTrade(info, product));
 }
 /// <summary>
 /// Sets the resolved Term Deposit product.
 /// <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(ResolvedTermDeposit 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(ResolvedTermDepositTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
 }
 private ResolvedTermDepositTrade(TradeInfo info, ResolvedTermDeposit product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.info    = info;
     this.product = product;
 }
예제 #10
0
        public virtual void test_serialization()
        {
            ResolvedTermDeposit test = ResolvedTermDeposit.builder().currency(GBP).notional(PRINCIPAL).startDate(START_DATE).endDate(END_DATE).yearFraction(YEAR_FRACTION).rate(RATE).build();

            assertSerialization(test);
        }
예제 #11
0
 public virtual void test_builder_wrongDates()
 {
     assertThrowsIllegalArg(() => ResolvedTermDeposit.builder().currency(GBP).notional(PRINCIPAL).startDate(START_DATE).endDate(LocalDate.of(2013, 1, 22)).yearFraction(YEAR_FRACTION).rate(RATE).build());
 }