private IborFixingDepositTrade(TradeInfo info, IborFixingDeposit product) { JodaBeanUtils.notNull(info, "info"); JodaBeanUtils.notNull(product, "product"); this.info = info; this.product = product; }
//------------------------------------------------------------------------- public virtual void coverage() { IborFixingDeposit test1 = IborFixingDeposit.builder().buySell(SELL).notional(NOTIONAL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).index(GBP_LIBOR_6M).fixedRate(RATE).build(); coverImmutableBean(test1); IborFixingDeposit test2 = IborFixingDeposit.builder().buySell(BuySell.BUY).notional(NOTIONAL).startDate(LocalDate.of(2015, 1, 19)).endDate(LocalDate.of(2015, 4, 19)).businessDayAdjustment(BDA_MOD_FOLLOW).index(GBP_LIBOR_3M).fixedRate(0.015).build(); coverBeanEquals(test1, test2); }
public IborFixingDepositTrade toTrade(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double fixedRate) { Optional <LocalDate> tradeDate = tradeInfo.TradeDate; if (tradeDate.Present) { ArgChecker.inOrderOrEqual(tradeDate.get(), startDate, "tradeDate", "startDate"); } return(IborFixingDepositTrade.builder().info(tradeInfo).product(IborFixingDeposit.builder().buySell(buySell).currency(Currency).notional(notional).startDate(startDate).endDate(endDate).businessDayAdjustment(BusinessDayAdjustment).fixedRate(fixedRate).index(index).fixingDateOffset(FixingDateOffset).dayCount(DayCount).build()).build()); }
public virtual void test_builder_minimum() { IborFixingDeposit test = IborFixingDeposit.builder().buySell(SELL).notional(NOTIONAL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).index(GBP_LIBOR_6M).fixedRate(RATE).build(); assertEquals(test.BusinessDayAdjustment.get(), BDA_MOD_FOLLOW); assertEquals(test.BuySell, SELL); assertEquals(test.FixingDateOffset, GBP_LIBOR_6M.FixingDateOffset); assertEquals(test.Notional, NOTIONAL); assertEquals(test.Currency, GBP); assertEquals(test.DayCount, ACT_365F); assertEquals(test.StartDate, START_DATE); assertEquals(test.EndDate, END_DATE); assertEquals(test.Index, GBP_LIBOR_6M); assertEquals(test.FixedRate, RATE); }
public virtual void test_createTrade() { IborFixingDepositTemplate template = IborFixingDepositTemplate.of(EUR_LIBOR_3M); double notional = 1d; double fixedRate = 0.045; LocalDate tradeDate = LocalDate.of(2015, 1, 22); IborFixingDepositTrade trade = template.createTrade(tradeDate, BUY, notional, fixedRate, REF_DATA); ImmutableIborFixingDepositConvention conv = (ImmutableIborFixingDepositConvention)template.Convention; LocalDate startExpected = conv.SpotDateOffset.adjust(tradeDate, REF_DATA); LocalDate endExpected = startExpected.plus(template.DepositPeriod); IborFixingDeposit productExpected = IborFixingDeposit.builder().businessDayAdjustment(conv.BusinessDayAdjustment).buySell(BUY).startDate(startExpected).endDate(endExpected).fixedRate(fixedRate).index(EUR_LIBOR_3M).notional(notional).build(); TradeInfo tradeInfoExpected = TradeInfo.builder().tradeDate(tradeDate).build(); assertEquals(trade.Info, tradeInfoExpected); assertEquals(trade.Product, productExpected); }
public virtual void test_trade() { IborFixingDepositCurveNode node = IborFixingDepositCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); LocalDate valuationDate = LocalDate.of(2015, 1, 22); double rate = 0.035; MarketData marketData = ImmutableMarketData.builder(valuationDate).addValue(QUOTE_ID, rate).build(); IborFixingDepositTrade trade = node.trade(1d, marketData, REF_DATA); ImmutableIborFixingDepositConvention conv = (ImmutableIborFixingDepositConvention)TEMPLATE.Convention; LocalDate startDateExpected = conv.SpotDateOffset.adjust(valuationDate, REF_DATA); LocalDate endDateExpected = startDateExpected.plus(TEMPLATE.DepositPeriod); IborFixingDeposit depositExpected = IborFixingDeposit.builder().buySell(BuySell.BUY).index(EUR_LIBOR_3M).startDate(startDateExpected).endDate(endDateExpected).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, EUR_LIBOR_3M.FixingCalendar)).notional(1.0d).fixedRate(rate + SPREAD).build(); TradeInfo tradeInfoExpected = TradeInfo.builder().tradeDate(valuationDate).build(); assertEquals(trade.Product, depositExpected); assertEquals(trade.Info, tradeInfoExpected); }
//------------------------------------------------------------------------- public virtual void test_resolve() { IborFixingDeposit @base = IborFixingDeposit.builder().buySell(SELL).notional(NOTIONAL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).index(GBP_LIBOR_6M).fixedRate(RATE).build(); ResolvedIborFixingDeposit test = @base.resolve(REF_DATA); LocalDate expectedEndDate = BDA_MOD_FOLLOW.adjust(END_DATE, REF_DATA); double expectedYearFraction = ACT_365F.yearFraction(START_DATE, expectedEndDate); IborRateComputation expectedObservation = IborRateComputation.of(GBP_LIBOR_6M, GBP_LIBOR_6M.FixingDateOffset.adjust(START_DATE, REF_DATA), REF_DATA); assertEquals(test.Currency, GBP); assertEquals(test.StartDate, START_DATE); assertEquals(test.EndDate, expectedEndDate); assertEquals(test.FloatingRate, expectedObservation); assertEquals(test.Notional, -NOTIONAL); assertEquals(test.FixedRate, RATE); assertEquals(test.YearFraction, expectedYearFraction); }
//------------------------------------------------------------------------- public virtual void test_toTrade() { IborFixingDepositConvention convention = ImmutableIborFixingDepositConvention.builder().businessDayAdjustment(BDA_MOD_FOLLOW).currency(EUR).dayCount(ACT_365F).fixingDateOffset(FIXING_ADJ).index(EUR_LIBOR_3M).spotDateOffset(SPOT_ADJ).build(); LocalDate tradeDate = LocalDate.of(2015, 1, 22); Period depositPeriod = Period.ofMonths(3); double notional = 1d; double fixedRate = 0.045; IborFixingDepositTrade trade = convention.createTrade(tradeDate, depositPeriod, BUY, notional, fixedRate, REF_DATA); LocalDate startExpected = SPOT_ADJ.adjust(tradeDate, REF_DATA); LocalDate endExpected = startExpected.plus(depositPeriod); IborFixingDeposit productExpected = IborFixingDeposit.builder().businessDayAdjustment(BDA_MOD_FOLLOW).buySell(BUY).currency(EUR).dayCount(ACT_365F).startDate(startExpected).endDate(endExpected).fixedRate(fixedRate).fixingDateOffset(FIXING_ADJ).index(EUR_LIBOR_3M).notional(notional).build(); TradeInfo tradeInfoExpected = TradeInfo.builder().tradeDate(tradeDate).build(); assertEquals(trade.Product, productExpected); assertEquals(trade.Info, tradeInfoExpected); }
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 = (IborFixingDeposit)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
//------------------------------------------------------------------------- public virtual void test_builder_full() { IborFixingDeposit test = IborFixingDeposit.builder().buySell(SELL).notional(NOTIONAL).currency(GBP).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).fixingDateOffset(DAY_ADJ).dayCount(ACT_365F).index(GBP_LIBOR_6M).fixedRate(RATE).build(); assertEquals(test.BusinessDayAdjustment.get(), BDA_MOD_FOLLOW); assertEquals(test.BuySell, SELL); assertEquals(test.FixingDateOffset, DAY_ADJ); assertEquals(test.Notional, NOTIONAL); assertEquals(test.Currency, GBP); assertEquals(test.DayCount, ACT_365F); assertEquals(test.StartDate, START_DATE); assertEquals(test.EndDate, END_DATE); assertEquals(test.Index, GBP_LIBOR_6M); assertEquals(test.FixedRate, RATE); assertEquals(test.CrossCurrency, false); assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(GBP)); assertEquals(test.allCurrencies(), ImmutableSet.of(GBP)); }
public virtual void test_builder_wrongDates() { assertThrowsIllegalArg(() => IborFixingDeposit.builder().buySell(SELL).notional(NOTIONAL).startDate(LocalDate.of(2015, 9, 19)).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).index(GBP_LIBOR_6M).fixedRate(RATE).build()); }
public virtual void test_serialization() { IborFixingDeposit test = IborFixingDeposit.builder().buySell(SELL).notional(NOTIONAL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).index(GBP_LIBOR_6M).fixedRate(RATE).build(); assertSerialization(test); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance of an Ibor Fixing Deposit trade. /// </summary> /// <param name="info"> the trade info </param> /// <param name="product"> the product </param> /// <returns> the trade </returns> public static IborFixingDepositTrade of(TradeInfo info, IborFixingDeposit product) { return(new IborFixingDepositTrade(info, product)); }
/// <summary> /// Sets the Ibor fixing deposit product that was agreed when the trade occurred. /// <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(IborFixingDeposit product) { JodaBeanUtils.notNull(product, "product"); this.product_Renamed = product; return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(IborFixingDepositTrade beanToCopy) { this.info_Renamed = beanToCopy.Info; this.product_Renamed = beanToCopy.Product; }