//-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            OvernightFuture         @base    = sut();
            ResolvedOvernightFuture expected = ResolvedOvernightFuture.builder().securityId(SECURITY_ID).currency(USD).notional(NOTIONAL).accrualFactor(ACCRUAL_FACTOR).overnightRate(OvernightRateComputation.of(USD_FED_FUND, START_DATE, END_DATE, 0, OvernightAccrualMethod.AVERAGED_DAILY, REF_DATA)).lastTradeDate(LAST_TRADE_DATE).rounding(ROUNDING).build();

            assertEquals(@base.resolve(REF_DATA), expected);
        }
Beispiel #2
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 = (ResolvedOvernightFuture)newValue;
                    break;

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

                case -1873824343:         // tradedPrice
                    this.tradedPrice_Renamed = (TradedPrice)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Beispiel #3
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ResolvedOvernightFutureTrade beanToCopy)
 {
     this.info_Renamed        = beanToCopy.Info;
     this.product_Renamed     = beanToCopy.Product;
     this.quantity_Renamed    = beanToCopy.Quantity;
     this.tradedPrice_Renamed = beanToCopy.tradedPrice;
 }
Beispiel #4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ResolvedOvernightFuture test1 = ResolvedOvernightFuture.builder().currency(USD).accrualFactor(ACCRUAL_FACTOR_1M).lastTradeDate(LAST_TRADE_DATE).overnightRate(RATE_COMPUTATION).notional(NOTIONAL).rounding(ROUNDING).securityId(SECURITY_ID).build();

            coverImmutableBean(test1);
            ResolvedOvernightFuture test2 = ResolvedOvernightFuture.builder().currency(GBP).accrualFactor(0.25).lastTradeDate(date(2018, 9, 28)).overnightRate(OvernightRateComputation.of(GBP_SONIA, date(2018, 9, 1), date(2018, 9, 30), 0, OvernightAccrualMethod.AVERAGED_DAILY, REF_DATA)).notional(1.0e8).securityId(SecurityId.of("OG-Test", "OnFuture2")).build();

            coverBeanEquals(test1, test2);
        }
Beispiel #5
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="tradedPrice">  the value of the property </param>
 internal ResolvedOvernightFutureTrade(PortfolioItemInfo info, ResolvedOvernightFuture product, double quantity, TradedPrice tradedPrice)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     this.info        = info;
     this.product     = product;
     this.quantity    = quantity;
     this.tradedPrice = tradedPrice;
 }
        public ResolvedOvernightFutureTrade resolve(ReferenceData refData)
        {
            if (!info.TradeDate.Present)
            {
                throw new System.ArgumentException("Trade date on TradeInfo must be present");
            }
            ResolvedOvernightFuture resolved    = Product.resolve(refData);
            TradedPrice             tradedPrice = TradedPrice.of(info.TradeDate.get(), price);

            return(new ResolvedOvernightFutureTrade(info, resolved, quantity, tradedPrice));
        }
Beispiel #7
0
        public virtual void test_builder_default()
        {
            ResolvedOvernightFuture test = ResolvedOvernightFuture.builder().accrualFactor(ACCRUAL_FACTOR_1M).lastTradeDate(LAST_TRADE_DATE).overnightRate(RATE_COMPUTATION).notional(NOTIONAL).securityId(SECURITY_ID).build();

            assertEquals(test.AccrualFactor, ACCRUAL_FACTOR_1M);
            assertEquals(test.Currency, USD);
            assertEquals(test.Index, USD_FED_FUND);
            assertEquals(test.LastTradeDate, LAST_TRADE_DATE);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.OvernightRate, RATE_COMPUTATION);
            assertEquals(test.Rounding, Rounding.none());
            assertEquals(test.SecurityId, SECURITY_ID);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedOvernightFuture other = (ResolvedOvernightFuture)obj;
         return(JodaBeanUtils.equal(securityId, other.securityId) && JodaBeanUtils.equal(currency, other.currency) && JodaBeanUtils.equal(notional, other.notional) && JodaBeanUtils.equal(accrualFactor, other.accrualFactor) && JodaBeanUtils.equal(lastTradeDate, other.lastTradeDate) && JodaBeanUtils.equal(overnightRate, other.overnightRate) && JodaBeanUtils.equal(rounding, other.rounding));
     }
     return(false);
 }
Beispiel #9
0
        public virtual void test_serialization()
        {
            ResolvedOvernightFuture test = ResolvedOvernightFuture.builder().currency(USD).accrualFactor(ACCRUAL_FACTOR_1M).lastTradeDate(LAST_TRADE_DATE).overnightRate(RATE_COMPUTATION).notional(NOTIONAL).rounding(ROUNDING).securityId(SECURITY_ID).build();

            assertSerialization(test);
        }
        public ResolvedOvernightFutureTrade resolve(ReferenceData refData)
        {
            ResolvedOvernightFuture resolved = product.resolve(refData);

            return(new ResolvedOvernightFutureTrade(info, resolved, Quantity, null));
        }
Beispiel #11
0
 /// <summary>
 /// Sets the future that was traded.
 /// <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(ResolvedOvernightFuture product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }