//------------------------------------------------------------------------- // build conventions private static OvernightIborSwapConvention makeConvention(string name, OvernightIndex onIndex, IborIndex iborIndex, DayCount dayCount, Frequency frequency, int paymentLag, int cutOffDays, OvernightAccrualMethod accrual) { HolidayCalendarId calendarOn = onIndex.FixingCalendar; DaysAdjustment paymentDateOffset = DaysAdjustment.ofBusinessDays(paymentLag, calendarOn); return(ImmutableOvernightIborSwapConvention.of(name, OvernightRateSwapLegConvention.builder().index(onIndex).accrualMethod(accrual).accrualFrequency(frequency).paymentFrequency(frequency).paymentDateOffset(paymentDateOffset).stubConvention(StubConvention.SMART_INITIAL).rateCutOffDays(cutOffDays).build(), IborRateSwapLegConvention.of(iborIndex))); }
public virtual void test_builder() { ImmutableOvernightIborSwapConvention test = ImmutableOvernightIborSwapConvention.builder().name(NAME).overnightLeg(FFUND_LEG).iborLeg(USD_LIBOR_3M_LEG).spotDateOffset(PLUS_ONE_DAY).build(); assertEquals(test.Name, NAME); assertEquals(test.OvernightLeg, FFUND_LEG); assertEquals(test.IborLeg, USD_LIBOR_3M_LEG); assertEquals(test.SpotDateOffset, PLUS_ONE_DAY); }
//------------------------------------------------------------------------- public virtual void test_of() { ImmutableOvernightIborSwapConvention test = ImmutableOvernightIborSwapConvention.of(NAME, FFUND_LEG, USD_LIBOR_3M_LEG, PLUS_TWO_DAYS); assertEquals(test.Name, NAME); assertEquals(test.OvernightLeg, FFUND_LEG); assertEquals(test.IborLeg, USD_LIBOR_3M_LEG); assertEquals(test.SpotDateOffset, PLUS_TWO_DAYS); }
//------------------------------------------------------------------------- public virtual void test_toTrade_tenor() { OvernightIborSwapConvention @base = ImmutableOvernightIborSwapConvention.of(NAME, FFUND_LEG, USD_LIBOR_3M_LEG, PLUS_TWO_DAYS); LocalDate tradeDate = LocalDate.of(2015, 5, 5); LocalDate startDate = date(2015, 5, 7); LocalDate endDate = date(2025, 5, 7); SwapTrade test = @base.createTrade(tradeDate, TENOR_10Y, BUY, NOTIONAL_2M, 0.25d, REF_DATA); Swap expected = Swap.of(FFUND_LEG.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), USD_LIBOR_3M_LEG.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M)); assertEquals(test.Info.TradeDate, tradeDate); assertEquals(test.Product, expected); }
//------------------------------------------------------------------------- public virtual void coverage() { ImmutableOvernightIborSwapConvention test = ImmutableOvernightIborSwapConvention.of(NAME, FFUND_LEG, USD_LIBOR_3M_LEG, PLUS_TWO_DAYS); coverImmutableBean(test); ImmutableOvernightIborSwapConvention test2 = ImmutableOvernightIborSwapConvention.of("GBP-Swap", FLOATING_LEG2, GBP_LIBOR_3M_LEG, PLUS_ONE_DAY); coverBeanEquals(test, test2); ImmutableOvernightIborSwapConvention test3 = ImmutableOvernightIborSwapConvention.of("USD-Swap2", FFUND_LEG2, USD_LIBOR_3M_LEG, PLUS_ONE_DAY); coverBeanEquals(test, test3); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { ImmutableOvernightIborSwapConvention other = (ImmutableOvernightIborSwapConvention)obj; return(JodaBeanUtils.equal(name, other.name) && JodaBeanUtils.equal(overnightLeg, other.overnightLeg) && JodaBeanUtils.equal(iborLeg, other.iborLeg) && JodaBeanUtils.equal(spotDateOffset, other.spotDateOffset)); } return(false); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "spotLag") public void test_spot_lag(ImmutableOvernightIborSwapConvention convention, int lag) public virtual void test_spot_lag(ImmutableOvernightIborSwapConvention convention, int lag) { assertEquals(convention.SpotDateOffset.Days, lag); assertEquals(convention.SpotDateOffset, convention.IborLeg.Index.EffectiveDateOffset); }
public virtual void test_serialization() { ImmutableOvernightIborSwapConvention test = ImmutableOvernightIborSwapConvention.of(NAME, FFUND_LEG, USD_LIBOR_3M_LEG, PLUS_TWO_DAYS); assertSerialization(test); }