question

Upvotes
Accepted
5 1 3 4

RTH - Historical Criteria Search for continuation RICs

We have Continuation RICs for Futures such as CLc1 and TYcvoi1 and GCcm1 however these are not retrieved by the below Historical criteria search regex code. We would like to know what change needs to be made to the API code to extract the continuation RICs which have these lowercase letters.

The first contract month currently is ADG2 which is the Feb 22 contract and ADc1 will represent the first contract month.

We send a combination of RIC pattern, exchange code and Instrument type. Below are the ones that are currently being used, it looks like we would have to update the Regex at least to pick up the lower case symbols but I’m not sure if any changes are needed to exchange code and instrument type.


Example instrument search template:

{

"Request":

{ "RicPattern": "^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$",

"BondTypeCodes": null,

"ContributorIds": null,

"CountryCodes": null,

"CurrencyCodes": null,

"ExchangeCodes": ["759"],

"FutureMonthCodes": null,

"InstrumentTypeCodes": ["18"],

"OptionMonthCodes": null,

"OptionTypeCodes": null,

"CouponRate": null,

"StrikePrice": null,

"ExpiryDate": null,

"MaturityDate": null,

"Range": {

"Start": "2022-01-31T00:00:00.000Z",

"End": "2022-01-31T23:59:59.999Z"

}

}

}




$ head api_futures_config.txt

^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$|IUS|FUT

^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$|CME|FUT

^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$|CBT|FUT

^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$|NYM|FUT

^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$|IOM|FUT

^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$|IMM|FUT

^[A-Z]{2,4}[FGHJKMNQUVXZ][0-9]$|CMX|FUT

$ cat instrument_types.txt

domain,instype,desc

FUT,18,Cross Market

FUT,114,Equities and Index

FUT,98,Equity-Linked

FUT,210,FX

FUT,34,Treasury Debt

FUT,50,Sovereign Debt

FUT,82,Corporate Debt

FUT,66,Mortgage-backed Debt

FUT,242,Money Market

FUT,130,Energy

FUT,146,Commodities - Softs

FUT,162,Commodities - Base Metals

FUT,178,Commodities - Coins and Precious Metals

FUT,194,Commodities - Grains and Oilseeds

$ cat exchangeCodes.txt

exchange,exchangeCode

CBT,23

IUS,759

CME,20

MEX,168

NYM,31

SAO,165

IOM,22

IMM,21

CMX,28

searchtrth-rest-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
31.8k 38 11 19

Hello @mohamed.hisham ,

Agree with you the regex fiter will have to be tuned a little. From my testing the following Regex helps identify RICs CLc1 and GCcm1:

{ "Request": "RicPattern": "^[A-Z]{2}[c-z]{2}[0-9]$", "BondTypeCodes": null, "ContributorIds": null, "CountryCodes": null, "CurrencyCodes": null, "ExchangeCodes": null, "FutureMonthCodes": null, "InstrumentTypeCodes": null, "OptionMonthCodes": null, "OptionTypeCodes": null, "CouponRate": null, "StrikePrice": null, "ExpiryDate": null, "MaturityDate": null, "Range": { "Start": "2022-01-31T00:00:00.000Z", "End": "2022-01-31T23:59:59.999Z" }
} }

For RIC TYcvoi1 you may wish to go with a separate search:

{ "Request": { "RicPattern": "^[A-Z]{2}[c-z]{4}[0-9]$", "BondTypeCodes": null, "ContributorIds": null, "CountryCodes": null, "CurrencyCodes": null, "ExchangeCodes": null, "FutureMonthCodes": null, "InstrumentTypeCodes": null, "OptionMonthCodes": null, "OptionTypeCodes": null, "CouponRate": null, "StrikePrice": null, "ExpiryDate": null, "MaturityDate": null, "Range": { "Start": "2022-01-31T00:00:00.000Z", "End": "2022-01-31T23:59:59.999Z" }
} }

On ExchangeCodes and InstrumentTypeCodes filtering- not so straightforward, in my opinion.

I have run a quick verification against the first instrument CLc1 as RicPattern, with the same filters:

{
                {protocol}}{
                {host}}{
                {api}}Search/HistoricalCriteriaSearch 
{ "Request": { "RicPattern": "^CLc1$", "BondTypeCodes": null, "ContributorIds": null, "CountryCodes": null, "CurrencyCodes": null, "ExchangeCodes": ["759"], "FutureMonthCodes": null, "InstrumentTypeCodes": ["18"], "OptionMonthCodes": null, "OptionTypeCodes": null, "CouponRate": null, "StrikePrice": null, "ExpiryDate": null, "MaturityDate": null, "Range": { "Start": "2022-01-31T00:00:00.000Z", "End": "2022-01-31T23:59:59.999Z" }
} }

It did not result in any hits:

{    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#Collection(DataScope.Select.Api.Search.HistoricalSearchResult)",    "value": [] }

However, if I remove ExchangeCodes and InstrumentTypeCodes filter:

{ "Request": { "RicPattern": "^CLc1$", "BondTypeCodes": null, "ContributorIds": null, "CountryCodes": null, "CurrencyCodes": null,
"ExchangeCodes": null,
"FutureMonthCodes": null,
"InstrumentTypeCodes": null,
"OptionMonthCodes": null, "OptionTypeCodes": null, "CouponRate": null, "StrikePrice": null, "ExpiryDate": null, "MaturityDate": null, "Range": { "Start": "2022-01-31T00:00:00.000Z", "End": "2022-01-31T23:59:59.999Z" }
} }

The result on the exact RIC search is as expected:

{    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#Collection(DataScope.Select.Api.Search.HistoricalSearchResult)",    "value": [        {            "Identifier": "CLc1",            "IdentifierType": "Ric",            "Source": "",            "Key": "VjF8MHgzMDAwMDAwMDAwMDAwMDAwfDB4MzAwMDAwMDAwMDAwMDAwMHx8fHx8fHxDTGMxfA",            "Description": "Historical Instrument",            "InstrumentType": "Unknown",            "Status": "Valid",            "DomainCode": "6",            "FirstDate": "1996-01-03T00:00:00.000Z",            "LastDate": "2022-02-03T00:00:00.000Z",            "History": []        }    ] }

This, to me, this suggests that this type of instruments, ExchangeCode and InstrumentTypeCode may be undefined or differ from the requested.

I am going to try to try to find out more about ExchangeCodes filtering for this type of instrument (for example, I can filter "IBM.N" on ExchangeCodes as expected), internally, and get back with any relevant information.

Hope this information is of help

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.