Class Tenor
- java.lang.Object
-
- com.caplin.motif.fx.common.Tenor
-
public class Tenor extends Object
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". ThegetValue(String)
method will return one of the default tenors if the provided string matches either the name or the alternative name, so callinggetValue(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 callinggetName()
as normal.
-
-
Field Summary
Fields Modifier and Type Field Description static Tenor
_10M
10 Months.static Tenor
_11M
11 Months.static Tenor
_15M
15 Months.static Tenor
_18M
18 Months.static Tenor
_1D
One Day after SPOT.static Tenor
_1M
1 Month.static Tenor
_1W
1 Week.static Tenor
_1Y
1 Year.static Tenor
_21M
21 Months.static Tenor
_2M
2 Months.static Tenor
_2W
2 Weeks.static Tenor
_2Y
2 Years.static Tenor
_3M
3 Months.static Tenor
_3W
3 Weeks.static Tenor
_3Y
3 Years.static Tenor
_4M
4 Months.static Tenor
_4W
4 Weeksstatic Tenor
_4Y
4 Years.static Tenor
_5M
5 Months.static Tenor
_5Y
5 Years.static Tenor
_6M
6 Months.static Tenor
_7M
7 months.static Tenor
_8M
8 Months.static Tenor
_9M
9 Months.static Tenor
_BROKEN
Broken Date.static Tenor
_ON
Overnight (SWAP Only).static Tenor
_SN
Spot Next.static Tenor
_SPOT
SPOT.static Tenor
_TN
Tomorrow Next (SWAP Only).static Tenor
_TODAY
Today.static Tenor
_TOM
Tomorrow.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Two instances of Tenor are considered equal if the underlying string returned by thegetName()
method are equal.String
getName()
static Tenor
getValue(String tenorStr)
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.String
toString()
Returns the underling string.static List<Tenor>
values()
Returns a list containing all of the default Tenors defined as fields in this class.
-
-
-
Field Detail
-
_ON
public static final Tenor _ON
-
_TODAY
public static final Tenor _TODAY
Today.
-
_TN
public static final Tenor _TN
-
_TOM
public static final Tenor _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
public static final Tenor _SPOT
SPOT. Typically two business days from today, but can vary for certain currency pairs.
-
_1D
public static final Tenor _1D
One Day after SPOT.
-
_SN
public static final Tenor _SN
-
_1W
public static final Tenor _1W
1 Week.
-
_2W
public static final Tenor _2W
2 Weeks.
-
_3W
public static final Tenor _3W
3 Weeks.
-
_4W
public static final Tenor _4W
4 Weeks
-
_1M
public static final Tenor _1M
1 Month.
-
_2M
public static final Tenor _2M
2 Months.
-
_3M
public static final Tenor _3M
3 Months.
-
_4M
public static final Tenor _4M
4 Months.
-
_5M
public static final Tenor _5M
5 Months.
-
_6M
public static final Tenor _6M
6 Months.
-
_7M
public static final Tenor _7M
7 months.
-
_8M
public static final Tenor _8M
8 Months.
-
_9M
public static final Tenor _9M
9 Months.
-
_10M
public static final Tenor _10M
10 Months.
-
_11M
public static final Tenor _11M
11 Months.
-
_1Y
public static final Tenor _1Y
1 Year. Can be created by callinggetValue(String)
with either "1Y" or "12M".
-
_15M
public static final Tenor _15M
15 Months.
-
_18M
public static final Tenor _18M
18 Months.
-
_21M
public static final Tenor _21M
21 Months.
-
_2Y
public static final Tenor _2Y
2 Years. Can be created by callinggetValue(String)
with either "2Y" or "24M".
-
_3Y
public static final Tenor _3Y
3 Years. Can be created by callinggetValue(String)
with either "3Y" or "36M".
-
_4Y
public static final Tenor _4Y
4 Years. Can be created by callinggetValue(String)
with either "4Y" or "48M".
-
_5Y
public static final Tenor _5Y
5 Years. Can be created by callinggetValue(String)
with either "5Y" or "60M".
-
_BROKEN
public static final Tenor _BROKEN
Broken Date. Represents any valid settlement date that is not a tenor date.
-
-
Method Detail
-
getValue
public static Tenor getValue(String tenorStr)
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
public static List<Tenor> 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
public String getName()
-
equals
public boolean equals(Object obj)
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.
-
-