//------------------------------------------------------------------------- //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @DataProvider(name = "name") public static Object[][] data_name() public static object[][] data_name() { return(new object[][] { new object[] { ImmutableIborFixingDepositConvention.of(GBP_LIBOR_3M), "GBP-LIBOR-3M" }, new object[] { ImmutableIborFixingDepositConvention.of(USD_LIBOR_3M), "USD-LIBOR-3M" } }); }
public virtual void test_of_indexOnly() { ImmutableIborFixingDepositConvention test = ImmutableIborFixingDepositConvention.of(GBP_LIBOR_6M); assertEquals(test.BusinessDayAdjustment, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBP_LIBOR_6M.FixingCalendar)); assertEquals(test.Currency, GBP_LIBOR_6M.Currency); assertEquals(test.DayCount, GBP_LIBOR_6M.DayCount); assertEquals(test.FixingDateOffset, GBP_LIBOR_6M.FixingDateOffset); assertEquals(test.Index, GBP_LIBOR_6M); assertEquals(test.SpotDateOffset, GBP_LIBOR_6M.EffectiveDateOffset); }
//------------------------------------------------------------------------- public virtual void test_builder_full() { ImmutableIborFixingDepositConvention test = ImmutableIborFixingDepositConvention.builder().name("Name").businessDayAdjustment(BDA_MOD_FOLLOW).currency(EUR).dayCount(ACT_365F).fixingDateOffset(FIXING_ADJ).index(EUR_LIBOR_3M).spotDateOffset(SPOT_ADJ).build(); assertEquals(test.Name, "Name"); assertEquals(test.BusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.Currency, EUR); assertEquals(test.DayCount, ACT_365F); assertEquals(test.FixingDateOffset, FIXING_ADJ); assertEquals(test.Index, EUR_LIBOR_3M); assertEquals(test.SpotDateOffset, SPOT_ADJ); }
//------------------------------------------------------------------------- public virtual void coverage() { ImmutableIborFixingDepositConvention test1 = ImmutableIborFixingDepositConvention.of(GBP_LIBOR_6M); coverImmutableBean(test1); ImmutableIborFixingDepositConvention test2 = ImmutableIborFixingDepositConvention.of(EUR_LIBOR_3M).toBuilder().name("Foo").build(); coverBeanEquals(test1, test2); coverPrivateConstructor(typeof(IborFixingDepositConventions)); coverPrivateConstructor(typeof(IborFixingDepositConventionLookup)); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { ImmutableIborFixingDepositConvention other = (ImmutableIborFixingDepositConvention)obj; return(JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(name, other.name) && JodaBeanUtils.equal(currency, other.currency) && JodaBeanUtils.equal(dayCount, other.dayCount) && JodaBeanUtils.equal(spotDateOffset, other.spotDateOffset) && JodaBeanUtils.equal(businessDayAdjustment, other.businessDayAdjustment) && JodaBeanUtils.equal(fixingDateOffset, other.fixingDateOffset)); } return(false); }
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_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); }
//------------------------------------------------------------------------- /// <summary> /// Obtains a convention based on the specified index. /// <para> /// The standard convention for an Ibor fixing deposit is based exclusively on the index. /// This creates an instance that contains the index. /// The instance is not dereferenced using the {@code FraConvention} name, as such /// the result of this method and <seealso cref="IborFixingDepositConvention#of(IborIndex)"/> can differ. /// </para> /// <para> /// Use the <seealso cref="#builder() builder"/> for unusual conventions. /// /// </para> /// </summary> /// <param name="index"> the index, the convention values are extracted from the index </param> /// <returns> the convention </returns> public static ImmutableIborFixingDepositConvention of(IborIndex index) { return(ImmutableIborFixingDepositConvention.builder().index(index).build()); }
public virtual void test_serialization() { ImmutableIborFixingDepositConvention test = ImmutableIborFixingDepositConvention.of(GBP_LIBOR_6M); assertSerialization(test); }
private static IborFixingDepositConvention createByName(string name) { return(IborIndex.extendedEnum().find(name).map(index => ImmutableIborFixingDepositConvention.of(index)).orElse(null)); }