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 = (OvernightFuture)newValue;
                    break;

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

                case 106934601:         // price
                    this.price_Renamed = (double?)newValue.Value;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3237038:         // info
                    this.info_Renamed = (PositionInfo)newValue;
                    break;

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

                case 611668775:         // longQuantity
                    this.longQuantity_Renamed = (double?)newValue.Value;
                    break;

                case -2094395097:         // shortQuantity
                    this.shortQuantity_Renamed = (double?)newValue.Value;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(OvernightFutureTrade beanToCopy)
 {
     this.info_Renamed     = beanToCopy.Info;
     this.product_Renamed  = beanToCopy.Product;
     this.quantity_Renamed = beanToCopy.Quantity;
     this.price_Renamed    = beanToCopy.Price;
 }
        //-------------------------------------------------------------------------
        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);
        }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(OvernightFuturePosition beanToCopy)
 {
     this.info_Renamed          = beanToCopy.Info;
     this.product_Renamed       = beanToCopy.Product;
     this.longQuantity_Renamed  = beanToCopy.LongQuantity;
     this.shortQuantity_Renamed = beanToCopy.ShortQuantity;
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            OvernightFuture test1 = sut();

            coverImmutableBean(test1);
            OvernightFuture test2 = sut2();

            coverBeanEquals(test1, test2);
        }
        //-------------------------------------------------------------------------
        public virtual FunctionRequirements requirements(T target, ISet <Measure> measures, CalculationParameters parameters, ReferenceData refData)
        {
            // extract data from product
            OvernightFuture product = target.Product;
            QuoteId         quoteId = QuoteId.of(target.Product.SecurityId.StandardId, FieldName.SETTLEMENT_PRICE);
            OvernightIndex  index   = product.Index;

            // use lookup to build requirements
            RatesMarketDataLookup ratesLookup = parameters.getParameter(typeof(RatesMarketDataLookup));
            FunctionRequirements  ratesReqs   = ratesLookup.requirements(ImmutableSet.of(), ImmutableSet.of(index));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> valueReqs = com.google.common.collect.ImmutableSet.builder<com.opengamma.strata.data.MarketDataId<?>>().add(quoteId).addAll(ratesReqs.getValueRequirements()).build();
            ImmutableSet <MarketDataId <object> > valueReqs = ImmutableSet.builder <MarketDataId <object> >().add(quoteId).addAll(ratesReqs.ValueRequirements).build();

            return(ratesReqs.toBuilder().valueRequirements(valueReqs).build());
        }
        public virtual void test_builder_default()
        {
            OvernightFuture test = OvernightFuture.builder().securityId(SECURITY_ID).notional(NOTIONAL).accrualFactor(ACCRUAL_FACTOR).startDate(START_DATE).endDate(END_DATE).lastTradeDate(LAST_TRADE_DATE).index(USD_FED_FUND).accrualMethod(OvernightAccrualMethod.AVERAGED_DAILY).build();

            assertEquals(test.SecurityId, SECURITY_ID);
            assertEquals(test.Currency, USD);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.AccrualFactor, ACCRUAL_FACTOR);
            assertEquals(test.LastTradeDate, LAST_TRADE_DATE);
            assertEquals(test.Index, USD_FED_FUND);
            assertEquals(test.Rounding, Rounding.none());
            assertEquals(test.StartDate, START_DATE);
            assertEquals(test.EndDate, END_DATE);
            assertEquals(test.LastTradeDate, LAST_TRADE_DATE);
            assertEquals(test.AccrualMethod, OvernightAccrualMethod.AVERAGED_DAILY);
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            OvernightFuture test = sut();

            assertEquals(test.SecurityId, SECURITY_ID);
            assertEquals(test.Currency, USD);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.AccrualFactor, ACCRUAL_FACTOR);
            assertEquals(test.LastTradeDate, LAST_TRADE_DATE);
            assertEquals(test.Index, USD_FED_FUND);
            assertEquals(test.Rounding, ROUNDING);
            assertEquals(test.StartDate, START_DATE);
            assertEquals(test.EndDate, END_DATE);
            assertEquals(test.LastTradeDate, LAST_TRADE_DATE);
            assertEquals(test.AccrualMethod, OvernightAccrualMethod.AVERAGED_DAILY);
        }
 /// <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(OvernightFuture product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
예제 #11
0
 //-------------------------------------------------------------------------
 public OvernightFuture createProduct(ReferenceData refData)
 {
     return(OvernightFuture.builder().securityId(SecurityId).notional(notional).accrualFactor(accrualFactor).index(index).accrualMethod(accrualMethod).lastTradeDate(lastTradeDate).startDate(startDate).endDate(endDate).rounding(rounding).build());
 }
 public virtual void test_builder_noIndex()
 {
     assertThrowsIllegalArg(() => OvernightFuture.builder().securityId(SECURITY_ID).currency(USD).notional(NOTIONAL).accrualFactor(ACCRUAL_FACTOR).startDate(START_DATE).endDate(END_DATE).lastTradeDate(LAST_TRADE_DATE).accrualMethod(OvernightAccrualMethod.AVERAGED_DAILY).rounding(ROUNDING).build());
 }
 internal static OvernightFuture sut2()
 {
     return(OvernightFuture.builder().securityId(SECURITY_ID2).currency(GBP).notional(NOTIONAL2).accrualFactor(ACCRUAL_FACTOR2).startDate(START_DATE2).endDate(END_DATE2).lastTradeDate(LAST_TRADE_DATE2).index(GBP_SONIA).accrualMethod(OvernightAccrualMethod.COMPOUNDED).rounding(Rounding.none()).build());
 }
 //-------------------------------------------------------------------------
 internal static OvernightFuture sut()
 {
     return(OvernightFuture.builder().securityId(SECURITY_ID).currency(USD).notional(NOTIONAL).accrualFactor(ACCRUAL_FACTOR).startDate(START_DATE).endDate(END_DATE).lastTradeDate(LAST_TRADE_DATE).index(USD_FED_FUND).accrualMethod(OvernightAccrualMethod.AVERAGED_DAILY).rounding(ROUNDING).build());
 }
        public virtual void test_serialization()
        {
            OvernightFuture test = sut();

            assertSerialization(test);
        }