When trying to get historical WTI spreads I cannot find appropriate RIC to use. In 2023 for some reason the RICS changed from 1 digit year to 2 digit years. When attempting to get history for a 2023-2024 spread pair all logic seems to breakdown.
I used the refinitiv search:
import os
import requests
resp = requests.post('https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken',
json={'Credentials': {'Username': os.environ['REFINITIV_API_USER'],
'Password': os.environ['REFINITIV_API_PASS']}},
headers={'Content-Type': 'application/json'})
token = resp.json()['value']
headers = {'Authorization': 'Token ' + token, 'Content-Type': 'application/json', 'Prefer': 'respond-async'}
i = requests.post('https://selectapi.datascope.refinitiv.com/RestApi/v1/Search/FuturesAndOptionsSearch', headers=headers,
json={
"SearchRequest": {
"FuturesAndOptionsType": "Futures",
"AssetStatus": "Inactive",
"IdentifierType": "Ric",
"Identifier": "CLZ3-F24*",
"PreferredIdentifierType": "Ric"
}
})
i.json()
This tells me the RIC format is "CLZ3-F24^2" for a CLZ23-F24 spread - whoever when run through the get_history() function this does not work. Sample call below:
rd.get_history('CLZ3-Z24^2:', ['OPEN_PRC', 'HIGH_1', 'LOW_1', 'SETTLE'], 'daily', '2023-09-07', '2023-10-10')
Error Code:(TS.Interday.UserRequestError.70005, The universe is not found)
What is the best way to identify all the nuances with these RICS codes? It is a bit mad…
Thanks!
Additional Note: When using the python library search it (sample below) it says I am missing a scope? Please advise.
rd.discovery.search(
view = rd.discovery.Views.SEARCH_ALL,
filter = "PrimaryChainRIC eq '0#CL-:'",
select = "DocumentTitle,RIC,PrimaryChainRIC,ExpiryDate",
top = 1000)
Error Code: Missing scopes: {'trapi.search.read'}