For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 1 3 3

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.

historical
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.

Upvotes
Accepted
32.2k 40 11 19

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.



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.

Upvotes
32.2k 40 11 19

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

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.

Upvotes
1 1 3 3

Hello @zoya farberov ,

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.


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.

Upvotes
32.2k 40 11 19

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.



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.

Upvotes
1 1 3 3

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.
1640201399035.png


1640201399035.png (11.2 KiB)
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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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