question

Upvotes
Accepted
3 0 0 0

futures expiry date in TRTH python

Hi there,

I have 2 questions please:

1 I am trying to retrieve the expiry date of a specify contract through the TRTH Python API. I use "Expiration Date" as the file in ContentFieldNames section of the json file. It works for some products but does not for others. For example, when trying to retrieve the expiry date of FCEK1, the extract does not any entry whereas the code works perfectly for others.

2 Is there also a way to simply retrieve all the expiry dates of a future chain like in the Eikon API by using a ric chain like 0#FCE:

I also tried to use this in the query but it does not work.


Thank you for your help

tick-history-rest-api
icon clock
10 |1500

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

Upvotes
Accepted
23k 22 9 14

Hello @Mehdi,

Check out the attached example of the two "chained" searches, it is not a fully polished example, but hope it helps:

TRTH_OnDemand_Search.zip


icon clock
10 |1500

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

Upvotes
23k 22 9 14

Hello @Mehdi,

I think FuturesAndOptionsSearch may be suitable:

{ {protocol}}{ {host}}{ {api}}Search/FuturesAndOptionsSearch

{
    "SearchRequest": {
        "FileCodes": null,
        "CurrencyCodes": null,
        "ExchangeCodes": null,
        "IdentifierType": "Ric",
        "Identifier": "FCEK1"
    }
}

resulting in:

{
    "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#Collection(ThomsonReuters.Dss.Api.Search.FuturesAndOptionsSearchResult)",
    "value": [
        {
            "Identifier": "FCEK1",
            "IdentifierType": "Ric",
            "Source": "MNP",
            "Key": "VjF8MHgwMDEwMGIwMDI2YTljMzEzfDB4MDAxMDBiMDAyNmFjMDY2NnxNTlB8RFZRVXxERVJWfEZVVHxEfHxGQ0VLMXw1MDM2",
            "Description": "CAC 40 MAY1",
            "InstrumentType": "DerivativeQuote",
            "Status": "Valid",
            "ExchangeCode": "MNP",
            "CurrencyCode": "EUR",
            "FuturesAndOptionsType": "Futures",
            "PutCallCode": "",
            "ExpirationDate": "2021-05-21T00:00:00.000Z",
            "AssetStatus": "Active"
        }
    ]
}

It does not support chainRIC as identifier, so you have to find expand the chain:

{ {protocol}}{ {host}}{ {api}}Search/HistoricalChainResolution

{
  "Request": {
          "ChainRics": ["0#FCE:"],
      "Range": {
          "Start": "2020-06-12T00:00:00.000Z",
          "End": "2021-06-12T00:00:00.000Z"
      }
  }
}

And then look up expiration dates of the relevant RICs using FuturesAndOptionsSearch



icon clock
10 |1500

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

Upvotes
3 0 0 0

Hi Zova,

I tried your query in the Python API, but it does not work. The ExtractRaw method returns:

Status Code = 400

XXX lineno: 94, opcode: 0

Do you think this should work even in the Python TRTH API? would you have a small piece of Python code to share that i could try because i could not find any documentation about this type of json file to be called in Python?

Thank you again

icon clock
10 |1500

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

Upvotes
23k 22 9 14

Hello @Mehdi,

ExtractRaw is not the right request type/endpoint to use.

My suggested approach included two Searches:

{ {protocol}}{ {host}}{ {api}}Search/FuturesAndOptionsSearch

and

{ {protocol}}{ {host}}{ {api}}Search/HistoricalChainResolution

Please see REST API Reference Tree with the complete spec to use.

I have tested the "naked" requests in Postman, so they will work the same in any language that supports HTTP REST interface, including Python.

icon clock
10 |1500

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

Click below to post an Idea Post Idea