示例#1
0
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            IborFutureOption         test     = sut();
            ResolvedIborFutureOption expected = ResolvedIborFutureOption.builder().securityId(SECURITY_ID).putCall(CALL).strikePrice(STRIKE_PRICE).expiry(EXPIRY_DATE.atTime(EXPIRY_TIME).atZone(EXPIRY_ZONE)).premiumStyle(FutureOptionPremiumStyle.DAILY_MARGIN).underlyingFuture(FUTURE.resolve(REF_DATA)).build();

            assertEquals(test.resolve(REF_DATA), expected);
        }
            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 = (ResolvedIborFutureOption)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);
            }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ResolvedIborFutureOptionTrade beanToCopy)
 {
     this.info_Renamed        = beanToCopy.Info;
     this.product_Renamed     = beanToCopy.Product;
     this.quantity_Renamed    = beanToCopy.Quantity;
     this.tradedPrice_Renamed = beanToCopy.tradedPrice;
 }
 /// <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 ResolvedIborFutureOptionTrade(PortfolioItemInfo info, ResolvedIborFutureOption 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;
 }
示例#5
0
        public ResolvedIborFutureOptionTrade resolve(ReferenceData refData)
        {
            if (!info.TradeDate.Present)
            {
                throw new System.ArgumentException("Trade date on TradeInfo must be present");
            }
            ResolvedIborFutureOption resolved = Product.resolve(refData);
            TradedPrice tradedPrice           = TradedPrice.of(info.TradeDate.get(), price);

            return(new ResolvedIborFutureOptionTrade(info, resolved, quantity, tradedPrice));
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedIborFutureOption other = (ResolvedIborFutureOption)obj;
         return(JodaBeanUtils.equal(securityId, other.securityId) && JodaBeanUtils.equal(putCall, other.putCall) && JodaBeanUtils.equal(strikePrice, other.strikePrice) && JodaBeanUtils.equal(expiry, other.expiry) && JodaBeanUtils.equal(premiumStyle, other.premiumStyle) && JodaBeanUtils.equal(rounding, other.rounding) && JodaBeanUtils.equal(underlyingFuture, other.underlyingFuture));
     }
     return(false);
 }
示例#7
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            ResolvedIborFutureOption test = sut();

            assertEquals(test.SecurityId, PRODUCT.SecurityId);
            assertEquals(test.PutCall, PRODUCT.PutCall);
            assertEquals(test.StrikePrice, PRODUCT.StrikePrice);
            assertEquals(test.PremiumStyle, PRODUCT.PremiumStyle);
            assertEquals(test.Expiry, PRODUCT.Expiry);
            assertEquals(test.ExpiryDate, PRODUCT.ExpiryDate);
            assertEquals(test.Rounding, PRODUCT.Rounding);
            assertEquals(test.UnderlyingFuture, PRODUCT.UnderlyingFuture.resolve(REF_DATA));
            assertEquals(test.Index, PRODUCT.UnderlyingFuture.Index);
        }
示例#8
0
 public virtual void test_builder_expiryNotAfterTradeDate()
 {
     assertThrowsIllegalArg(() => ResolvedIborFutureOption.builder().securityId(PRODUCT.SecurityId).putCall(CALL).expiry(PRODUCT.UnderlyingFuture.LastTradeDate.plusDays(1).atStartOfDay(ZoneOffset.UTC)).strikePrice(PRODUCT.StrikePrice).underlyingFuture(PRODUCT.UnderlyingFuture.resolve(REF_DATA)).build());
 }
        public ResolvedIborFutureOptionTrade resolve(ReferenceData refData)
        {
            ResolvedIborFutureOption resolved = product.resolve(refData);

            return(new ResolvedIborFutureOptionTrade(info, resolved, Quantity, null));
        }
 /// <summary>
 /// Sets the option 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(ResolvedIborFutureOption product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }