/// <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; }
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 override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case 1302781851: // spreadLeg this.spreadLeg_Renamed = (FixedRateSwapLegConvention)newValue; break; case -1969210187: // spreadFloatingLeg this.spreadFloatingLeg_Renamed = (IborRateSwapLegConvention)newValue; break; case 274878191: // flatFloatingLeg this.flatFloatingLeg_Renamed = (IborRateSwapLegConvention)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
//------------------------------------------------------------------------- // 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)); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableThreeLegBasisSwapConvention beanToCopy) { this.name_Renamed = beanToCopy.Name; this.spreadLeg_Renamed = beanToCopy.SpreadLeg; this.spreadFloatingLeg_Renamed = beanToCopy.SpreadFloatingLeg; this.flatFloatingLeg_Renamed = beanToCopy.FlatFloatingLeg; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
//------------------------------------------------------------------------- public virtual void coverage() { FixedRateSwapLegConvention test = FixedRateSwapLegConvention.of(GBP, ACT_365F, P3M, BDA_MOD_FOLLOW); coverImmutableBean(test); FixedRateSwapLegConvention test2 = FixedRateSwapLegConvention.builder().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() { FixedRateSwapLegConvention @base = FixedRateSwapLegConvention.of(GBP, ACT_365F, P3M, BDA_MOD_FOLLOW); 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(P3M).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).stubConvention(StubConvention.SMART_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(FixedRateCalculation.of(0.25d, ACT_365F)).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 ImmutableThreeLegBasisSwapConvention(string name, FixedRateSwapLegConvention spreadLeg, IborRateSwapLegConvention spreadFloatingLeg, IborRateSwapLegConvention flatFloatingLeg, DaysAdjustment spotDateOffset) { JodaBeanUtils.notNull(name, "name"); JodaBeanUtils.notNull(spreadLeg, "spreadLeg"); JodaBeanUtils.notNull(spreadFloatingLeg, "spreadFloatingLeg"); JodaBeanUtils.notNull(flatFloatingLeg, "flatFloatingLeg"); JodaBeanUtils.notNull(spotDateOffset, "spotDateOffset"); this.name = name; this.spreadLeg = spreadLeg; this.spreadFloatingLeg = spreadFloatingLeg; this.flatFloatingLeg = flatFloatingLeg; this.spotDateOffset = spotDateOffset; validate(); }
public virtual void test_builder() { FixedRateSwapLegConvention test = FixedRateSwapLegConvention.builder().currency(GBP).dayCount(ACT_365F).accrualFrequency(P3M).accrualBusinessDayAdjustment(BDA_MOD_FOLLOW).build(); assertEquals(test.Currency, GBP); assertEquals(test.DayCount, ACT_365F); assertEquals(test.AccrualFrequency, P3M); 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, P3M); assertEquals(test.PaymentDateOffset, DaysAdjustment.NONE); assertEquals(test.CompoundingMethod, CompoundingMethod.NONE); }
public virtual void test_builderAllSpecified() { FixedRateSwapLegConvention test = FixedRateSwapLegConvention.builder().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.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_serialization() { FixedRateSwapLegConvention test = FixedRateSwapLegConvention.of(GBP, ACT_365F, P3M, BDA_MOD_FOLLOW); 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. /// /// </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)); }
/// <summary> /// Sets the market convention of the fixed leg. </summary> /// <param name="fixedLeg"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder fixedLeg(FixedRateSwapLegConvention fixedLeg) { JodaBeanUtils.notNull(fixedLeg, "fixedLeg"); this.fixedLeg_Renamed = fixedLeg; return(this); }
//------------------------------------------------------------------------- public virtual void test_builder_notEnoughData() { assertThrowsIllegalArg(() => FixedRateSwapLegConvention.builder().build()); }
/// <summary> /// Sets the market convention of the fixed leg for the spread. /// <para> /// This is to be applied to {@code floatingSpreadLeg}. /// </para> /// </summary> /// <param name="spreadLeg"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder spreadLeg(FixedRateSwapLegConvention spreadLeg) { JodaBeanUtils.notNull(spreadLeg, "spreadLeg"); this.spreadLeg_Renamed = spreadLeg; 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> /// <para> /// The spread is represented by {@code FixedRateSwapLegConvention} and to be applied to {@code floatingSpreadLeg}. /// /// </para> /// </summary> /// <param name="name"> the unique name of the convention </param> /// <param name="spreadLeg"> the market convention for the spread leg added to one of the floating leg </param> /// <param name="spreadFloatingLeg"> the market convention for the spread floating leg </param> /// <param name="flatFloatingLeg"> the market convention for the flat floating leg </param> /// <param name="spotDateOffset"> the offset of the spot value date from the trade date </param> /// <returns> the convention </returns> public static ImmutableThreeLegBasisSwapConvention of(string name, FixedRateSwapLegConvention spreadLeg, IborRateSwapLegConvention spreadFloatingLeg, IborRateSwapLegConvention flatFloatingLeg, DaysAdjustment spotDateOffset) { return(new ImmutableThreeLegBasisSwapConvention(name, spreadLeg, spreadFloatingLeg, flatFloatingLeg, spotDateOffset)); }
//------------------------------------------------------------------------- /// <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 index of the spread floating leg. /// </para> /// <para> /// The spread is represented by {@code FixedRateSwapLegConvention} and to be applied to {@code floatingSpreadLeg}. /// /// </para> /// </summary> /// <param name="name"> the unique name of the convention </param> /// <param name="spreadLeg"> the market convention for the spread leg added to one of the floating leg </param> /// <param name="spreadFloatingLeg"> the market convention for the spread floating leg </param> /// <param name="flatFloatingLeg"> the market convention for the flat floating leg </param> /// <returns> the convention </returns> public static ImmutableThreeLegBasisSwapConvention of(string name, FixedRateSwapLegConvention spreadLeg, IborRateSwapLegConvention spreadFloatingLeg, IborRateSwapLegConvention flatFloatingLeg) { return(of(name, spreadLeg, spreadFloatingLeg, flatFloatingLeg, spreadFloatingLeg.Index.EffectiveDateOffset)); }
// Create a zero-coupon fixed leg convention private static FixedRateSwapLegConvention fixedLegZcConvention(Currency ccy, HolidayCalendarId cal) { return(FixedRateSwapLegConvention.builder().paymentFrequency(Frequency.TERM).accrualFrequency(Frequency.P12M).accrualBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, cal)).startDateBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, cal)).endDateBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, cal)).compoundingMethod(CompoundingMethod.STRAIGHT).dayCount(ONE_ONE).currency(ccy).build()); }
//------------------------------------------------------------------------- /// <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 index. /// /// </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> /// <returns> the convention </returns> public static ImmutableFixedIborSwapConvention of(string name, FixedRateSwapLegConvention fixedLeg, IborRateSwapLegConvention floatingLeg) { return(of(name, fixedLeg, floatingLeg, floatingLeg.Index.EffectiveDateOffset)); }