public final class EtdIdUtils extends Object
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.
| Modifier and Type | Field and Description |
|---|---|
static String |
ETD_SCHEME
Scheme used for ETDs.
|
| Modifier and Type | Method and Description |
|---|---|
static EtdContractSpecId |
contractSpecId(EtdType type,
ExchangeId exchangeId,
EtdContractCode contractCode)
Creates an identifier for a contract specification.
|
static EtdContractSpecId |
contractSpecId(SecurityId securityId)
Creates an identifier for a contract specification.
|
static SecurityId |
futureId(ExchangeId exchangeId,
EtdContractCode contractCode,
YearMonth expiryMonth,
EtdVariant variant)
Creates an identifier for an ETD future instrument.
|
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.
|
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.
|
static SplitEtdContractSpecId |
splitId(EtdContractSpecId specId)
Splits an OG-ETD identifier.
|
static SplitEtdId |
splitId(SecurityId securityId)
Splits an OG-ETD identifier.
|
static ExchangeId |
splitIdToExchangeId(SecurityId securityId)
Splits an OG-ETD identifier to obtain the exchange ID.
|
public static final String ETD_SCHEME
public static EtdContractSpecId contractSpecId(EtdType type, ExchangeId exchangeId, EtdContractCode contractCode)
This will have the format:
'OG-ETD~F-ECAG-FGBS' or 'OG-ETD~O-ECAG-OGBS'.
type - type of the contract - future or optionexchangeId - the MIC code of the exchange where the instruments are tradedcontractCode - the code supplied by the exchange for use in clearing and margining, such as in SPANpublic static EtdContractSpecId contractSpecId(SecurityId securityId)
This will have the format:
'OG-ETD~F-ECAG-FGBS' or 'OG-ETD~O-ECAG-OGBS'.
securityId - the security idpublic static SecurityId futureId(ExchangeId exchangeId, EtdContractCode contractCode, YearMonth expiryMonth, EtdVariant variant)
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'.
exchangeId - the MIC code of the exchange where the instruments are tradedcontractCode - the code supplied by the exchange for use in clearing and margining, such as in SPANexpiryMonth - the month of expiryvariant - the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'public static SecurityId optionId(ExchangeId exchangeId, EtdContractCode contractCode, YearMonth expiryMonth, EtdVariant variant, int version, PutCall putCall, double strikePrice)
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'.
exchangeId - the MIC code of the exchange where the instruments are tradedcontractCode - the code supplied by the exchange for use in clearing and margining, such as in SPANexpiryMonth - the month of expiryvariant - the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'version - the non-negative version, zero by defaultputCall - the Put/Call flagstrikePrice - the strike pricepublic static SecurityId optionId(ExchangeId exchangeId, EtdContractCode contractCode, YearMonth expiryMonth, EtdVariant variant, int version, PutCall putCall, double strikePrice, YearMonth underlyingExpiryMonth)
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'.
exchangeId - the MIC code of the exchange where the instruments are tradedcontractCode - the code supplied by the exchange for use in clearing and margining, such as in SPANexpiryMonth - the month of expiryvariant - the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'version - the non-negative version, zero by defaultputCall - the Put/Call flagstrikePrice - the strike priceunderlyingExpiryMonth - the expiry of the underlying instrument, such as a future, may be nullpublic static SplitEtdContractSpecId splitId(EtdContractSpecId specId)
specId - the contract spec IDIllegalArgumentException - if the ID is not of the right scheme or formatpublic static SplitEtdId splitId(SecurityId securityId)
securityId - the security IDIllegalArgumentException - if the ID is not of the right scheme or formatpublic static ExchangeId splitIdToExchangeId(SecurityId securityId)
securityId - the security IDIllegalArgumentException - if the ID is not of the right scheme or formatCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.