How to get list of options of SPX for historical expiration month via REST API?
Hello,
How to get list of options of SPX for historical expiration month via REST API?
I have success to receive current active options only.
Best Answer
-
Hello @atsmus900 ,
Looking again into this, I believe I know what is happening. FuturesAndOptionsSearch is intended for the currently active instruments. Active and Inactive AssetStatus, in reference to FuturesAndOptionsSearch only means activity of the instrument, i.e. currently trading, and historical instruments, i.e. inactive ones, are not included in the results.
If you are permissioned, you may wish to look into HistoricalCriteriaSearch request for historical instrument selection:
{{protocol}}{{host}}{{api}}Search/HistoricalCriteriaSearch
{
"Request": {
"BondTypeCodes": null,
"ContributorIds": null,
"CountryCodes": null,
"CurrencyCodes": null,
"ExchangeCodes": null,
"FutureMonthCodes": null,
"InstrumentTypeCodes": [115],
"OptionMonthCodes": null,
"OptionTypeCodes": null,
"RicPattern": "^SPX",
"ExpiryDate": {
"Start": "2018-01-01T00:00:00.000Z",
"End": "2021-12-31T00:00:00.000Z"
},
"Range": {
"Start": "2015-09-30T00:00:00.000Z",
"End": "2021-12-31T23:59:59.999Z"
}
}
}For the complete reference spec please refer to REST API Reference Tree -> Search -> Historical Criteria Search.
InstrumentTypeCode I have included (115) is one of several types of option instrument code, but may not be the right option for your requirement, please lookup the available InstrumentTypeCode values to select the Option code you are looking for, from the dropdown list; or you can enlist the help of Refinitiv content experts via Refinitiv Helpdesk Online -> Content -> RTH to help you select the correct content per your content requirement.
0
Answers
-
Hello @atsmus900 ,
I can not be sure without seeing your entire request, however, usually, in order to obtain historic instruments you would use ValidationOptions, for example:
{
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.PriceHistoryExtractionRequest",
"ContentFieldNames": [
"File Code",
"RIC",
"Trade Date",
"Last Trade Price",
"Universal Close Price",
"Alternate Close Price",
"High Price",
"Low Price",
"Open Price",
"Volume Weighted Average Price",
"Turnover",
"Volume",
"Accumulated Volume Unscaled",
"Bid Price",
"Asset Type",
"Quote ID",
"Bid Yield",
"Exchange Code",
"Currency Code"
],
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{ "Identifier": "CPI", "IdentifierType": "Ric" },
{ "Identifier": "GDP", "IdentifierType": "Ric" }
],
"ValidationOptions": { "AllowHistoricalInstruments": true },
"UseUserPreferencesForValidationOptions": false
},
"Condition": {
"AdjustedPrices": true,
"QueryStartDate": "2006-05-24T00:00:00.000Z",
"QueryEndDate": "2006-07-31T00:00:00.000Z"
}
}
}if this does not help, please include the complete request you issue for the valid options, so we can look at the same request
0 -
Hello @zoya faberov ,
Thank you for your response,
I'd like to download history tick data of all options (call & put from all the strikes) of SPX for specific day in the past.
I had success to download historical tick data for specific option by specified the RIC of the option (e.g. SPXl162215750.U)
my question is about the way to get the a list of these options?
The number of options can be hundreds and thousands.
I tried to use the below API but it return the list on all the options that currently active (about 30K options)
{
'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': "2018-01-01T00:00:00.000Z"
},
}
}Thank you.
0 -
Hello @atsmus900 ,
Having run the same request on my side, and I see both valid and expired options in the result. For example:
{
"@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#Collection(DataScope.Select.Api.Search.FuturesAndOptionsSearchResult)",
"value": [
{
"Identifier": "SPXx172116500.U^L21",
"IdentifierType": "Ric",
"Source": "OPQ",
"Key": "VjF8MHgwMDEwMGIwMDFiMDg4NGVlfDB4MDAxMDBiMDAxYjA4NDcyZXxPUFF8RFZRVXxERVJWfE9QVHxEfHxTUFh4MTcyMTE2NTAwLlVeTDIxfDcxNjk",
"Description": "SPX Dec1 1650.0P",
"InstrumentType": "DerivativeQuote",
"Status": "Valid",
"ExchangeCode": "OPQ",
"CurrencyCode": "USD",Any option that has "^" in the symbol I believe to be expired.
Please refer to REST API Reference Tree -> Search-> FuturesAndOptionsSearch for the complete request specification.
We can search for all options, or select active options or inactive instruments only, for example:
{
"SearchRequest": {
"@odata.context": "http://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Search.FuturesAndOptionsSearchRequest",
"FuturesAndOptionsType": "Options",
"UnderlyingRic": ".SPX",
"AssetStatus":"Inactive",
"ExpirationDate": {
"@odata.type": "#DataScope.Select.Api.Search.DateValueComparison",
"ComparisonOperator": "GreaterThanEquals",
"Value": "2018-01-01T00:00:00.000Z"
}
}
}
...
"@odata.nextlink": "https://selectapi.datascope.refinitiv.com/RestApi/v1/Search/FuturesAndOptionsSearch?$skiptoken='MjUw'"This will result in inactive options only. Please note the next link at the end, this allows to paginate through the rest of the result.
However, if this is not the content that you are looking for, you may need in-depth content expertise.
This forum is of most help with questions on API usage. For question on content, I suggest to contact Refinitiv content experts directly via Refinitiv Helpdesk Online -> Content -> DSS or dialing local Refinitiv helpdesk number.
0 -
Hello @zoya faberov
Thank you.
yours example has the same problem,
expiration day of "SPXx172116500.U^L21" is current month (Dec 2021)
the query is to get all options from 1/1/2018 but the result includes options with expiration day is this month and later, nothing before that.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 689 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 24 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 279 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 712 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛