Class Tenor


  • public class Tenor
    extends java.lang.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". 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 Detail

      • _ON

        public static final Tenor _ON
        Overnight (SWAP Only). Represents a swap where the near leg is _TODAY and the far leg is _TOM.
      • _TODAY

        public static final Tenor _TODAY
        Today.
      • _TN

        public static final Tenor _TN
        Tomorrow Next (SWAP Only). Represents a swap where the near leg is _TOM and the far leg is _SPOT.
      • _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
        Spot Next. (SWAP Only). Represents a swap where the near leg is _SPOT and the far leg is _1D.
      • _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 calling getValue(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 calling getValue(String) with either "2Y" or "24M".
      • _3Y

        public static final Tenor _3Y
        3 Years. Can be created by calling getValue(String) with either "3Y" or "36M".
      • _4Y

        public static final Tenor _4Y
        4 Years. Can be created by calling getValue(String) with either "4Y" or "48M".
      • _5Y

        public static final Tenor _5Y
        5 Years. Can be created by calling getValue(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​(java.lang.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 java.util.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 java.lang.String getName()
      • equals

        public boolean equals​(java.lang.Object obj)
        Two instances of Tenor are considered equal if the underlying string returned by the getName() method are equal.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        The hash code for an instance of Tenor is equal to the hash code of the underlying string returned by the getName() method.
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns the underling string. This implementation of this method is identical to the implementation of the getName() method.
        Overrides:
        toString in class java.lang.Object