/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableFixedOvernightSwapConvention beanToCopy) { this.name_Renamed = beanToCopy.Name; this.fixedLeg_Renamed = beanToCopy.FixedLeg; this.floatingLeg_Renamed = beanToCopy.FloatingLeg; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
//------------------------------------------------------------------------- // 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 override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case 1774606250: // overnightLeg this.overnightLeg_Renamed = (OvernightRateSwapLegConvention)newValue; break; case 1610246066: // iborLeg this.iborLeg_Renamed = (IborRateSwapLegConvention)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)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(ImmutableOvernightIborSwapConvention beanToCopy) { this.name_Renamed = beanToCopy.Name; this.overnightLeg_Renamed = beanToCopy.OvernightLeg; this.iborLeg_Renamed = beanToCopy.IborLeg; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case -391537158: // fixedLeg this.fixedLeg_Renamed = (FixedRateSwapLegConvention)newValue; break; case -1177101272: // floatingLeg this.floatingLeg_Renamed = (OvernightRateSwapLegConvention)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
//------------------------------------------------------------------------- public virtual void coverage() { OvernightRateSwapLegConvention test = OvernightRateSwapLegConvention.builder().index(GBP_SONIA).accrualMethod(COMPOUNDED).build(); coverImmutableBean(test); OvernightRateSwapLegConvention test2 = OvernightRateSwapLegConvention.builder().index(USD_FED_FUND).accrualMethod(AVERAGED).rateCutOffDays(2).currency(USD).dayCount(ACT_360).accrualFrequency(P6M).accrualBusinessDayAdjustment(BDA_FOLLOW).startDateBusinessDayAdjustment(BDA_FOLLOW).endDateBusinessDayAdjustment(BDA_FOLLOW).stubConvention(LONG_INITIAL).rollConvention(RollConventions.EOM).paymentFrequency(P6M).paymentDateOffset(PLUS_TWO_DAYS).build(); coverBeanEquals(test, test2); }
public virtual void test_toLeg_withSpread() { OvernightRateSwapLegConvention @base = OvernightRateSwapLegConvention.builder().index(GBP_SONIA).accrualMethod(AVERAGED).build(); LocalDate startDate = LocalDate.of(2015, 5, 5); LocalDate endDate = LocalDate.of(2020, 5, 5); RateCalculationSwapLeg test = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d); RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(TERM).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(TERM).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(OvernightRateCalculation.builder().index(GBP_SONIA).accrualMethod(AVERAGED).spread(ValueSchedule.of(0.25d)).build()).build(); assertEquals(test, expected); }
//------------------------------------------------------------------------- public virtual void test_toLeg() { OvernightRateSwapLegConvention @base = OvernightRateSwapLegConvention.of(GBP_SONIA, TERM, 2); LocalDate startDate = LocalDate.of(2015, 5, 5); LocalDate endDate = LocalDate.of(2020, 5, 5); RateCalculationSwapLeg test = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M); RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(TERM).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).stubConvention(StubConvention.SMART_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(TERM).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBP_SONIA.FixingCalendar)).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(OvernightRateCalculation.of(GBP_SONIA)).build(); assertEquals(test, expected); }
private ImmutableFixedOvernightSwapConvention(string name, FixedRateSwapLegConvention fixedLeg, OvernightRateSwapLegConvention floatingLeg, DaysAdjustment spotDateOffset) { JodaBeanUtils.notNull(name, "name"); JodaBeanUtils.notNull(fixedLeg, "fixedLeg"); JodaBeanUtils.notNull(floatingLeg, "floatingLeg"); JodaBeanUtils.notNull(spotDateOffset, "spotDateOffset"); this.name = name; this.fixedLeg = fixedLeg; this.floatingLeg = floatingLeg; this.spotDateOffset = spotDateOffset; validate(); }
private ImmutableOvernightIborSwapConvention(string name, OvernightRateSwapLegConvention overnightLeg, IborRateSwapLegConvention iborLeg, DaysAdjustment spotDateOffset) { JodaBeanUtils.notNull(name, "name"); JodaBeanUtils.notNull(overnightLeg, "overnightLeg"); JodaBeanUtils.notNull(iborLeg, "iborLeg"); JodaBeanUtils.notNull(spotDateOffset, "spotDateOffset"); this.name = name; this.overnightLeg = overnightLeg; this.iborLeg = iborLeg; this.spotDateOffset = spotDateOffset; validate(); }
public virtual void test_builderAllSpecified() { OvernightRateSwapLegConvention test = OvernightRateSwapLegConvention.builder().index(GBP_SONIA).accrualMethod(COMPOUNDED).rateCutOffDays(2).currency(USD).dayCount(ACT_360).accrualFrequency(P6M).accrualBusinessDayAdjustment(BDA_FOLLOW).startDateBusinessDayAdjustment(BDA_FOLLOW).endDateBusinessDayAdjustment(BDA_FOLLOW).stubConvention(LONG_INITIAL).rollConvention(RollConventions.DAY_1).paymentFrequency(P6M).paymentDateOffset(PLUS_TWO_DAYS).compoundingMethod(CompoundingMethod.FLAT).build(); assertEquals(test.Index, GBP_SONIA); assertEquals(test.AccrualMethod, COMPOUNDED); assertEquals(test.RateCutOffDays, 2); assertEquals(test.Currency, USD); assertEquals(test.DayCount, ACT_360); assertEquals(test.AccrualFrequency, P6M); assertEquals(test.AccrualBusinessDayAdjustment, BDA_FOLLOW); assertEquals(test.StartDateBusinessDayAdjustment, BDA_FOLLOW); assertEquals(test.EndDateBusinessDayAdjustment, BDA_FOLLOW); assertEquals(test.StubConvention, StubConvention.LONG_INITIAL); assertEquals(test.RollConvention, RollConventions.DAY_1); assertEquals(test.PaymentFrequency, P6M); assertEquals(test.PaymentDateOffset, PLUS_TWO_DAYS); assertEquals(test.CompoundingMethod, CompoundingMethod.FLAT); }
public virtual void test_of_method() { OvernightRateSwapLegConvention test = OvernightRateSwapLegConvention.of(GBP_SONIA, P12M, 2, AVERAGED); assertEquals(test.Index, GBP_SONIA); assertEquals(test.AccrualMethod, AVERAGED); assertEquals(test.RateCutOffDays, 0); assertEquals(test.Currency, GBP); assertEquals(test.DayCount, ACT_365F); assertEquals(test.AccrualFrequency, P12M); assertEquals(test.AccrualBusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.StartDateBusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.EndDateBusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.StubConvention, StubConvention.SMART_INITIAL); assertEquals(test.RollConvention, RollConventions.EOM); assertEquals(test.PaymentFrequency, P12M); assertEquals(test.PaymentDateOffset, DaysAdjustment.ofBusinessDays(2, GBP_SONIA.FixingCalendar)); assertEquals(test.CompoundingMethod, CompoundingMethod.NONE); }
public virtual void test_builder() { OvernightRateSwapLegConvention test = OvernightRateSwapLegConvention.builder().index(GBP_SONIA).build(); assertEquals(test.Index, GBP_SONIA); assertEquals(test.AccrualMethod, COMPOUNDED); assertEquals(test.RateCutOffDays, 0); assertEquals(test.Currency, GBP); assertEquals(test.DayCount, ACT_365F); assertEquals(test.AccrualFrequency, TERM); assertEquals(test.AccrualBusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.StartDateBusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.EndDateBusinessDayAdjustment, BDA_MOD_FOLLOW); assertEquals(test.StubConvention, StubConvention.SMART_INITIAL); assertEquals(test.RollConvention, RollConventions.EOM); assertEquals(test.PaymentFrequency, TERM); assertEquals(test.PaymentDateOffset, DaysAdjustment.NONE); assertEquals(test.CompoundingMethod, CompoundingMethod.NONE); }
/// <summary> /// Sets the market convention of the floating leg. </summary> /// <param name="overnightLeg"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder overnightLeg(OvernightRateSwapLegConvention overnightLeg) { JodaBeanUtils.notNull(overnightLeg, "overnightLeg"); this.overnightLeg_Renamed = overnightLeg; return(this); }
public virtual void test_serialization() { OvernightRateSwapLegConvention test = OvernightRateSwapLegConvention.of(GBP_SONIA, P12M, 2); assertSerialization(test); }
//------------------------------------------------------------------------- /// <summary> /// Obtains a convention based on the specified name and leg conventions. /// <para> /// The two leg conventions must be in the same currency. /// The spot date offset is set to be the effective date offset of the Ibor index. /// /// </para> /// </summary> /// <param name="name"> the unique name of the convention </param> /// <param name="overnightLeg"> the market convention for the overnight leg </param> /// <param name="iborLeg"> the market convention for the ibor leg </param> /// <returns> the convention </returns> public static ImmutableOvernightIborSwapConvention of(string name, OvernightRateSwapLegConvention overnightLeg, IborRateSwapLegConvention iborLeg) { return(new ImmutableOvernightIborSwapConvention(name, overnightLeg, iborLeg, iborLeg.Index.EffectiveDateOffset)); }
/// <summary> /// Sets the market convention of the floating leg. </summary> /// <param name="floatingLeg"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder floatingLeg(OvernightRateSwapLegConvention floatingLeg) { JodaBeanUtils.notNull(floatingLeg, "floatingLeg"); this.floatingLeg_Renamed = floatingLeg; return(this); }
/// <summary> /// Obtains a convention based on the specified name and leg conventions. /// <para> /// The two leg conventions must be in the same currency. /// /// </para> /// </summary> /// <param name="name"> the unique name of the convention </param> /// <param name="overnightLeg"> the market convention for the overnight leg </param> /// <param name="iborLeg"> the market convention for the ibor leg </param> /// <param name="spotDateOffset"> the offset of the spot value date from the trade date </param> /// <returns> the convention </returns> public static ImmutableOvernightIborSwapConvention of(string name, OvernightRateSwapLegConvention overnightLeg, IborRateSwapLegConvention iborLeg, DaysAdjustment spotDateOffset) { return(new ImmutableOvernightIborSwapConvention(name, overnightLeg, iborLeg, spotDateOffset)); }
//------------------------------------------------------------------------- /// <summary> /// Obtains a convention based on the specified name and leg conventions. /// <para> /// The two leg conventions must be in the same currency. /// /// </para> /// </summary> /// <param name="name"> the unique name of the convention </param> /// <param name="fixedLeg"> the market convention for the fixed leg </param> /// <param name="floatingLeg"> the market convention for the floating leg </param> /// <param name="spotDateOffset"> the offset of the spot value date from the trade date </param> /// <returns> the convention </returns> public static ImmutableFixedOvernightSwapConvention of(string name, FixedRateSwapLegConvention fixedLeg, OvernightRateSwapLegConvention floatingLeg, DaysAdjustment spotDateOffset) { return(new ImmutableFixedOvernightSwapConvention(name, fixedLeg, floatingLeg, spotDateOffset)); }
//------------------------------------------------------------------------- // build conventions private static FixedOvernightSwapConvention makeConvention(string name, OvernightIndex index, DayCount dayCount, Frequency frequency, int paymentLag, int spotLag) { HolidayCalendarId calendar = index.FixingCalendar; DaysAdjustment paymentDateOffset = DaysAdjustment.ofBusinessDays(paymentLag, calendar); DaysAdjustment spotDateOffset = DaysAdjustment.ofBusinessDays(spotLag, calendar); return(ImmutableFixedOvernightSwapConvention.of(name, FixedRateSwapLegConvention.builder().currency(index.Currency).dayCount(dayCount).accrualFrequency(frequency).accrualBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, calendar)).paymentFrequency(frequency).paymentDateOffset(paymentDateOffset).stubConvention(StubConvention.SMART_INITIAL).build(), OvernightRateSwapLegConvention.builder().index(index).accrualMethod(COMPOUNDED).accrualFrequency(frequency).paymentFrequency(frequency).paymentDateOffset(paymentDateOffset).stubConvention(StubConvention.SMART_INITIAL).build(), spotDateOffset)); }
//------------------------------------------------------------------------- public virtual void test_builder_notEnoughData() { assertThrowsIllegalArg(() => OvernightRateSwapLegConvention.builder().build()); }