Class EtdIdUtils


  • public final class EtdIdUtils
    extends Object
    A utility for generating ETD identifiers.

    An exchange traded derivative (ETD) is uniquely identified by a set of fields. In most cases, these fields should be kept separate, as on EtdContractSpec. However, it can be useful to create a single identifier from the separate fields. We do not recommend parsing the combined identifier to retrieve individual fields.

    • Method Detail

      • contractSpecId

        public static EtdContractSpecId contractSpecId​(EtdType type,
                                                       ExchangeId exchangeId,
                                                       EtdContractCode contractCode)
        Creates an identifier for a contract specification.

        This will have the format: 'OG-ETD~F-ECAG-FGBS' or 'OG-ETD~O-ECAG-OGBS'.

        Parameters:
        type - type of the contract - future or option
        exchangeId - the MIC code of the exchange where the instruments are traded
        contractCode - the code supplied by the exchange for use in clearing and margining, such as in SPAN
        Returns:
        the identifier
      • futureId

        public static SecurityId futureId​(ExchangeId exchangeId,
                                          EtdContractCode contractCode,
                                          YearMonth expiryMonth,
                                          EtdVariant variant)
        Creates an identifier for an ETD future instrument.

        A typical monthly ETD will have the format: 'OG-ETD~F-ECAG-OGBS-201706'.

        A more complex flex ETD (12th of the month, Physical settlement) will have the format: 'OG-ETD~F-ECAG-OGBS-20170612E'.

        Parameters:
        exchangeId - the MIC code of the exchange where the instruments are traded
        contractCode - the code supplied by the exchange for use in clearing and margining, such as in SPAN
        expiryMonth - the month of expiry
        variant - the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'
        Returns:
        the identifier
      • optionId

        public static SecurityId optionId​(ExchangeId exchangeId,
                                          EtdContractCode contractCode,
                                          YearMonth expiryMonth,
                                          EtdVariant variant,
                                          int version,
                                          PutCall putCall,
                                          double strikePrice)
        Creates an identifier for an ETD option instrument.

        A typical monthly ETD with version zero will have the format: 'OG-ETD~O-ECAG-OGBS-201706-P1.50'.

        A more complex flex ETD (12th of the month, Cash settlement, European) with version two will have the format: 'OG-ETD~O-ECAG-OGBS-20170612CE-V2-P1.50'.

        Parameters:
        exchangeId - the MIC code of the exchange where the instruments are traded
        contractCode - the code supplied by the exchange for use in clearing and margining, such as in SPAN
        expiryMonth - the month of expiry
        variant - the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'
        version - the non-negative version, zero by default
        putCall - the Put/Call flag
        strikePrice - the strike price
        Returns:
        the identifier
      • optionId

        public static SecurityId optionId​(ExchangeId exchangeId,
                                          EtdContractCode contractCode,
                                          YearMonth expiryMonth,
                                          EtdVariant variant,
                                          int version,
                                          PutCall putCall,
                                          double strikePrice,
                                          YearMonth underlyingExpiryMonth)
        Creates an identifier for an ETD option instrument.

        This takes into account the expiry of the underlying instrument. If the underlying expiry is the same as the expiry of the option, the identifier is the same as the normal one. Otherwise, the underlying expiry is added after the option expiry. For example: 'OG-ETD~O-ECAG-OGBS-201706-P1.50-U201709'.

        Parameters:
        exchangeId - the MIC code of the exchange where the instruments are traded
        contractCode - the code supplied by the exchange for use in clearing and margining, such as in SPAN
        expiryMonth - the month of expiry
        variant - the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'
        version - the non-negative version, zero by default
        putCall - the Put/Call flag
        strikePrice - the strike price
        underlyingExpiryMonth - the expiry of the underlying instrument, such as a future, may be null
        Returns:
        the identifier
      • splitId

        public static SplitEtdId splitId​(SecurityId securityId)
        Splits an OG-ETD identifier.
        Parameters:
        securityId - the security ID
        Returns:
        a split representation of the ID
        Throws:
        IllegalArgumentException - if the ID is not of the right scheme or format