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 = (ResolvedDsf)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(ResolvedDsfTrade 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 ResolvedDsfTrade(PortfolioItemInfo info, ResolvedDsf 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; }
//------------------------------------------------------------------------- public virtual void test_builder() { ResolvedDsf test = sut(); assertEquals(test.DeliveryDate, DELIVERY_DATE); assertEquals(test.LastTradeDate, LAST_TRADE_DATE); assertEquals(test.Notional, NOTIONAL); assertEquals(test.Currency, USD); assertEquals(test.UnderlyingSwap, RSWAP); }
public virtual void test_builder_notUnitNotional() { SwapLeg fixedLeg10 = RateCalculationSwapLeg.builder().payReceive(RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2016, 9, 12)).frequency(P6M).businessDayAdjustment(BDA_MF).stubConvention(StubConvention.SHORT_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P6M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(USD, 10d)).calculation(FixedRateCalculation.builder().dayCount(THIRTY_U_360).rate(ValueSchedule.of(0.015)).build()).build(); SwapLeg iborLeg500 = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2016, 9, 12)).frequency(P1M).businessDayAdjustment(BDA_MF).stubConvention(StubConvention.SHORT_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.builder().currency(USD).amount(ValueSchedule.of(500d)).finalExchange(true).initialExchange(true).build()).calculation(IborRateCalculation.builder().index(INDEX).fixingDateOffset(DaysAdjustment.ofBusinessDays(-2, SAT_SUN, BDA_P)).build()).build(); Swap swap1 = Swap.of(fixedLeg10, SWAP.getLeg(PAY).get()); Swap swap2 = Swap.of(SWAP.getLeg(RECEIVE).get(), iborLeg500); assertThrowsIllegalArg(() => ResolvedDsf.builder().securityId(PRODUCT.SecurityId).notional(NOTIONAL).deliveryDate(DELIVERY_DATE).lastTradeDate(LAST_TRADE_DATE).underlyingSwap(swap1.resolve(REF_DATA)).build()); assertThrowsIllegalArg(() => ResolvedDsf.builder().securityId(PRODUCT.SecurityId).notional(NOTIONAL).deliveryDate(DELIVERY_DATE).lastTradeDate(LAST_TRADE_DATE).underlyingSwap(swap2.resolve(REF_DATA)).build()); }
public ResolvedDsfTrade resolve(ReferenceData refData) { if (!info.TradeDate.Present) { throw new System.ArgumentException("Trade date on TradeInfo must be present"); } ResolvedDsf resolved = Product.resolve(refData); TradedPrice tradedPrice = TradedPrice.of(info.TradeDate.get(), price); return(new ResolvedDsfTrade(info, resolved, quantity, tradedPrice)); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { ResolvedDsf other = (ResolvedDsf)obj; return(JodaBeanUtils.equal(securityId, other.securityId) && JodaBeanUtils.equal(notional, other.notional) && JodaBeanUtils.equal(deliveryDate, other.deliveryDate) && JodaBeanUtils.equal(lastTradeDate, other.lastTradeDate) && JodaBeanUtils.equal(underlyingSwap, other.underlyingSwap)); } return(false); }
public ResolvedDsfTrade resolve(ReferenceData refData) { ResolvedDsf resolved = product.resolve(refData); return(new ResolvedDsfTrade(info, resolved, Quantity, null)); }
public virtual void test_builder_tradeAfterdelivery() { assertThrowsIllegalArg(() => ResolvedDsf.builder().notional(NOTIONAL).deliveryDate(DELIVERY_DATE).lastTradeDate(LocalDate.of(2014, 9, 11)).underlyingSwap(RSWAP).build()); }
public virtual void test_builder_deliveryAfterStart() { assertThrowsIllegalArg(() => ResolvedDsf.builder().notional(NOTIONAL).deliveryDate(LocalDate.of(2014, 9, 19)).lastTradeDate(LAST_TRADE_DATE).underlyingSwap(RSWAP).build()); }
/// <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(ResolvedDsf product) { JodaBeanUtils.notNull(product, "product"); this.product_Renamed = product; return(this); }