Skip to content

LSEG-API-Samples/Example.RDP.DataLibrary.Python.Async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concurrent Data Platform API Calls with Python Asyncio and Data Library for Python

  • Version: 1.0
  • Last update: June 2026
  • Environment: Python + JupyterLab + Data Platform Account
  • Prerequisite: Data Platform access/entitlements

Overview

This project is a semi-sequel to my Concurrent Data Platform API Calls with Python Asyncio and HTTPX project. That project shows how to use Python and the HTTPX library to make concurrent HTTP REST requests to LSEG Data Platform asynchronously. This project shifts away from manually sending HTTP REST requests and instead uses the easy-to-use LSEG Data Library for Python. The Data Library for Python Historical Pricing module offers the get_data_async method to request historical data asynchronously, letting developers send multiple requests concurrently without blocking the process.

Note: This project is based on the Data Library for Python version 2.1.1. The library behavior might change in future releases.

Throttling and Rate Limits

The Data Platform API request limits (throttles) to effectively manage and protect its service and ensure fair usage across the non-streaming content.

An application would receive an error from the API call if an application reached or exceeds a limit (especially with the Asynchronous HTTP calls). You required to make some necessary adjustments to rectify the interaction with the API and retry the respective API call.

Two different server errors on API request limits are:

HTTP Status Detail
429 Error Message: too many attempts
Description: A per account limit where the number of requests per second is limited for each account accessing the platform. If this limit is reached, applications will receive a standard HTTP error (HTTP 429 too many requests).
Suggestion: Please reduce the number of requests per second and retry.

Please find more detail regarding the Data Platform HTTP error status messages from the RDP API General Guidelines document page.

The Historical Pricing endpoint rate limits information is available on the Reference tab of the Data Platform API Playground page. The current rate limits (As of Mar 2026) is as follows:

historical rate limit


Prerequisites

  • Python 3.11+
  • LSEG Data Platform credentials with Historical Pricing permission:
    • Machine ID
    • Password
    • AppKey

Please your LSEG representative or account manager for the Data Platform Access


Project Structure

.
├── notebook/
│   ├── ld_notebook_async_gather.ipynb          # Main notebook
│   ├── ld_notebook_gather_performance.ipynb    # Asyncio Gather performance notebook
│   ├── lseg-data.config.json                   # Data Library logging configuration
│   ├── .env                                    # Platform Session credentials (not committed)
│   └── .env.example                            # Credentials template
├── images                                      # Project images folder
├── .venv                                       # Project Python virtual environment
├── LICENSE.md                                  # Project License
├── requirements.txt                            # Pinned Python dependencies
├── Article_Gather.md                           # The Asyncio Gather with Data Library article document
└── README.md                                   # The Project README file

Prerequisites

  • Python 3.11 or higher
  • A valid LSEG Data Platform account with:
    • API Key
    • Machine ID (username)
    • Password

Included Notebooks

Notebook Description
ld_notebook_async_gather.ipynb Demonstrates how to request multiple RICs concurrently using the Data Library Historical Pricing get_data_async method combined with asyncio.gather(). Covers Events and Summaries definitions, error handling for invalid RICs and fields, and how return_exceptions=True keeps all results — successes and failures — in one place.

Project Setup

  1. Create and activate a virtual environment
# Windows (PowerShell)
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# macOS / Linux
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies
(venv)$>python -m pip install --upgrade pip
(venv)$>python -m pip install -r requirements.txt
  1. Configure credentials

Copy .env.example to .env inside the notebook/ folder and fill in your credentials:

LSEG_API_KEY=your_api_key_here
LSEG_MACHINE_ID=your_machine_id_here
LSEG_PASSWORD=your_password_here
  1. Run the notebook

Open notebook/ld_notebook_async_gather.ipynb in JupyterLab or VS Code and run the cells in order.

(venv)$>notebook\jupyter lab notebook

Dependencies

Package Purpose
lseg-data LSEG Data Library for Python — market data access
jupyterlab Interactive notebook environment
python-dotenv Load credentials from .env without hardcoding them

See requirements.txt for pinned versions.


License

See LICENSE.md.


Reference

You can find more detail regarding the Data Library and Python Asyncio from the following resources:

For any question related to this example or Data Library, please use the Developers Community Q&A Forum.

About

A project to demonstrate how to request multiple historical data concurrently from Data Platform using Data Library for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors