//------------------------------------------------------------------------- public virtual void test_builder_noDeliveryDate() { ResolvedBondFuture @base = sut(); ResolvedBondFuture test = ResolvedBondFuture.builder().securityId(@base.SecurityId).deliveryBasket(@base.DeliveryBasket).conversionFactors(@base.ConversionFactors).firstNoticeDate(@base.FirstNoticeDate).lastNoticeDate(@base.LastNoticeDate).firstDeliveryDate(@base.FirstDeliveryDate).lastDeliveryDate(@base.LastDeliveryDate).lastTradeDate(@base.LastTradeDate).rounding(@base.Rounding).build(); assertEquals(test, @base); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ResolvedBondFutureTrade beanToCopy) { this.info_Renamed = beanToCopy.Info; this.product_Renamed = beanToCopy.Product; this.quantity_Renamed = beanToCopy.Quantity; this.tradedPrice_Renamed = beanToCopy.tradedPrice; }
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 = (ResolvedBondFuture)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> /// 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 ResolvedBondFutureTrade(PortfolioItemInfo info, ResolvedBondFuture 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; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ResolvedBondFutureOption beanToCopy) { this.securityId_Renamed = beanToCopy.SecurityId; this.putCall_Renamed = beanToCopy.PutCall; this.strikePrice_Renamed = beanToCopy.StrikePrice; this.expiry_Renamed = beanToCopy.Expiry; this.premiumStyle_Renamed = beanToCopy.PremiumStyle; this.rounding_Renamed = beanToCopy.Rounding; this.underlyingFuture_Renamed = beanToCopy.UnderlyingFuture; }
public ResolvedBondFutureTrade resolve(ReferenceData refData) { if (!info.TradeDate.Present) { throw new System.ArgumentException("Trade date on TradeInfo must be present"); } ResolvedBondFuture resolved = Product.resolve(refData); TradedPrice tradedPrice = TradedPrice.of(info.TradeDate.get(), price); return(new ResolvedBondFutureTrade(info, resolved, quantity, tradedPrice)); }
/// <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="expiry"> 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 ResolvedBondFutureOption(SecurityId securityId, PutCall putCall, double strikePrice, ZonedDateTime expiry, FutureOptionPremiumStyle premiumStyle, Rounding rounding, ResolvedBondFuture underlyingFuture) { JodaBeanUtils.notNull(securityId, "securityId"); JodaBeanUtils.notNull(expiry, "expiry"); JodaBeanUtils.notNull(premiumStyle, "premiumStyle"); JodaBeanUtils.notNull(rounding, "rounding"); JodaBeanUtils.notNull(underlyingFuture, "underlyingFuture"); this.securityId = securityId; this.putCall = putCall; this.strikePrice = strikePrice; this.expiry = expiry; this.premiumStyle = premiumStyle; this.rounding = rounding; this.underlyingFuture = underlyingFuture; validate(); }
public virtual void test_builder_fail() { ResolvedBondFuture @base = sut(); // wrong size assertThrowsIllegalArg(() => ResolvedBondFuture.builder().securityId(@base.SecurityId).deliveryBasket(@base.DeliveryBasket.subList(0, 1)).conversionFactors(@base.ConversionFactors).firstNoticeDate(@base.FirstNoticeDate).lastNoticeDate(@base.LastNoticeDate).lastTradeDate(@base.LastTradeDate).build()); // first notice date missing assertThrowsIllegalArg(() => ResolvedBondFuture.builder().securityId(@base.SecurityId).deliveryBasket(@base.DeliveryBasket).conversionFactors(@base.ConversionFactors).lastNoticeDate(@base.LastNoticeDate).lastTradeDate(@base.LastTradeDate).build()); // last notice date missing assertThrowsIllegalArg(() => ResolvedBondFuture.builder().securityId(@base.SecurityId).deliveryBasket(@base.DeliveryBasket).conversionFactors(@base.ConversionFactors).firstNoticeDate(@base.FirstNoticeDate).lastTradeDate(@base.LastTradeDate).build()); // basket list empty assertThrowsIllegalArg(() => ResolvedBondFuture.builder().securityId(@base.SecurityId).firstNoticeDate(@base.FirstNoticeDate).lastNoticeDate(@base.LastNoticeDate).lastTradeDate(@base.LastTradeDate).build()); // notional mismatch ResolvedFixedCouponBond bond0 = @base.DeliveryBasket.get(0); ResolvedFixedCouponBond bond1 = bond0.toBuilder().nominalPayment(Payment.of(USD, 100, date(2016, 6, 30))).build(); assertThrowsIllegalArg(() => ResolvedBondFuture.builder().securityId(@base.SecurityId).deliveryBasket(bond0, bond1).conversionFactors(1d, 2d).firstNoticeDate(@base.FirstNoticeDate).firstDeliveryDate(@base.FirstDeliveryDate).lastNoticeDate(@base.LastNoticeDate).lastDeliveryDate(@base.LastDeliveryDate).lastTradeDate(@base.LastTradeDate).rounding(@base.Rounding).build()); }
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 -1289159373: // expiry this.expiry_Renamed = (ZonedDateTime)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 = (ResolvedBondFuture)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
//------------------------------------------------------------------------- public ResolvedBondFutureOption resolve(ReferenceData refData) { ResolvedBondFuture resolved = underlyingFuture.resolve(refData); return(new ResolvedBondFutureOption(securityId, putCall, strikePrice, Expiry, premiumStyle, rounding, resolved)); }
//------------------------------------------------------------------------- public virtual void test_resolve() { ResolvedBondFuture expected = ResolvedBondFuture.builder().securityId(SECURITY_ID).deliveryBasket(RESOLVED_BASKET).conversionFactors(CONVERSION_FACTOR).lastTradeDate(LAST_TRADING_DATE).firstNoticeDate(FIRST_NOTICE_DATE).lastNoticeDate(LAST_NOTICE_DATE).firstDeliveryDate(FIRST_DELIVERY_DATE).lastDeliveryDate(LAST_DELIVERY_DATE).rounding(ROUNDING).build(); assertEquals(sut().resolve(REF_DATA), expected); }
public ResolvedBondFutureTrade resolve(ReferenceData refData) { ResolvedBondFuture resolved = product.resolve(refData); return(new ResolvedBondFutureTrade(info, resolved, Quantity, null)); }
/// <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(ResolvedBondFuture 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(ResolvedBondFuture underlyingFuture) { JodaBeanUtils.notNull(underlyingFuture, "underlyingFuture"); this.underlyingFuture_Renamed = underlyingFuture; return(this); }