Class Tenor
A class representing tenors, such as SPOT, 1D (one day after SPOT), 1M (one month after SPOT) etc. Instances of Tenor
encapsulate an underlying String name, which can be retrieved by calling getName().
This class contains constants for all of the default tenors supported by the FX Integration API. Each of these default
tenors is represented by a name, and optionally one or more alternative names. For example, the _1Y tenor is
represented by the name "1Y" and also the alternative name "12M". The getValue(String) method will return one
of the default tenors if the provided string matches either the name or the alternative name, so calling getValue(String)
with either "1Y" or "12M" will return the _1Y instance.
You can create your own instances of Tenor by passing any string into the getValue(String) method. If the string
does not match the name or alternative name for any of the default tenors, a new instance of Tenor will be returned encapsulating
your string. This name can be retrieved by calling getName() as normal.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Tenor10 Months.static final Tenor11 Months.static final Tenor15 Months.static final Tenor18 Months.static final TenorOne Day after SPOT.static final Tenor1 Month.static final Tenor1 Week.static final Tenor1 Year.static final Tenor21 Months.static final Tenor2 Months.static final Tenor2 Weeks.static final Tenor2 Years.static final Tenor3 Months.static final Tenor3 Weeks.static final Tenor3 Years.static final Tenor4 Months.static final Tenor4 Weeksstatic final Tenor4 Years.static final Tenor5 Months.static final Tenor5 Years.static final Tenor6 Months.static final Tenor7 months.static final Tenor8 Months.static final Tenor9 Months.static final TenorBroken Date.static final TenorIMM1.static final TenorIMM2.static final TenorIMM3.static final TenorIMM4.static final TenorDeprecated.static final TenorOvernight (SWAP Only).static final TenorSpot Next.static final TenorSPOT.static final TenorTomorrow Next (SWAP Only).static final TenorToday.static final TenorTomorrow. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo instances of Tenor are considered equal if the underlying string returned by thegetName()method are equal.getName()static TenorParses the specified tenor string (in the format "1M" or "SPOT" etc) into one of the static Tenor objects.inthashCode()The hash code for an instance of Tenor is equal to the hash code of the underlying string returned by thegetName()method.toString()Returns the underling string.values()Returns a list containing all of the default Tenors defined as fields in this class.
-
Field Details
-
_ON
-
_TODAY
Today. -
_TN
-
_TOM
Tomorrow. For currency pairs where the SPOT date is one day after today rather than two, such as USD/CAD, this tenor typically does not exist because it would represent the same date as SPOT. -
_SPOT
SPOT. Typically two business days from today, but can vary for certain currency pairs. -
_1D
One Day after SPOT. -
_SN
-
_1W
1 Week. -
_2W
2 Weeks. -
_3W
3 Weeks. -
_4W
4 Weeks -
_1M
1 Month. -
_2M
2 Months. -
_3M
3 Months. -
_4M
4 Months. -
_5M
5 Months. -
_6M
6 Months. -
_7M
7 months. -
_8M
8 Months. -
_9M
9 Months. -
_10M
10 Months. -
_11M
11 Months. -
_1Y
1 Year. Can be created by callinggetValue(String)with either "1Y" or "12M". -
_15M
15 Months. -
_18M
18 Months. -
_21M
21 Months. -
_2Y
2 Years. Can be created by callinggetValue(String)with either "2Y" or "24M". -
_3Y
3 Years. Can be created by callinggetValue(String)with either "3Y" or "36M". -
_4Y
4 Years. Can be created by callinggetValue(String)with either "4Y" or "48M". -
_5Y
5 Years. Can be created by callinggetValue(String)with either "5Y" or "60M". -
_IMM1
IMM1. -
_IMM2
IMM2. -
_IMM3
IMM3. -
_IMM4
IMM4. -
_BROKEN
Broken Date. Represents any valid settlement date that is not a tenor date. -
_NONE
Deprecated.No Tenor. Represents a date that is not a tenor date. NONE tenor was introduced for crypto currencies but is now unsupported, with SPOT being used for crypto instead
-
-
Method Details
-
getValue
Parses the specified tenor string (in the format "1M" or "SPOT" etc) into one of the static Tenor objects.
One of the default tenor objects will be returned if the provided string matches either the name or alternative name(s) for one of the default tenors. For example, calling this method with either "1Y" or "12M" will return
_1Y.If a String cannot be matched to a tenor, a new instance of Tenor will be returned with that String as it's name.
- Parameters:
tenorStr- The string to parse.- Returns:
- The Tenor equivalent for the tenorStr.
-
values
Returns a list containing all of the default Tenors defined as fields in this class.- Returns:
- A list of all default Tenor instances.
-
getName
-
equals
Two instances of Tenor are considered equal if the underlying string returned by thegetName()method are equal. -
hashCode
public int hashCode()The hash code for an instance of Tenor is equal to the hash code of the underlying string returned by thegetName()method. -
toString
Returns the underling string. This implementation of this method is identical to the implementation of thegetName()method.
-