REST API Tutorial 18: Search for a Future or Option

Last update Dec 2023
Environment Any
Language Any HTTP is supported
Compilers None
Prerequisites DSS login, internet access
Source code Below

Tutorial purpose

This tutorial explains how to make a search request for a future or option, using as main criteria the strike price and the expiration date (other criteria are also available).

It also illustrates the use of a wildcard for the identifier.

Important note: contrary to the historical search capabilities, this search capability only returns instruments that are currently active, it will not include historical instruments.

 

Table of contents

 

 

Future search by exchange and ticker - HTTP request

Note:

  • For all requests we need to include a user token in the header of our request. This was retrieved in Tutorial 1.

The body of the request contains the list of available search criteria:

  • In this example we search for instruments with two main criteria: a strike price within a specific range, and an expiration after a specified date.
  • For a range criteria, the syntax includes a data type and From and To fields. The data type is NumericRangeComparison for a numeric field, it would be DateRangeComparison for a date field. 
  • For a comparison operator, the syntax includes a data type and ComparisonOperator and Value fields. The ComparisonOperator can be: LessThan, LessThanEquals, Equals, NotEqualsGreaterThanEqualsGreaterThan.
  • Other search criteria are of course possible. See the REST API Reference Tree for more information on the search criteria.

The following request searches for all valid instruments corresponding to a specific ticker, on two specific exchanges.

URL:               

    	
            https://selectapi.datascope.refinitiv.com/RestApi/v1/Search/FuturesAndOptionsSearch
        
        
    

Method:          POST

Headers:

    	
            

Prefer: respond-async

Content-Type: application/json

Authorization: Token F0ABE9A3FFF2E02E10AE2765ED872C59B8CC3B40EBB61B30E295E71DE31C254B8648DB9434C2DF9299FDC668AA123501F322D99D45C8B93438063C912BC936C7B87062B0CF812138863F5D836A7B31A32DCA67EF07B3B50B2FC4978DF6F76784FDF35FCB523A8430DA93613BC5730CDC310D4D241718F9FC3F2E55465A24957CC287BDEC79046B31AD642606275AEAD76318CB221BD843348E1483670DA13968D8A242AAFCF9E13E23240C905AE46DED9EDCA9BB316B4C5C767B18DB2EA7ADD100817ADF059D01394BC6375BECAF6138C25DBA57577F0061

Body:

    	
            

{

  "SearchRequest": {

    "FileCodes": null,

    "CurrencyCodes": null,

    "ExchangeCodes": null,

    "StrikePrice": {

      "@odata.type": "#DataScope.Select.Api.Search.NumericRangeComparison",

      "From": 85,

      "To": 88

    },

    "ExpirationDate": {

      "@odata.type": "#DataScope.Select.Api.Search.DateValueComparison",

      "ComparisonOperator": "GreaterThanEquals",

      "Value": "2016-12-31T00:00:00.000Z"

    },

    "IdentifierType": "Ric",

    "Identifier": "ED*",

    "PreferredIdentifierType": "Ric",

    "UnderlyingRic": "ED"

  }

}

 

Future search by exchange and ticker - HTTP response

Status:                        200 OK

Relevant headers:

    	
            Content-Type: application/json; charset=utf-8
        
        
    

Body:

There are more than 100 values in the response. Here is the beginning of the response:

    	
            

{

    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#Collection(DataScope.Select.Api.Search.FuturesAndOptionsSearchResult)",

    "value": [

        {

            "Identifier": "EDM212208500.U",

            "IdentifierType": "Ric",

            "Source": "OPQ",

            "Key": "VjF8MHgwMDEwMGIwMDFlNjNlNDBlfDB4MDAxMDBiMDAxZTYzMTQxM3xPUFF8RFZRVXxERVJWfE9QVHxEfHxFRE0yMTIyMDg1MDAuVXw3MTQ1",

            "Description": "ED Jan2 85.0 P",

            "InstrumentType": "DerivativeQuote",

            "Status": "Valid",

            "ExchangeCode": "OPQ",

            "CurrencyCode": "USD",

            "FuturesAndOptionsType": "Options",

            "PutCallCode": "Put",

            "ExpirationDate": "2022-01-21T00:00:00.000Z",

            "StrikePrice": 85,

            "AssetStatus": "Active"

        },

        {

            "Identifier": "EDA212208500.U",

            "IdentifierType": "Ric",

            "Source": "OPQ",

            "Key": "VjF8MHgwMDEwMGIwMDFlNjNlNDU4fDB4MDAxMDBiMDAxZTYzMTRhN3xPUFF8RFZRVXxERVJWfE9QVHxEfHxFREEyMTIyMDg1MDAuVXw3MTQ1",

            "Description": "ED Jan2 85.0 C",

            "InstrumentType": "DerivativeQuote",

            "Status": "Valid",

            "ExchangeCode": "OPQ",

            "CurrencyCode": "USD",

            "FuturesAndOptionsType": "Options",

            "PutCallCode": "Call",

            "ExpirationDate": "2022-01-21T00:00:00.000Z",

            "StrikePrice": 85,

            "AssetStatus": "Active"

        },

        {

            "Identifier": "EDA212208750.U",

            "IdentifierType": "Ric",

            "Source": "OPQ",

            "Key": "VjF8MHgwMDEwMGIwMDFlNjNlNTMwfDB4MDAxMDBiMDAxZTYzMTYxNnxPUFF8RFZRVXxERVJWfE9QVHxEfHxFREEyMTIyMDg3NTAuVXw3MTQ1",

            "Description": "ED Jan2 87.5 C",

            "InstrumentType": "DerivativeQuote",

            "Status": "Valid",

            "ExchangeCode": "OPQ",

            "CurrencyCode": "USD",

            "FuturesAndOptionsType": "Options",

            "PutCallCode": "Call",

            "ExpirationDate": "2022-01-21T00:00:00.000Z",

            "StrikePrice": 87.5,

            "AssetStatus": "Active"

        },

        {

            "Identifier": "EDM212208750.U",

            "IdentifierType": "Ric",

            "Source": "OPQ",

            "Key": "VjF8MHgwMDEwMGIwMDFlNjNlNTg3fDB4MDAxMDBiMDAxZTYzMTZhMXxPUFF8RFZRVXxERVJWfE9QVHxEfHxFRE0yMTIyMDg3NTAuVXw3MTQ1",

            "Description": "ED Jan2 87.5 P",

            "InstrumentType": "DerivativeQuote",

            "Status": "Valid",

            "ExchangeCode": "OPQ",

            "CurrencyCode": "USD",

            "FuturesAndOptionsType": "Options",

            "PutCallCode": "Put",

            "ExpirationDate": "2022-01-21T00:00:00.000Z",

            "StrikePrice": 87.5,

            "AssetStatus": "Active"

        },

        {

            "Identifier": "EDA202308500.U",

            "IdentifierType": "Ric",

            "Source": "OPQ",

            "Key": "VjF8MHgwMDEwMGIwMDIzZWUwNGZlfDB4MDAxMDBiMDAyM2VjNjAyZHxPUFF8RFZRVXxERVJWfE9QVHxEfHxFREEyMDIzMDg1MDAuVXw3MTQ1",

            "Description": "ED Jan3 85.0 C",

            "InstrumentType": "DerivativeQuote",

            "Status": "Valid",

            "ExchangeCode": "OPQ",

            "CurrencyCode": "USD",

            "FuturesAndOptionsType": "Options",

            "PutCallCode": "Call",

            "ExpirationDate": "2023-01-20T00:00:00.000Z",

            "StrikePrice": 85,

            "AssetStatus": "Active"

        },