public enum StubConvention extends Enum<StubConvention> implements NamedEnum
A periodic schedule is determined using a periodic frequency. This splits the schedule into "regular" periods of a fixed length, such as every 3 months. Any remaining days are allocated to irregular "stubs" at the start and/or end.
The stub convention is provided as a simple declarative mechanism to define stubs. The convention handles the case of no stubs, or a single stub at the start or end. If there is a stub at both the start and end, then explicit stub dates must be used.
For example, dividing a 24 month (2 year) swap into 3 month periods is easy as it splits exactly. However, a 23 month swap cannot be split into even 3 month periods. Instead, there will be a 2 month "initial" stub at the start, a 2 month "final" stub at the end or both an initial and final stub with a combined length of 2 months.
The 'ShortInitial', 'LongInitial' or 'SmartInitial' convention causes the regular periods to be determined backwards from the end date of the schedule, with remaining days allocated to the stub.
The 'ShortFinal', 'LongFinal' or 'SmartFinal' convention causes the regular periods to be determined forwards from the start date of the schedule, with remaining days allocated to the stub.
The 'None' convention may be used to explicitly indicate there are no stubs.
The 'Both' convention may be used to explicitly indicate there is both an initial and final stub. In this case, dates must be used to identify the stubs.
| Enum Constant and Description |
|---|
BOTH
Both ends of the schedule have a stub.
|
LONG_FINAL
A long final stub.
|
LONG_INITIAL
A long initial stub.
|
NONE
Explicitly states that there are no stubs.
|
SHORT_FINAL
A short final stub.
|
SHORT_INITIAL
A short initial stub.
|
SMART_FINAL
A smart final stub.
|
SMART_INITIAL
A smart initial stub.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isCalculateBackwards()
Checks if the schedule is calculated backwards from the end date to the start date.
|
boolean |
isCalculateForwards()
Checks if the schedule is calculated forwards from the start date to the end date.
|
boolean |
isFinal()
Checks if this convention tries to produce a final stub.
|
boolean |
isLong()
Checks if this convention tries to produce a long stub.
|
boolean |
isShort()
Checks if this convention tries to produce a short stub.
|
boolean |
isSmart()
Checks if this convention uses smart rules to create a stub.
|
static StubConvention |
of(String name)
Obtains an instance from the specified name.
|
RollConvention |
toRollConvention(LocalDate start,
LocalDate end,
Frequency frequency,
boolean preferEndOfMonth)
Converts this stub convention to the appropriate roll convention.
|
String |
toString()
Returns the formatted name of the type.
|
static StubConvention |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static StubConvention[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final StubConvention NONE
This is used to indicate that the term of the schedule evenly divides by the periodic frequency leaving no stubs. For example, a 6 month trade can be exactly divided by a 3 month frequency.
If the term of the schedule is less than the frequency, then only one period exists. In this case, the period is not treated as a stub.
When creating a schedule, there must be no explicit stubs.
public static final StubConvention SHORT_INITIAL
The schedule periods will be determined backwards from the regular period end date. Any remaining period, shorter than the standard frequency, will be allocated at the start.
For example, an 8 month trade with a 3 month periodic frequency would result in a 2 month initial short stub followed by two periods of 3 months.
If there is no remaining period when calculating, then there is no stub. For example, a 6 month trade can be exactly divided by a 3 month frequency.
When creating a schedule, there must be no explicit final stub. If there is an explicit initial stub, then this convention is considered to be matched and the remaining period is calculated using the stub convention 'None'.
public static final StubConvention LONG_INITIAL
The schedule periods will be determined backwards from the regular period end date. Any remaining period, shorter than the standard frequency, will be allocated at the start and combined with the next period, making a total period longer than the standard frequency.
For example, an 8 month trade with a 3 month periodic frequency would result in a 5 month initial long stub followed by one period of 3 months.
If there is no remaining period when calculating, then there is no stub. For example, a 6 month trade can be exactly divided by a 3 month frequency.
When creating a schedule, there must be no explicit final stub. If there is an explicit initial stub, then this convention is considered to be matched and the remaining period is calculated using the stub convention 'None'.
public static final StubConvention SMART_INITIAL
The schedule periods will be determined backwards from the regular period end date.
Any remaining period, shorter than the standard frequency, will be allocated at the start.
If this results in a stub of less than 7 days, the stub will be combined with the next period.
If this results in a stub of 7 days or more, the stub will be retained.
This is the equivalent of LONG_INITIAL up to 7 days and SHORT_INITIAL beyond that.
The 7 days are calculated based on unadjusted dates.
This convention appears to match that used by Bloomberg.
If there is no remaining period when calculating, then there is no stub. For example, a 6 month trade can be exactly divided by a 3 month frequency.
If there is an explicit initial stub, then this convention is considered to be matched and the remaining period is calculated using the stub convention 'None'.
public static final StubConvention SHORT_FINAL
The schedule periods will be determined forwards from the regular period start date. Any remaining period, shorter than the standard frequency, will be allocated at the end.
For example, an 8 month trade with a 3 month periodic frequency would result in two periods of 3 months followed by a 2 month final short stub.
If there is no remaining period when calculating, then there is no stub. For example, a 6 month trade can be exactly divided by a 3 month frequency.
When creating a schedule, there must be no explicit initial stub. If there is an explicit final stub, then this convention is considered to be matched and the remaining period is calculated using the stub convention 'None'.
public static final StubConvention LONG_FINAL
The schedule periods will be determined forwards from the regular period start date. Any remaining period, shorter than the standard frequency, will be allocated at the end and combined with the previous period, making a total period longer than the standard frequency.
For example, an 8 month trade with a 3 month periodic frequency would result in one period of 3 months followed by a 5 month final long stub.
If there is no remaining period when calculating, then there is no stub. For example, a 6 month trade can be exactly divided by a 3 month frequency.
When creating a schedule, there must be no explicit initial stub. If there is an explicit final stub, then this convention is considered to be matched and the remaining period is calculated using the stub convention 'None'.
public static final StubConvention SMART_FINAL
The schedule periods will be determined forwards from the regular period start date.
Any remaining period, shorter than the standard frequency, will be allocated at the end.
If this results in a stub of less than 7 days, the stub will be combined with the next period.
If this results in a stub of 7 days or more, the stub will be retained.
This is the equivalent of LONG_FINAL up to 7 days and SHORT_FINAL beyond that.
The 7 days are calculated based on unadjusted dates.
This convention appears to match that used by Bloomberg.
If there is no remaining period when calculating, then there is no stub. For example, a 6 month trade can be exactly divided by a 3 month frequency.
If there is an explicit final stub, then this convention is considered to be matched and the remaining period is calculated using the stub convention 'None'.
public static final StubConvention BOTH
The schedule periods will be determined from two dates - the regular period start date and the regular period end date. Days before the first regular period start date form the initial stub. Days after the last regular period end date form the final stub.
When creating a schedule, there must be both an explicit initial and final stub.
public static StubConvention[] values()
for (StubConvention c : StubConvention.values()) System.out.println(c);
public static StubConvention valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static StubConvention of(String name)
Parsing handles the mixed case form produced by toString() and
the upper and lower case variants of the enum constant name.
name - the name to parseIllegalArgumentException - if the name is not knownpublic RollConvention toRollConvention(LocalDate start, LocalDate end, Frequency frequency, boolean preferEndOfMonth)
This converts a stub convention to a RollConvention based on the
start date, end date, frequency and preference for end-of-month.
The net result is to imply the roll convention from the schedule data.
The rules are as follows:
If the input frequency is month-based, then the implied convention is based on the day-of-month of the initial date, where the initial date is the start date if rolling forwards or the end date otherwise. If that date is on the 31st day, or if the 'preferEndOfMonth' flag is true and the relevant date is at the end of the month, then the implied convention is 'EOM'. For example, if the initial date of the sequence is 2014-06-20 and the periodic frequency is 'P3M' (month-based), then the implied convention is 'Day20'.
If the input frequency is week-based, then the implied convention is based on the day-of-week of the initial date, where the initial date is the start date if rolling forwards or the end date otherwise. For example, if the initial date of the sequence is 2014-06-20 and the periodic frequency is 'P2W' (week-based), then the implied convention is 'DayFri', because 2014-06-20 is a Friday.
In all other cases, the implied convention is 'None'.
start - the start date of the scheduleend - the end date of the schedulefrequency - the periodic frequency of the schedulepreferEndOfMonth - whether to prefer the end-of-month when rollingpublic boolean isCalculateForwards()
If true, then there will typically be a stub at the end of the schedule.
The 'None', 'ShortFinal', 'LongFinal' and 'SmartFinal' conventions return true. Other conventions return false.
public boolean isCalculateBackwards()
If true, then there will typically be a stub at the start of the schedule.
The 'ShortInitial', 'LongInitial' and 'SmartInitial' conventions return true. Other conventions return false.
public boolean isFinal()
If true, then there will typically be a stub at the end of the schedule.
The 'ShortFinal', 'LongFinal' and 'SmartFinal' conventions return true. Other conventions return false.
public boolean isLong()
The 'LongInitial' and 'LongFinal' conventions return true. Other conventions return false.
public boolean isShort()
The 'ShortInitial' and 'ShortFinal' conventions return true. Other conventions return false.
public boolean isSmart()
The 'SmartInitial' and 'SmartFinal' conventions return true. Other conventions return false.
public String toString()
toString in class Enum<StubConvention>Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.