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
Modifier and TypeFieldDescriptionstatic final Tenor
10 Months.static final Tenor
11 Months.static final Tenor
15 Months.static final Tenor
18 Months.static final Tenor
One Day after SPOT.static final Tenor
1 Month.static final Tenor
1 Week.static final Tenor
1 Year.static final Tenor
21 Months.static final Tenor
2 Months.static final Tenor
2 Weeks.static final Tenor
2 Years.static final Tenor
3 Months.static final Tenor
3 Weeks.static final Tenor
3 Years.static final Tenor
4 Months.static final Tenor
4 Weeksstatic final Tenor
4 Years.static final Tenor
5 Months.static final Tenor
5 Years.static final Tenor
6 Months.static final Tenor
7 months.static final Tenor
8 Months.static final Tenor
9 Months.static final Tenor
Broken Date.static final Tenor
Overnight (SWAP Only).static final Tenor
Spot Next.static final Tenor
SPOT.static final Tenor
Tomorrow Next (SWAP Only).static final Tenor
Today.static final Tenor
Tomorrow. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two instances of Tenor are considered equal if the underlying string returned by thegetName()
method are equal.getName()
static Tenor
Parses the specified tenor string (in the format "1M" or "SPOT" etc) into one of the static Tenor objects.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.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". -
_BROKEN
Broken Date. Represents any valid settlement date that is not a tenor date.
-
-
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.
-