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 = (IborFutureOption)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); }
//------------------------------------------------------------------------- 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); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(IborFutureOptionPosition beanToCopy) { this.info_Renamed = beanToCopy.Info; this.product_Renamed = beanToCopy.Product; this.longQuantity_Renamed = beanToCopy.LongQuantity; this.shortQuantity_Renamed = beanToCopy.ShortQuantity; }
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 = (IborFutureOption)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); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(IborFutureOptionTrade beanToCopy) { this.info_Renamed = beanToCopy.Info; this.product_Renamed = beanToCopy.Product; this.quantity_Renamed = beanToCopy.Quantity; this.price_Renamed = beanToCopy.Price; }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { IborFutureOption other = (IborFutureOption)obj; return(JodaBeanUtils.equal(securityId, other.securityId) && JodaBeanUtils.equal(putCall, other.putCall) && JodaBeanUtils.equal(strikePrice, other.strikePrice) && JodaBeanUtils.equal(expiryDate, other.expiryDate) && JodaBeanUtils.equal(expiryTime, other.expiryTime) && JodaBeanUtils.equal(expiryZone, other.expiryZone) && JodaBeanUtils.equal(premiumStyle, other.premiumStyle) && JodaBeanUtils.equal(rounding, other.rounding) && JodaBeanUtils.equal(underlyingFuture, other.underlyingFuture)); } return(false); }
//------------------------------------------------------------------------- public virtual void test_builder() { IborFutureOption test = sut(); assertEquals(test.PutCall, CALL); assertEquals(test.StrikePrice, STRIKE_PRICE); assertEquals(test.ExpiryDate, EXPIRY_DATE); assertEquals(test.ExpiryTime, EXPIRY_TIME); assertEquals(test.ExpiryZone, EXPIRY_ZONE); assertEquals(test.Expiry, ZonedDateTime.of(EXPIRY_DATE, EXPIRY_TIME, EXPIRY_ZONE)); assertEquals(test.Rounding, Rounding.none()); assertEquals(test.UnderlyingFuture, FUTURE); assertEquals(test.Currency, FUTURE.Currency); assertEquals(test.Index, FUTURE.Index); assertEquals(test.CrossCurrency, false); assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(USD)); assertEquals(test.allCurrencies(), ImmutableSet.of(USD)); }
public virtual void test_builder_expiryNotAfterTradeDate() { assertThrowsIllegalArg(() => IborFutureOption.builder().securityId(SECURITY_ID).putCall(CALL).expiryDate(LAST_TRADE_DATE).expiryTime(EXPIRY_TIME).expiryZone(EXPIRY_ZONE).strikePrice(STRIKE_PRICE).underlyingFuture(FUTURE).build()); }
internal static IborFutureOption sut2() { return(IborFutureOption.builder().securityId(SECURITY_ID2).putCall(PUT).strikePrice(STRIKE_PRICE + 0.001).expiryDate(EXPIRY_DATE.plusDays(1)).expiryTime(LocalTime.of(12, 0)).expiryZone(ZoneId.of("Europe/Paris")).premiumStyle(FutureOptionPremiumStyle.UPFRONT_PREMIUM).rounding(ROUNDING).underlyingFuture(FUTURE2).build()); }
//------------------------------------------------------------------------- internal static IborFutureOption sut() { return(IborFutureOption.builder().securityId(SECURITY_ID).putCall(CALL).strikePrice(STRIKE_PRICE).expiryDate(EXPIRY_DATE).expiryTime(EXPIRY_TIME).expiryZone(EXPIRY_ZONE).premiumStyle(FutureOptionPremiumStyle.DAILY_MARGIN).underlyingFuture(FUTURE).build()); }
/// <summary> /// Sets the option 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(IborFutureOption product) { JodaBeanUtils.notNull(product, "product"); this.product_Renamed = product; return(this); }