コード例 #1
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3237038:         // info
                    this.info_Renamed = (PortfolioItemInfo)newValue;
                    break;

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

                case -1285004149:         // quantity
                    this.quantity_Renamed = (double?)newValue.Value;
                    break;

                case 73828649:         // settlement
                    this.settlement_Renamed = (ResolvedCapitalIndexedBondSettlement)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
コード例 #2
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ResolvedCapitalIndexedBondTrade beanToCopy)
 {
     this.info_Renamed       = beanToCopy.Info;
     this.product_Renamed    = beanToCopy.Product;
     this.quantity_Renamed   = beanToCopy.Quantity;
     this.settlement_Renamed = beanToCopy.settlement;
 }
        public virtual void test_of()
        {
            ResolvedCapitalIndexedBondSettlement test = sut();

            assertEquals(test.SettlementDate, SETTLE_DATE);
            assertEquals(test.Price, PRICE);
            assertEquals(test.Payment, SETTLE_PERIOD);
        }
コード例 #4
0
 /// <summary>
 /// Creates an instance. </summary>
 /// <param name="info">  the value of the property, not null </param>
 /// <param name="product">  the value of the property, not null </param>
 /// <param name="quantity">  the value of the property </param>
 /// <param name="settlement">  the value of the property </param>
 internal ResolvedCapitalIndexedBondTrade(PortfolioItemInfo info, ResolvedCapitalIndexedBond product, double quantity, ResolvedCapitalIndexedBondSettlement settlement)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     this.info       = info;
     this.product    = product;
     this.quantity   = quantity;
     this.settlement = settlement;
 }
コード例 #5
0
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedCapitalIndexedBondSettlement other = (ResolvedCapitalIndexedBondSettlement)obj;
         return(JodaBeanUtils.equal(settlementDate, other.settlementDate) && JodaBeanUtils.equal(price, other.price) && JodaBeanUtils.equal(payment, other.payment));
     }
     return(false);
 }
 internal static ResolvedCapitalIndexedBondSettlement sut2()
 {
     return(ResolvedCapitalIndexedBondSettlement.of(SETTLE_DATE2, PRICE2, SETTLE_PERIOD2));
 }
コード例 #7
0
 /// <summary>
 /// Sets the settlement details of the bond trade.
 /// <para>
 /// When this class is used to represent a position, this property will be empty.
 /// </para>
 /// </summary>
 /// <param name="settlement">  the new value </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder settlement(ResolvedCapitalIndexedBondSettlement settlement)
 {
     this.settlement_Renamed = settlement;
     return(this);
 }
コード例 #8
0
        public virtual void test_resolve1()
        {
            ResolvedCapitalIndexedBondTrade test     = sut1().resolve(REF_DATA);
            ResolvedCapitalIndexedBondTrade expected = ResolvedCapitalIndexedBondTrade.builder().info(TRADE_INFO).product(PRODUCT1.resolve(REF_DATA)).quantity(QUANTITY).settlement(ResolvedCapitalIndexedBondSettlement.of(SETTLEMENT_DATE, PRICE, SETTLEMENT1)).build();

            assertEquals(test, expected);
        }
コード例 #9
0
        public ResolvedCapitalIndexedBondTrade resolve(ReferenceData refData)
        {
            ResolvedCapitalIndexedBond resolvedProduct = product.resolve(refData);
            LocalDate settlementDate = calculateSettlementDate(refData);

            double accruedInterest = resolvedProduct.accruedInterest(settlementDate) / product.Notional;

            if (settlementDate.isBefore(resolvedProduct.StartDate))
            {
                throw new System.ArgumentException("Settlement date must not be before bond starts");
            }
            BondPaymentPeriod settlePeriod;

            if (product.YieldConvention.Equals(CapitalIndexedBondYieldConvention.GB_IL_FLOAT))
            {
                settlePeriod = KnownAmountBondPaymentPeriod.of(Payment.of(product.Currency, -product.Notional * quantity * (price + accruedInterest), settlementDate), SchedulePeriod.of(resolvedProduct.StartDate, settlementDate, product.AccrualSchedule.StartDate, settlementDate));
            }
            else
            {
                RateComputation rateComputation = product.RateCalculation.createRateComputation(settlementDate);
                settlePeriod = CapitalIndexedBondPaymentPeriod.builder().startDate(resolvedProduct.StartDate).unadjustedStartDate(product.AccrualSchedule.StartDate).endDate(settlementDate).rateComputation(rateComputation).currency(product.Currency).notional(-product.Notional * quantity * (price + accruedInterest)).realCoupon(1d).build();
            }

            return(ResolvedCapitalIndexedBondTrade.builder().info(info).product(resolvedProduct).quantity(quantity).settlement(ResolvedCapitalIndexedBondSettlement.of(settlementDate, price, settlePeriod)).build());
        }