/// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(IborFuturePosition beanToCopy)
 {
     this.info_Renamed          = beanToCopy.Info;
     this.product_Renamed       = beanToCopy.Product;
     this.longQuantity_Renamed  = beanToCopy.LongQuantity;
     this.shortQuantity_Renamed = beanToCopy.ShortQuantity;
 }
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            IborFuture         test     = sut();
            ResolvedIborFuture expected = ResolvedIborFuture.builder().securityId(SECURITY_ID).currency(USD).notional(NOTIONAL).accrualFactor(ACCRUAL_FACTOR).iborRate(IborRateComputation.of(USD_LIBOR_3M, LAST_TRADE_DATE, REF_DATA)).rounding(ROUNDING).build();

            assertEquals(test.resolve(REF_DATA), expected);
        }
            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 = (IborFuture)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 = (IborFuture)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(IborFutureTrade beanToCopy)
 {
     this.info_Renamed     = beanToCopy.Info;
     this.product_Renamed  = beanToCopy.Product;
     this.quantity_Renamed = beanToCopy.Quantity;
     this.price_Renamed    = beanToCopy.Price;
 }
Esempio n. 6
0
        public virtual void test_createProduct_wrongType()
        {
            IborFutureOptionSecurity test = sut();
            IborFuture      future        = OPTION.UnderlyingFuture;
            SecurityId      secId         = future.SecurityId;
            GenericSecurity sec           = GenericSecurity.of(INFO);
            ReferenceData   refData       = ImmutableReferenceData.of(secId, sec);

            assertThrows(() => test.createProduct(refData), typeof(System.InvalidCastException));
        }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(IborFutureOption beanToCopy)
 {
     this.securityId_Renamed       = beanToCopy.SecurityId;
     this.putCall_Renamed          = beanToCopy.PutCall;
     this.strikePrice_Renamed      = beanToCopy.StrikePrice;
     this.expiryDate_Renamed       = beanToCopy.ExpiryDate;
     this.expiryTime_Renamed       = beanToCopy.ExpiryTime;
     this.expiryZone_Renamed       = beanToCopy.ExpiryZone;
     this.premiumStyle_Renamed     = beanToCopy.PremiumStyle;
     this.rounding_Renamed         = beanToCopy.Rounding;
     this.underlyingFuture_Renamed = beanToCopy.UnderlyingFuture;
 }
        public virtual void test_builder_defaults()
        {
            IborFuture test = IborFuture.builder().securityId(SECURITY_ID).currency(GBP).notional(NOTIONAL).lastTradeDate(LAST_TRADE_DATE).index(GBP_LIBOR_2M).build();

            assertEquals(test.SecurityId, SECURITY_ID);
            assertEquals(test.Currency, GBP);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.AccrualFactor, ACCRUAL_FACTOR2);
            assertEquals(test.LastTradeDate, LAST_TRADE_DATE);
            assertEquals(test.Index, GBP_LIBOR_2M);
            assertEquals(test.Rounding, Rounding.none());
            assertEquals(test.FixingDate, LAST_TRADE_DATE);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         IborFuture other = (IborFuture)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(index, other.index) && JodaBeanUtils.equal(rounding, other.rounding));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            IborFuture 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_LIBOR_3M);
            assertEquals(test.Rounding, ROUNDING);
            assertEquals(test.FixingDate, LAST_TRADE_DATE);
        }
        //-------------------------------------------------------------------------
        public IborFutureOption createProduct(ReferenceData refData)
        {
            Security security = refData.getValue(underlyingFutureId);

            if (!(security is IborFutureSecurity))
            {
                throw new System.InvalidCastException(Messages.format("{} underlying future '{}' resolved to '{}' when '{}' was expected", typeof(IborFutureOptionSecurity).Name, underlyingFutureId, security.GetType().Name, typeof(IborFutureSecurity).Name));
            }
            IborFutureSecurity futureSec  = (IborFutureSecurity)security;
            IborFuture         underlying = futureSec.createProduct(refData);

            return(new IborFutureOption(SecurityId, putCall, strikePrice, expiryDate, expiryTime, expiryZone, premiumStyle, rounding, underlying));
        }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 1574023291:         // securityId
                    this.securityId_Renamed = (SecurityId)newValue;
                    break;

                case -219971059:         // putCall
                    this.putCall_Renamed = (PutCall)newValue;
                    break;

                case 50946231:         // strikePrice
                    this.strikePrice_Renamed = (double?)newValue.Value;
                    break;

                case -816738431:         // expiryDate
                    this.expiryDate_Renamed = (LocalDate)newValue;
                    break;

                case -816254304:         // expiryTime
                    this.expiryTime_Renamed = (LocalTime)newValue;
                    break;

                case -816069761:         // expiryZone
                    this.expiryZone_Renamed = (ZoneId)newValue;
                    break;

                case -1257652838:         // premiumStyle
                    this.premiumStyle_Renamed = (FutureOptionPremiumStyle)newValue;
                    break;

                case -142444:         // rounding
                    this.rounding_Renamed = (Rounding)newValue;
                    break;

                case -165476480:         // underlyingFuture
                    this.underlyingFuture_Renamed = (IborFuture)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 /// <summary>
 /// Creates an instance. </summary>
 /// <param name="securityId">  the value of the property, not null </param>
 /// <param name="putCall">  the value of the property </param>
 /// <param name="strikePrice">  the value of the property </param>
 /// <param name="expiryDate">  the value of the property, not null </param>
 /// <param name="expiryTime">  the value of the property, not null </param>
 /// <param name="expiryZone">  the value of the property, not null </param>
 /// <param name="premiumStyle">  the value of the property, not null </param>
 /// <param name="rounding">  the value of the property, not null </param>
 /// <param name="underlyingFuture">  the value of the property, not null </param>
 internal IborFutureOption(SecurityId securityId, PutCall putCall, double strikePrice, LocalDate expiryDate, LocalTime expiryTime, ZoneId expiryZone, FutureOptionPremiumStyle premiumStyle, Rounding rounding, IborFuture underlyingFuture)
 {
     JodaBeanUtils.notNull(securityId, "securityId");
     JodaBeanUtils.notNull(expiryDate, "expiryDate");
     JodaBeanUtils.notNull(expiryTime, "expiryTime");
     JodaBeanUtils.notNull(expiryZone, "expiryZone");
     JodaBeanUtils.notNull(premiumStyle, "premiumStyle");
     JodaBeanUtils.notNull(rounding, "rounding");
     JodaBeanUtils.notNull(underlyingFuture, "underlyingFuture");
     this.securityId       = securityId;
     this.putCall          = putCall;
     this.strikePrice      = strikePrice;
     this.expiryDate       = expiryDate;
     this.expiryTime       = expiryTime;
     this.expiryZone       = expiryZone;
     this.premiumStyle     = premiumStyle;
     this.rounding         = rounding;
     this.underlyingFuture = underlyingFuture;
     validate();
 }
 public virtual void test_builder_noLastTradeDate()
 {
     assertThrowsIllegalArg(() => IborFuture.builder().securityId(SECURITY_ID).notional(NOTIONAL).currency(GBP).index(GBP_LIBOR_2M).rounding(ROUNDING).build());
 }
        public virtual void test_builder_noCurrency()
        {
            IborFuture test = IborFuture.builder().securityId(SECURITY_ID).notional(NOTIONAL).index(GBP_LIBOR_2M).lastTradeDate(LAST_TRADE_DATE).rounding(ROUNDING).build();

            assertEquals(GBP, test.Currency);
        }
 public virtual void test_builder_noIndex()
 {
     assertThrowsIllegalArg(() => IborFuture.builder().securityId(SECURITY_ID).notional(NOTIONAL).currency(GBP).lastTradeDate(LAST_TRADE_DATE).rounding(ROUNDING).build());
 }
 internal static IborFuture sut2()
 {
     return(IborFuture.builder().securityId(SECURITY_ID2).currency(GBP).notional(NOTIONAL2).accrualFactor(ACCRUAL_FACTOR2).lastTradeDate(LAST_TRADE_DATE2).index(GBP_LIBOR_2M).build());
 }
 //-------------------------------------------------------------------------
 internal static IborFuture sut()
 {
     return(IborFuture.builder().securityId(SECURITY_ID).currency(USD).notional(NOTIONAL).accrualFactor(ACCRUAL_FACTOR).lastTradeDate(LAST_TRADE_DATE).index(USD_LIBOR_3M).rounding(ROUNDING).build());
 }
 //-------------------------------------------------------------------------
 public IborFuture createProduct(ReferenceData refData)
 {
     return(IborFuture.builder().securityId(SecurityId).notional(notional).index(index).lastTradeDate(lastTradeDate).rounding(rounding).build());
 }
 /// <summary>
 /// Sets the future that was traded.
 /// <para>
 /// The product captures the contracted financial details.
 /// </para>
 /// </summary>
 /// <param name="product">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder product(IborFuture product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
 /// <summary>
 /// Sets the underlying future. </summary>
 /// <param name="underlyingFuture">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder underlyingFuture(IborFuture underlyingFuture)
 {
     JodaBeanUtils.notNull(underlyingFuture, "underlyingFuture");
     this.underlyingFuture_Renamed = underlyingFuture;
     return(this);
 }