Hello Developers,
Notes: I'm using the python API and have access to Refinitiv Tickhistory.
Getting a list of all option RIC codes (with expiration date and strike price) for S&P 500, current + historical.
Right now, I am using the following:
UnderlyingRIC = '.SPX' for S&P 500
request_header = { 'Prefer':'respond-async;odata.maxpagesize=25000',
'Content-Type':'application/json',
'Authorization': 'token {}'.format(auth_token)
}
request_body = { 'SearchRequest': { '@odata.context': 'http://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Search.FuturesAndOptionsSearchRequest',
'FuturesAndOptionsType': 'Options',
'UnderlyingRic': '.SPX',
'ExpirationDate': {'@odata.type': '#DataScope.Select.Api.Search.DateValueComparison',
'ComparisonOperator': 'GreaterThanEquals',
'Value': '1995-01-01'
}
}
}
data_request = requests.post('https://selectapi.datascope.refinitiv.com/RestApi/v1/Search/FuturesAndOptionsSearch',
json = request_body, headers = request_header)
It gives me the option meta data for all live contracts + historical contracts from October 2017 (which I guess implies a 5 year rule). However, I want this information for all options on S&P 500 since 1996 (which is when we're told TRTH starts) can you please help?
I saw previous questions here:
https://community.developers.refinitiv.com/questions/51893/need-details-regarding-options-ric-construction.html including something I had asked earlier https://community.developers.refinitiv.com/questions/95314/getting-information-for-ric-code-of-an-option-via.html, but I am looking for all expired contracts because I do not know the specific contracts available. I understand how option Option RICs are constructed, but my understanding is that there are conflicts since the number of bits reserved for strike price is not well-defined (XXXXX20000) can mean a strike of 200 or 2000 depending on the context. Which is why we need specific RIC codes - Expiration dates - Strike Price mappings.
The code above works fine for futures (in that it gives me a list of all futures RIC on SPX, etc) but for options only returns last 5 years. Lastly, I am mindful of the fact that the data is stored in chunks and I run queries sequentially until the '@odata.nextlink' flag exists and so this is all there exists.
Thank you very much!
Best,
Neel.