question

Upvotes
1 2 2 6

REST API question on TRTHv2

1) How can I programmatically get RICs for search criteria like "ES futures" or even "S&P500 E-mini futures"
2) How do the report templates work with recurring invocations when there is an end date in the temple.

3) I need the full rest api spec, so far I only found examples and guides I don't seem to be able to find an actual api doc anywhere

tick-history-rest-apirest-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.

Upvote
13.7k 26 8 12

@Romita.Dastidar

3) The API is documented online, in the REST API Reference Tree. You can also look at this tutorial which should help you understand that reference, and give you other pointers.

2) When a report template contains an end date (and start date) they define the date/time range for the historical data you request. That has nothing to do with when the request will run, which is defined by a schedule. If a recurring schedule uses an unvarying instrument list and report template, it will just return the same data every time. Side note: a request can also be On Demand, but such requests do not use a predefined report template.

1) There are various historical search capabilities for TRTH customers: HistoricalSearch is the simplest. HistoricalCriteriaSearch allows searching by a whole set of criteria, and HistoricalChainResolution allows searching for chain constituents.

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
1 2 2 6

Thank you @Christiaan Meihsl

Case: 0550095

Client: Higher Moment Capital

Here is a follow up from client on question 1

"Thank you for your answers. On question 2 and 3 I'm all set. On question 1 I'm still not.
Very specifically, given, the 3 api calls you provided in the answer, what should the request body be to request all historical RICs for all expirations for E-mini S&p 500 future's given the only the root ES and a date range
I don't want the users of my code to have to know anything but ES or VS(as another example) to retrieve the RIC's.
Similarly, for options, the only additional data that I would expect to supply is puts or calls or both and a strike % range from in the money up or down."

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
13.7k 26 8 12

@Romita.Dastidar

Follow-up on question 1:

Note: all the following are historical criteria requests, using a POST to this endpoint: http://hosted.datascopeapi.reuters.com/RestApi/v1/Search/HistoricalCriteriaSearch

1.1 Body to request all historical RICs for all expirations for futures given the root ES and a date range:

{
  "Request": {
    "RicPattern": "^ES",
    "BondTypeCodes": null,
    "ContributorIds": null,
    "CountryCodes": null,
    "CurrencyCodes": null,
    "ExchangeCodes": null,
    "FutureMonthCodes": null,
    "InstrumentTypeCodes": [ "114" ],
    "OptionMonthCodes": null,
    "OptionTypeCodes": null,
    "CouponRate": null,
    "StrikePrice": null,
    "ExpiryDate": null,
    "MaturityDate": null,
    "Range": {
      "Start": "2017-05-01T00:00:00.000Z",
      "End": "2017-05-17T00:00:00.000Z"
    }
  }
}

Explanations:

  • RIC pattern is a regex, which defines "any RIC starting with ES". Accepted regular expressions are listed in this query.
  • InstrumentTypeCodes is an array of values (one or more, comma separated), each one defining an instrument type. In this example 114 is for Equities Futures (there are other codes for other futures, like cross market, metals, etc). Parameters and possible values are described in the HistoricalCriteriaSearch section of the REST API Reference Tree.

This query returns more than 4000 results.

1.2 Body to request all historical RICs for all put options given the root ES and a date range:

{
  "Request": {
    "RicPattern": "^ES",
    "BondTypeCodes": null,
    "ContributorIds": null,
    "CountryCodes": null,
    "CurrencyCodes": null,
    "ExchangeCodes": null,
    "FutureMonthCodes": null,
    "InstrumentTypeCodes": [ "116" ],
    "OptionMonthCodes": null,
    "OptionTypeCodes": [ "1" ],
    "CouponRate": null,
    "StrikePrice": null,
    "ExpiryDate": null,
    "MaturityDate": null,
    "Range": {
      "Start": "2017-05-01T00:00:00.000Z",
      "End": "2017-05-17T00:00:00.000Z"
    }
  }
}

Explanations:

  • InstrumentTypeCodes 116 is for Equities Options.
  • OptionTypeCodes 1 is for put (0 is for call, and there are more options)

This will return more than 7000 results.

1.3 You can filter on strike price, using a range in absolute values (not %):

{
  "Request": {
    "RicPattern": "^ES",
    "BondTypeCodes": null,
    "ContributorIds": null,
    "CountryCodes": null,
    "CurrencyCodes": null,
    "ExchangeCodes": null,
    "FutureMonthCodes": null,
    "InstrumentTypeCodes": [ "116" ],
    "OptionMonthCodes": null,
    "OptionTypeCodes": [ "1" ],
    "CouponRate": null,
    "StrikePrice": {
      "Min": 100,
      "Max": 200
    },
    "ExpiryDate": null,
    "MaturityDate": null,
    "Range": {
      "Start": "2017-05-01T00:00:00.000Z",
      "End": "2017-05-17T00:00:00.000Z"
    }
  }
}

This last request returns one result (ES100R7).

Wide open queries deliver very large data sets and can be quite lengthy (and even time out after 5 minutes). Restricting result sets by using a short time range, and other filtering criteria (currency, exchange, etc.) is therefore recommended.

Added later to this response:

Illustration of a similar Historical Search with Criteria, in the GUI:

  1. Select Historical Search
  2. Click on Criteria to display the filter criteria.
  3. To illustrate your use case, set the RIC Identifier to start with ES
  4. Click on Instrument Types to filter on those
  5. You can filter the display of available types, like here for futures
  6. Click on all those you want to select in the left column, they will appear in the right column.
  7. Select the date range for the query.

As you can see, other criteria are available (maturity and expiration dates, strike price, etc.).


esfutsearchgui.png (100.5 KiB)
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
1 0 1 3

Thank you for your detailed explanation, however, I it does not really address my question. I'm looking for all futures for an equity index by root ES which is equivalent to E-mini S&p 500 futures. The query you provided and other combination in historical search gives me all Rics that strat with ES. That's like a million other Rics that I do not need, for instance, ES is actually an EverSource stock.
In order to properly find E-mini S&p 500 futures, I need to be able to Search/HistoricalCriteriaSearch by RICRoot which is not available!

The only place where it is available is Search/FuturesAndOptionsSearch but for some reason, the entire TRTH organization keeps pointing me at back at HistoricalCriteriaSearch? Why?

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.

Although TRTH resides in DSS, these products are different. HistoricalCriteriaSearch is a function in TRTH while FuturesAndOptionsSearch is a function in DSS.

This question is about TRTH so the TRTH support team will typically refer to the function available in TRTH which is HistoricalCriteriaSearch.

Click below to post an Idea Post Idea