Class PaymentSchedule
- java.lang.Object
-
- com.opengamma.strata.product.swap.PaymentSchedule
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class PaymentSchedule extends Object implements org.joda.beans.ImmutableBean, Serializable
Defines the schedule of payment dates relative to the accrual periods.This defines the data necessary to create a schedule of payment periods. Each payment period contains one or more accrual periods. If a payment period contains more than one accrual period then the compounding method will be used to combine the amounts.
This class defines payment periods using a periodic frequency. The frequency must match or be a multiple of the accrual periodic frequency.
If the payment frequency is 'Term' then there is only one payment. As such, a 'Term' payment frequency causes stubs to be treated solely as accrual periods. In all other cases, stubs are treated as payment periods in their own right.
When applying the frequency, it is converted into an integer value, representing the number of accrual periods per payment period. The accrual periods are allocated by rolling forwards or backwards, applying the same direction as accrual schedule generation.
A different business day adjustment may be specified for the payment schedule to that used for the accrual schedule. When resolving the swap, the adjustment will be applied as part of the process that creates the payment date. Note that the start and end dates of the payment period, as defined by the payment schedule, cannot be observed on the resulting
RatePaymentPeriod
instance.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PaymentSchedule.Builder
The bean-builder forPaymentSchedule
.static class
PaymentSchedule.Meta
The meta-bean forPaymentSchedule
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PaymentSchedule.Builder
builder()
Returns a builder used to create an instance of the bean.Schedule
createSchedule(Schedule accrualSchedule, ReferenceData refData)
Creates the payment schedule based on the accrual schedule.boolean
equals(Object obj)
Optional<BusinessDayAdjustment>
getBusinessDayAdjustment()
Gets the business day adjustment to apply, optional.CompoundingMethod
getCompoundingMethod()
Gets the compounding method to use when there is more than one accrual period, defaulted to 'None'.Optional<LocalDate>
getFirstRegularStartDate()
Gets the optional start date of the first regular payment schedule period, which is the end date of the initial stub.Optional<LocalDate>
getLastRegularEndDate()
Gets the optional end date of the last regular payment schedule period, which is the start date of the final stub.DaysAdjustment
getPaymentDateOffset()
Gets the offset of payment from the base calculation period date.Frequency
getPaymentFrequency()
Gets the periodic frequency of payments.PaymentRelativeTo
getPaymentRelativeTo()
Gets the base date that each payment is made relative to, defaulted to 'PeriodEnd'.int
hashCode()
static PaymentSchedule.Meta
meta()
The meta-bean forPaymentSchedule
.PaymentSchedule.Meta
metaBean()
PaymentSchedule.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
-
-
Method Detail
-
createSchedule
public Schedule createSchedule(Schedule accrualSchedule, ReferenceData refData)
Creates the payment schedule based on the accrual schedule.If the payment frequency matches the accrual frequency, or if there is only one period in the accrual schedule, the input schedule is returned.
Only the regular part of the accrual schedule is grouped into payment periods. Any initial or final stub will be returned unaltered in the new schedule.
The grouping is determined by rolling forwards or backwards through the regular accrual periods Rolling is backwards if there is an initial stub, otherwise rolling is forwards. Grouping involves merging the existing accrual periods, thus the roll convention of the accrual periods is implicitly applied.
- Parameters:
accrualSchedule
- the accrual schedulerefData
- the reference data to use when resolving- Returns:
- the payment schedule
- Throws:
ReferenceDataNotFoundException
- if an identifier cannot be resolved in the reference dataIllegalArgumentException
- if the accrual frequency does not divide evenly into the payment frequency
-
meta
public static PaymentSchedule.Meta meta()
The meta-bean forPaymentSchedule
.- Returns:
- the meta-bean, not null
-
builder
public static PaymentSchedule.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public PaymentSchedule.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getPaymentFrequency
public Frequency getPaymentFrequency()
Gets the periodic frequency of payments.Regular payments will be made at the specified periodic frequency. The frequency must be the same as, or a multiple of, the accrual periodic frequency.
Compounding applies if the payment frequency does not equal the accrual frequency.
- Returns:
- the value of the property, not null
-
getBusinessDayAdjustment
public Optional<BusinessDayAdjustment> getBusinessDayAdjustment()
Gets the business day adjustment to apply, optional.Each date in the calculated schedule is determined relative to the accrual schedule. Normally, the accrual schedule is adjusted ensuring each date is not a holiday. As such, there is typically no reason to adjust the date before applying the payment date offset.
If the accrual dates are unadjusted, or for some other reason, it may be desirable to adjust the schedule dates before applying the payment date offset. This optional property allows that to happen. Note that the payment date offset itself provides the ability to adjust dates after the offset is applied.
- Returns:
- the optional value of the property, not null
-
getPaymentRelativeTo
public PaymentRelativeTo getPaymentRelativeTo()
Gets the base date that each payment is made relative to, defaulted to 'PeriodEnd'.The payment date is relative to either the start or end of the payment period.
- Returns:
- the value of the property, not null
-
getPaymentDateOffset
public DaysAdjustment getPaymentDateOffset()
Gets the offset of payment from the base calculation period date.The offset is applied to the unadjusted date specified by
paymentRelativeTo
. Offset can be based on calendar days or business days.- Returns:
- the value of the property, not null
-
getCompoundingMethod
public CompoundingMethod getCompoundingMethod()
Gets the compounding method to use when there is more than one accrual period, defaulted to 'None'.Compounding is used when combining accrual periods.
- Returns:
- the value of the property, not null
-
getFirstRegularStartDate
public Optional<LocalDate> getFirstRegularStartDate()
Gets the optional start date of the first regular payment schedule period, which is the end date of the initial stub.This is used to identify the boundary date between the initial stub and the first regular period. In most cases there is no need to specify this as it can be worked out from other information. It must be used when there is a need to produce a payment schedule with an initial stub that combines an initial stub from the accrual schedule with the first regular period of the accrual schedule.
This is an unadjusted date, and as such it might not be a valid business day. It must equal one of the unadjusted dates on the accrual schedule.
If paymentRelativeTo is 'PeriodEnd' then this field corresponds to
firstPaymentDate
in FpML.- Returns:
- the optional value of the property, not null
-
getLastRegularEndDate
public Optional<LocalDate> getLastRegularEndDate()
Gets the optional end date of the last regular payment schedule period, which is the start date of the final stub.This is used to identify the boundary date between the last regular period and the final stub. In most cases there is no need to specify this as it can be worked out from other information. It must be used when there is a need to produce a payment schedule with a final stub that combines a final stub from the accrual schedule with the last regular period of the accrual schedule.
This is used to identify the boundary date between the last regular schedule period and the final stub.
This is an unadjusted date, and as such it might not be a valid business day. This date must be after 'firstPaymentDate'. It must equal one of the unadjusted dates on the accrual schedule.
If paymentRelativeTo is 'PeriodEnd' then this field corresponds to
lastRegularPaymentDate
in FpML.- Returns:
- the optional value of the property, not null
-
toBuilder
public PaymentSchedule.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-