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 = (IborRateSwapLegConvention)newValue;
                    break;

                case 746995843:         // spotDateOffset
                    this.spotDateOffset_Renamed = (DaysAdjustment)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Ejemplo n.º 2
0
            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);
            }
Ejemplo n.º 3
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ImmutableIborIborSwapConvention beanToCopy)
 {
     this.name_Renamed           = beanToCopy.Name;
     this.spreadLeg_Renamed      = beanToCopy.SpreadLeg;
     this.flatLeg_Renamed        = beanToCopy.FlatLeg;
     this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset;
 }
Ejemplo n.º 4
0
 /// <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;
 }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ImmutableFixedIborSwapConvention beanToCopy)
 {
     this.name_Renamed           = beanToCopy.Name;
     this.fixedLeg_Renamed       = beanToCopy.FixedLeg;
     this.floatingLeg_Renamed    = beanToCopy.FloatingLeg;
     this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset;
 }
Ejemplo n.º 6
0
            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 = (IborRateSwapLegConvention)newValue;
                    break;

                case -778843179:         // flatLeg
                    this.flatLeg_Renamed = (IborRateSwapLegConvention)newValue;
                    break;

                case 746995843:         // spotDateOffset
                    this.spotDateOffset_Renamed = (DaysAdjustment)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Ejemplo n.º 7
0
 /// <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()
        {
            IborRateSwapLegConvention test = IborRateSwapLegConvention.builder().index(GBP_LIBOR_3M).build();

            coverImmutableBean(test);
            IborRateSwapLegConvention test2 = IborRateSwapLegConvention.builder().index(GBP_LIBOR_3M).currency(USD).dayCount(ACT_360).accrualFrequency(P6M).accrualBusinessDayAdjustment(BDA_FOLLOW).startDateBusinessDayAdjustment(BDA_FOLLOW).endDateBusinessDayAdjustment(BDA_FOLLOW).stubConvention(LONG_INITIAL).rollConvention(RollConventions.EOM).fixingRelativeTo(PERIOD_END).fixingDateOffset(MINUS_FIVE_DAYS).paymentFrequency(P6M).paymentDateOffset(PLUS_TWO_DAYS).notionalExchange(true).build();

            coverBeanEquals(test, test2);
        }
        public virtual void test_toLeg_withSpread()
        {
            IborRateSwapLegConvention @base = IborRateSwapLegConvention.builder().index(GBP_LIBOR_3M).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(P3M).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(IborRateCalculation.builder().index(GBP_LIBOR_3M).spread(ValueSchedule.of(0.25d)).build()).build();

            assertEquals(test, expected);
        }
Ejemplo n.º 10
0
 private ImmutableIborIborSwapConvention(string name, IborRateSwapLegConvention spreadLeg, IborRateSwapLegConvention flatLeg, DaysAdjustment spotDateOffset)
 {
     JodaBeanUtils.notNull(name, "name");
     JodaBeanUtils.notNull(spreadLeg, "spreadLeg");
     JodaBeanUtils.notNull(flatLeg, "flatLeg");
     JodaBeanUtils.notNull(spotDateOffset, "spotDateOffset");
     this.name           = name;
     this.spreadLeg      = spreadLeg;
     this.flatLeg        = flatLeg;
     this.spotDateOffset = spotDateOffset;
     validate();
 }
Ejemplo n.º 11
0
 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_builder()
        {
            IborRateSwapLegConvention test = IborRateSwapLegConvention.builder().index(GBP_LIBOR_3M).build();

            assertEquals(test.Index, GBP_LIBOR_3M);
            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.FixingRelativeTo, PERIOD_START);
            assertEquals(test.FixingDateOffset, GBP_LIBOR_3M.FixingDateOffset);
            assertEquals(test.PaymentFrequency, P3M);
            assertEquals(test.PaymentDateOffset, DaysAdjustment.NONE);
            assertEquals(test.CompoundingMethod, CompoundingMethod.NONE);
            assertEquals(test.NotionalExchange, false);
        }
        public virtual void test_builderAllSpecified()
        {
            IborRateSwapLegConvention test = IborRateSwapLegConvention.builder().index(GBP_LIBOR_3M).currency(USD).dayCount(ACT_360).accrualFrequency(P6M).accrualBusinessDayAdjustment(BDA_FOLLOW).startDateBusinessDayAdjustment(BDA_FOLLOW).endDateBusinessDayAdjustment(BDA_FOLLOW).stubConvention(LONG_INITIAL).rollConvention(RollConventions.DAY_1).fixingRelativeTo(PERIOD_END).fixingDateOffset(MINUS_FIVE_DAYS).paymentFrequency(P6M).paymentDateOffset(PLUS_TWO_DAYS).compoundingMethod(CompoundingMethod.FLAT).notionalExchange(true).build();

            assertEquals(test.Index, GBP_LIBOR_3M);
            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.FixingRelativeTo, PERIOD_END);
            assertEquals(test.FixingDateOffset, MINUS_FIVE_DAYS);
            assertEquals(test.PaymentFrequency, P6M);
            assertEquals(test.PaymentDateOffset, PLUS_TWO_DAYS);
            assertEquals(test.CompoundingMethod, CompoundingMethod.FLAT);
            assertEquals(test.NotionalExchange, true);
        }
        public virtual void test_serialization()
        {
            IborRateSwapLegConvention test = IborRateSwapLegConvention.builder().index(GBP_LIBOR_3M).build();

            assertSerialization(test);
        }
Ejemplo n.º 15
0
 //-------------------------------------------------------------------------
 /// <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));
 }
Ejemplo n.º 16
0
 /// <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));
 }
Ejemplo n.º 17
0
 /// <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));
 }
Ejemplo n.º 18
0
 //-------------------------------------------------------------------------
 /// <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 leg.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the unique name of the convention </param>
 /// <param name="spreadLeg">  the market convention for the leg that the spread is added to </param>
 /// <param name="flatLeg">  the market convention for the other leg, known as the flat leg </param>
 /// <returns> the convention </returns>
 public static ImmutableIborIborSwapConvention of(string name, IborRateSwapLegConvention spreadLeg, IborRateSwapLegConvention flatLeg)
 {
     return(of(name, spreadLeg, flatLeg, spreadLeg.Index.EffectiveDateOffset));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Sets the market convention of the floating leg that does not have the spread applied. </summary>
 /// <param name="flatLeg">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder flatLeg(IborRateSwapLegConvention flatLeg)
 {
     JodaBeanUtils.notNull(flatLeg, "flatLeg");
     this.flatLeg_Renamed = flatLeg;
     return(this);
 }
Ejemplo n.º 20
0
 /// <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="spreadLeg">  the market convention for the leg that the spread is added to </param>
 /// <param name="flatLeg">  the market convention for the other leg, known as the flat leg </param>
 /// <param name="spotDateOffset">  the offset of the spot value date from the trade date </param>
 /// <returns> the convention </returns>
 public static ImmutableIborIborSwapConvention of(string name, IborRateSwapLegConvention spreadLeg, IborRateSwapLegConvention flatLeg, DaysAdjustment spotDateOffset)
 {
     return(new ImmutableIborIborSwapConvention(name, spreadLeg, flatLeg, 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.
 ///
 /// </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));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Sets the market convention of the floating leg. </summary>
 /// <param name="iborLeg">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder iborLeg(IborRateSwapLegConvention iborLeg)
 {
     JodaBeanUtils.notNull(iborLeg, "iborLeg");
     this.iborLeg_Renamed = iborLeg;
     return(this);
 }
Ejemplo n.º 23
0
 //-------------------------------------------------------------------------
 /// <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));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Sets the market convention of the floating leg that has the spread applied.
 /// <para>
 /// The spread is the market price of the instrument.
 /// It is added to the observed interest rate.
 /// </para>
 /// </summary>
 /// <param name="spreadLeg">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder spreadLeg(IborRateSwapLegConvention spreadLeg)
 {
     JodaBeanUtils.notNull(spreadLeg, "spreadLeg");
     this.spreadLeg_Renamed = spreadLeg;
     return(this);
 }
Ejemplo n.º 25
0
        //-------------------------------------------------------------------------
        // 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_notEnoughData()
 {
     assertThrowsIllegalArg(() => IborRateSwapLegConvention.builder().build());
 }
 /// <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 ImmutableFixedIborSwapConvention of(string name, FixedRateSwapLegConvention fixedLeg, IborRateSwapLegConvention floatingLeg, DaysAdjustment spotDateOffset)
 {
     return(new ImmutableFixedIborSwapConvention(name, fixedLeg, floatingLeg, spotDateOffset));
 }