LSEG Data Platform Python Client

raw JSON →
2.1.1 verified Fri May 01 auth: no python

A Python client library for accessing the London Stock Exchange Group (LSEG) Data Platform APIs, including real-time and historical data. Current version: 2.1.1. Released under the Apache-2.0 license with regular updates.

pip install lseg-data
error ImportError: cannot import name 'LsegData' from 'lseg'
cause Trying to import from the top-level 'lseg' package instead of 'lseg.data'.
fix
Use from lseg.data import LsegData.
error NameError: name 'Credentials' is not defined
cause Forgot to import the Credentials class, or imported from wrong module.
fix
Add from lseg.data.auth import Credentials.
error lseg.data.exceptions.AuthenticationError: Invalid credentials
cause App key is missing, expired, or invalid.
fix
Ensure LSEG_APP_KEY environment variable is set with a valid key.
breaking In v2.0.0, the credential class moved from `lseg.data.credentials` to `lseg.data.auth`. Old imports will break.
fix Use `from lseg.data.auth import Credentials` instead of `from lseg.data.credentials import Credentials`.
breaking The `get_history()` method no longer accepts `instrument` (singular) parameter; use `instruments` (list) only.
fix Pass a list to 'instruments' even for a single instrument, e.g., `instruments=['AAPL.O']`.
gotcha The library requires Python >=3.9. Using older Python versions will raise ImportError.
fix Upgrade Python to 3.9 or later.
gotcha API keys must be granted appropriate entitlements; otherwise requests return authorization errors.
fix Verify your LSEG app key has access to the requested data products.

Initialize LSEG Data client with app key and fetch historical prices.

import os
from lseg.data import LsegData
from lseg.data.auth import Credentials

creds = Credentials(app_key=os.environ.get('LSEG_APP_KEY', ''))
client = LsegData(credentials=creds)
df = client.get_history(
    instruments=['IBM.N'],
    fields=['TR.PriceClose'],
    start_date='2025-01-01',
    end_date='2025-01-31'
)
print(df.head())