Last Updated: Jan 2026
Introduction
LSEG Tick History is an Internet-hosted product on the DataScope Select platform that provides SOAP-based and a REST API for unparalleled access to historical high-frequency data across global asset classes dating to 1996. However, a legacy SOAP-based API is also available and is scheduled to be sunset. Therefore client who still uses SOAP-based API may need to migrate their application to use REST API instead.
One of the main use cases for an application using Tick History API is to use the API requesting Time and Sales data for RICs. For SOAP-based API, the client can use the SubmitRequest method to request Time and Sales data. To migrate to the new API, the client has to re-implement the application to use REST instead.
This example demonstrates how to use the new REST API to request Time and Sales data. The example also explains how to interact with the REST API by not using the REST API Toolkit.Net SDK. Instead, it uses Python programming to demonstrate the API usages as Python script can work across OS and very easy to deal with the HTTP request. This example applies the steps provided in the Tick History REST API tutorial section, which locates on Developer Portal to implement the Python example.
On-Demand extraction request
Basically, there are two kinds of Tick History custom solution that are
- On-Demand extractions- all report attributes specified in the single HTTP request that is submitted to run immediately.
- Stored & scheduled- The user defines report attributes, stored for future use, and schedules the report to run at set times or triggered by events.
This example uses only On-Demand extraction to request Tick data/Tick History Time and Sales. However, the raw data extraction workflow can apply to several types of On Demand historical data requests:
More details can be found at Tick History API User Guide
This example uses the following steps to implement On Demand Extraction:
1. Get Authentication Token from DSS server.
2. Retrieve available field list from the server (optional). We will skip this steps as the example will import or read reqeust payload from JSON file so we will specify required field list in JSON file instead.
3. Request historical data from the server, using an on demand extraction request. The request will be queued, then executed.
4. Check the request status. Poll it until the request is completed and get JobID.
5. Retrieve the data using the JobID from step 4 and write it to file.
On-Demand Tick Data extraction request payload
In this request we need to:
- Specifying the instrument on which we are reporting.
- Specifying the type of report (Time and Sales)
- Specifying the Time and Sales report type’s Quote and Trade fields to include in the report.
- Specifying the report’s date range and other conditions.
- Submitting the report request to run immediately.
1. Authentication Request
To access Tick Historical data, we have to pass Token to the request header, therefore the first step is to get a new Token from DSS server. This example will apply the method to send an Authentication request from Programming without SDK Tutorial to send a request.
2. Send On-Demand Request
HTTP Request
- Endpoint URL:
- Method: POST
- Headers:
Body:
The body of the request must mention it is an extraction request. It contains several parts:
* **The type of extraction**: as we want tick data we set a value of **TickHistoryTimeAndSalesExtractionRequest**.
* **The list of field name**s: these were determined in the previous step of this tutorial.
* **The list of instrument identifiers**, each one with its type. Below sample, we define one instrument using a RIC.
* **The conditions**: they include the date range for the request.
Please find available parameters from Tick History REST API User Guide.
- Sample JSON HTTP request payload
HTTP response
- After we send an HTTP request message to the DSS server, the application will receive response message back and we expected to receive HTTP response status code of 202 Accepted, and the header will contain a location URL.
The next step is to check the request status by polling the location URL regularly until it returns an HTTP response status code 200 OK.
- If the request is for a small amount of data, the response could have an HTTP status of 200 OK, and the body will contain a jobId and Notes. According to DATASCOPE SELECT document, the Notes provides information about the extraction execution, including processing statistics, embargo delays, suppressed items, and warnings.
- We skip the step where we check the request status and go directly to the last step, which is to retrieve the data using the jobId. Other HTTP status codes can be encountered, follow this link for a full list with detailed explanations. It is strongly recommended that the code handle all possible status codes.
3. Check request status
HTTP request
Skip this step if the previous step returned an HTTP status of 200 OK.
If the previous step returned an HTTP status of 202 Accepted, this step must be executed and repeated in a polling loop until it returns an HTTP status of 200 OK.
- URL:
This is the location URL, taken from the 202 response header received in the previous step.
- Method: GET
- Headers:
HTTP response
If we receive an HTTP status 202 Accepted response (the same as in the previous step), it means the request has not yet completed. We must wait a bit and check the request status again. If we receive an HTTP status 200 OK response, the body will contain a jobId and Notes and we can go to the last step to retrieve the data using the jobId.
4.Retrieve data
HTTP request
It is mandatory to have received a 200 OK response with a JobID from a previous step before proceeding with this last step.
- URL:
Note the jobId value (0x058dcda3c29b5841) used as parameter in the URL:
- Method: GET
- Headers:
- Prefer: respond-async
- Content-Type: Accept-Encoding: gzip, deflate
- Authorization:
HTTP response
We should get a response of this type:
Relevant headers:
Body:
Python Example
Prerequisite
- To run the example user should have python 2.7 or 3.6 installed on OS. User can download python installer from below link. Basically, the user can open the example with any text editor. There are a free Python IDE such as PyCharm Community edition and Visual Studio Code user can use to open python source file.
- In order to access the Tick Historical end point, the user must have DSS account with permission to access Tick Historical’s REST API. Please contact LSEG Account representative if you need a new account or additional permission.
- To use HTTP request and get responses back, This example use Python requests module. If user don’t have requests installed in python library, please run below pip install command to install requests module.
pip install requests
Step1: Get Authentication Token from DSS server.
Ask the user to input DSS username and password and then send an authentication request to DSS server to get a new Authentication Token.
Step2: Send On Demand Extraction request.
We have to import request and json module in the example. The json module is required to manage JSON data in the HTTP request and response.
Request historical data from the server, using an on demand extraction. We need to pass json_payload which is request body to the server.
To pass json_payload to HTTP post, we read the JSON request message from JSON file.
Step3: Polling request status from the server.
We have to check the request status. This example uses a simple pooling loop to check status until it get status code 200 (Completed). Then we can get jobID from the response body.
Step4: Retrieve the data using the JobID and Write to file.
We use reqeusts.get to retrieve result and then write the content of the response message to file. Then we use dataframe to read file .csv.gz and print sample data to console.
There are four parameters that the user can configure in this example.
- The output file path (_outputFilePath) ,
- File name used to write output file(_outputFileName),
- The _retryInterVal is the time that the example will wait and check for the status code of the request. Note thatYou could set a short polling time to actually see that the initial responses have status 202, followed by a status 200. But in production code, you would set a reasonable polling interval of 30 seconds, following the best practices.
- JSON file name that the example used to import the JSON request body and pass it to the HTTP request message. See sample JSON data from section Sample JSON HTTP request payload.
How to run the example
This example requires JSON file "TickHistoricalRequest.json" which contains JSON payload for the HTTP request. We can modify the JSON file to change the request body.
Command line
python.exe TickHistoryTimesAndSalesRequest.py
Then we should see the following console output
The sources codes can be downloaded from TickHistoryTimesAndSalesExample
DOWNLOADS