ARTICLE

How to expand Chain RIC using the Tick History REST API in Python

    Moragodkrit Chumsri
    Developer Advocate

Last Updated: Jan 2026

Overview

LSEG Tick History - REST API is a Representational State Transfer (REST)-compliant API that programmatically exposes Tick History functionality on the DataScope Select platform. Client applications can be written in most programming languages, such as C#, C++, Visual Basic, Java, Python, Objective-C, and Swift.

One of the favorite use cases for applications that use the legacy SOAP-based Tick History API is to use the API to expand a Chain RIC and get a RIC list. After getting the list, they can pass the list to retrieve some specific data using other Tick History functions and they can also export the list to other applications. This article will demonstrate how to use the new REST API to expand a Chain RIC and get a RIC list like the legacy API.

This example demonstrates how to interact with the LSEG Tick HIstory REST API without using.Net SDK. And we use Python programming language to demonstrate the API usages as it works as a script and it can work across OS. This example applies knowledge from Tick History document and tutorial from developer community website.

Introduction

The Legacy SOAP API has the ExpandChain method which will return a list of the RICs for all instruments that were part of the given chain at any time during the given time period. This Function expands the chain for the given RIC independently on each day in the requested range of dates and then collates the results as a single list of RICs. For the new REST API, clients can expand a chain RIC and get underlying RICs using HTTP endpoint /Search/HistoricalChainResolution. The API calls resolve current and past chain constituents given a Chain RIC. Instruments may be currently active, or inactive. It can be very time consuming on both SOAP and REST API. Try not to use this function with large ranges of dates.

HTTP Request

  • Endpoint URL:
  • Method: POST
  • Headers:
  • Body:
  • Sample Request Body

HTTP Response

  • Sample Response message

From the HTTP response, it presents the chain’s constituent RICs. Hence the application has to parse JSON object and get the RIC list by accessing the value of Constituents.

Python Example

Prerequisite

  • To run the example user should have python installed on OS. A user can download python installer from the link below. Basically, users can open the example with any text editor. There are free Python IDEs such as PyCharm Community edition and Visual Studio Code developers can use to open python source file.
  • In order to access the Tick History Endpoint, a user must have DSS account with permission to access Tick History’s REST API. Please contact your LSEG Account representative if you need a new account or additional permissions.
  • To use HTTP request and response, this example uses the Python 'requests' module. 
  • This example uses pandas data frames and some functions from numpy to parse and display data so you have to install pandas and numpy module.

Implementation

The example starts from importing the required Python modules so you need to import requests and JSON module to the example. It also requires pandas and numpy module to convert JSON data to the pandas data frame.

Authentication

To get an Authentication Token, the example will require a valid username and password and then send a new Authentication request to the DSS server to get a new Token. After it gets a new Token, it will pass the token to the Http request header. Below is the code for requesting a new token from the DSS server. If a user doesn’t want to get a new token as the old one still valid for 24 hours, feel free to modify RequestNewToken function to return valid token instead.

Expand Chain

Before sending an Http request with a post message to HistoricalChainResolution endpoint, it required the Authorization Token from the previous steps with JSON payload containing Chain RIC, start date and end date. Please find sample JSON payload from section Sample Request Body.

In order to get underlying RICs from HTTP response message(see section Sample Response message), the application has to access the Constituents list from JSON object and then convert the list to a pandas data frame. And then it can access RIC list under the Constituents list. Below is the python code from the example. It will print a data frame containing RIC name and Status to console.

Running example

To test the example, please run the following python command

>python ExpandChainREST.py

The example will ask a user to input DSS username and password then it will request a new Token and pass it to HTTP request as described. Feel free to change the following variables if you want to set chain RIC, start date, end date.

_chainRIC="0#.FTSE"

_startDate="2017-03-14T00:00:00.000Z"

_endDate="2017-03-15T00:00:00.000Z"

After running the example, it will display the following console output

Note

The time to expand chain is proportional to the number of days in the date range. Do not specify longer date ranges than necessary.

Source Code Downloads

The sources code can be downloaded from ExpandChain

Downloads

Article.RTH.Python.REST.ExpandChain

Request Free Trial

Help & Support

Already a customer?

Office locations

Contact LSEG near you