RepositoryPythonGBUnited Kingdom
londonstrategicedge

londonstrategicedge/lse-data

Live and historical market data for: Stocks, FX, crypto, commodities, indices and ETFs over WebSocket and REST.

357stars
54forks
14issues
1views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: websocket

#1 Repository of the week

1
TINIX TRENDING·Topic: financial-api

#1 Repository of the week

1
TINIX TRENDING·Topic: etf

#1 Repository of the week

lse-data

A Python client for London Strategic Edge market data. Stream live prices and download history with the same key.

PyPI Python Licence Downloads

pip install lse-data
from lse import LSE

client = LSE(api_key="your_key")
for tick in client.stream(["BTC/USD", "AAPL"]):
    print(tick.symbol, tick.price)

It covers stocks, forex, crypto, commodities, indices, ETFs, futures and options, plus macro economics series and government bond yields. Live ticks come over a websocket. Every historical read is served from the LSE vault, the ClickHouse store behind the platform, which holds the full recorded tape: US stocks back to 2003, FX to 2009, crypto to 2017, options prints to 2014, and 14,000+ economics series, some reaching back over a century. Get a key at londonstrategicedge.com/data.

How it compares

lse-datayfinanceAlpha VantageFinnhub
Live websocketyesnonoyes
Historical candlesyesyesyesyes
Tick historyyesnonopaid
Asset classesstocks, FX, crypto, commodities, indices, ETFs, futures, optionsequities focusstocks, FX, cryptostocks, FX, crypto
Official APIyesno, scrapes Yahooyesyes
Costfreefreefree + paidfree + paid

Streaming and download share one allowance. GET /vault/usage (with your key) reports where you stand.

Download history

The same key reads the vault over REST: candles at fourteen resolutions for any instrument, plus the reference sets (economic calendar, insider trades, dividends, splits, COT positioning, financial statements, company profiles, fundamentals, bond yields).

from lse import LSE

client = LSE(api_key="your_key")

# OHLCV candles. timeframe: 1s, 5s, 15s, 30s, 1m, 3m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1mo
candles  = client.candles("BTC/USD", "1d", start="2026-01-01")
intraday = client.candles("AAPL", "1h", limit=200, order="desc")
fine     = client.candles("EUR/USD", "5s", start="2026-07-01", end="2026-07-02")

# Macro series and yields: (date, value) rows, any series in one call
cpi      = client.economics("cpi_yoy")            # US inflation back to 1914
ffr      = client.series("fdtr", start="1980-01-01")
bund     = client.series("DE10Y")

# Reference and event feeds
events   = client.economic_calendar(region="US", start="2026-04-01")
insiders = client.insider_trades("WRB", type="P-Purchase")
divs     = client.dividends("AAPL")
splits   = client.splits("NVDA")
cot      = client.cot("GC")        # COT uses futures codes: GC gold, CL crude, ES S&P
reports  = client.financial_reports("AAPL", report_type="income", period="FY")
profile  = client.company_profiles("NVDA")
funda    = client.fundamentals("MSFT")
yields   = client.bond_yields("US10Y", start="2000-01-01")

Each call returns a list of dicts. A call that fails raises LSEError:

from lse import LSEError

try:
    client.candles("BTC/USD", "1m")
except LSEError as e:
    print(e.status, e.message)

A call returns one page of rows. Page through more with start and end, or pull the whole range at once with history() below.

Deep history as Parquet

Interactive calls page; bulk pulls do not have to. history() runs an export job in the vault, waits, and downloads the finished Parquet file with resume support. With pip install 'lse-data[frames]' it returns a DataFrame directly. Each history() or dataset() call is one export job, and plans include an hourly export budget (GET /vault/usage shows where you stand), so space bulk pulls out rather than firing them in a burst.

df = client.history("AAPL", timeframe="1m", start="2015-01-01")   # candles
df = client.history("EUR/USD")                                    # the raw tick tape
df = client.dataset("insider_trades")                              # a whole reference set
df = client.economics("fdtr")                                      # one macro series, full depth
client.datasets("crypto")                                          # what the vault holds per class

Options

Start from a ticker or a company name and get the chain, then drill into one contract. The chain gives you each contract's ticker, and the SDK builds one from its parts when you address a contract directly.

chain  = client.options("apple", type="call", max_dte=30)
prints = client.options_flow("NVDA", min_premium=100_000)
bars   = client.option_candles("AAPL", strike=300, expiry="2026-06-12", type="call")
names  = client.options_underlyings()

options() returns the chain: one row per contract with the latest price, implied volatility, greeks, and the volume and premium traded today. options_flow() returns individual prints with premium and greeks at print time; omit the underlying to see every name at once, and use start/end to reach older prints, which the vault keeps. option_candles() returns 1 minute bars for a single contract and accepts either an OSI ticker from the chain or the parts, in which case the SDK builds the ticker. Implied volatility and greeks come from our own pricing models.

For live option ticks over the WebSocket, subscribe_options(["AAPL"]) delivers every AAPL contract on one subscription, parsed into OptionTick objects.

Find instruments

catalog() lists everything you can stream or download, live from the vault: one row per dataset and symbol with its name, category, tick count and history span.

client.catalog()              # every instrument, 22,000+ rows
client.catalog("stocks")      # [{"symbol": "AAPL", "name": "Apple Inc.", "category": "Stocks", ...}, ...]
[x["symbol"] for x in client.catalog("forex")]

Categories are stock, forex, crypto, etf, commodity, index, options, futures, economics, bonds, volatility, interest rates and currency index. Use a symbol straight in stream, candles or history.

Stream live data

from lse import LSE

client = LSE(api_key="your_key")
for tick in client.stream(["BTC/USD", "ETH/USD", "AAPL"]):
    print(tick.symbol, tick.price)

Use callbacks instead of a loop:

client = LSE(api_key="your_key")
client.on("tick", lambda t: print(t.symbol, t.price))
client.connect(["BTC/USD"])

Events are tick, connected, authenticated, disconnected and error.

Change subscriptions while connected:

client.subscribe(["SOL/USD"])
client.unsubscribe(["BTC/USD"])
client.subscribe_options(["AAPL"])   # every AAPL contract at once

Replay then live

Pass start and the server sends history from that point, then carries on with live ticks on the same connection. History goes back up to 24 hours.

for tick in client.stream(["BTC/USD"], start="2026-06-01T09:00:00"):
    print("replay" if tick.replay else "live", tick.symbol, tick.price)

Async

import asyncio
from lse import LSE

async def main():
    client = LSE(api_key="your_key")
    async for tick in client.stream_async(["BTC/USD"]):
        print(tick)

asyncio.run(main())

The key

Pass it directly, or set it in the environment:

client = LSE(api_key="your_key")

import os
os.environ["LSE_API_KEY"] = "your_key"
client = LSE()

LSE also works as a context manager, which disconnects on exit:

with LSE() as client:
    for tick in client.stream(["BTC/USD"]):
        ...

A tick carries symbol, price, bid, ask, volume, timestamp (an ISO 8601 string), name and replay. Use tick.datetime for the timestamp as a parsed datetime.

Command line

lse auth lse_live_xxxxxxxxxxxx
lse stream BTC/USD AAPL

Licence

MIT. See LICENSE.

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
TickDB/tickdb-unified-realtime-marketdata-api

TickDB: AI-native real time stock API and market data API for US/HK/CN stocks, forex, futures, crypto, indices and commodities. Skill, CLI, MCP, REST API and WebSocket. AI 原生实时股票 API 与金融行情数据 API,覆盖美股、港股、A股、外汇、期货、指数、大宗商品、加密货币。

950
Nov 6, 2026
RepositoryJava
AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api

AllTick real-time financial market data API with REST and WebSocket access to stocks, forex, crypto, commodities, and indices.

631
Sep 28, 2026
RepositoryPython
ranaroussi/yfinance

Download market data from Yahoo! Finance's API

26.0k
Nov 26, 2026
RepositoryPython
simonlin1212/a-stock-data

A股全栈数据工具包:行情K线·当日逐笔·研报·信号·资金面·新闻·财务·公告·打板·ETF期权·舆情·宏观利率·期货大宗(含大商所日K)·事件驱动·可转债 | 15层·87端点·34数据源·除iwencai外免Key | A-share data for AI agents: K-lines, ticks, reports, fund flow, news, financials, filings, options, macro, futures, events, convertibles | 15 layers·87 endpoints·34 sources

12.2k
Nov 28, 2026
RepositoryPython
alpacahq/alpaca-py

The Official Python SDK for Alpaca API

1.6k
Dec 1, 2026
RepositoryPython
rootSunc/CNEquity

开源中国股市(A股)本地数据湖:沪深股票行情、A股股票数据与金融数据,面向量化研究、量化交易与回测,含财务数据、期货数据、资金流向、公告、指数行业与宏观。86个日更数据集,复权与历史成分内置,行级溯源、PIT,MCP原生。免注册、免 Token,自托管。Open-source China stock market data lake for quant research, backtesting and AI agents.

1.1k
Nov 24, 2026
RepositoryPython
TreborNamor/TradingView-Machine-Learning-GUI

HyperView is a terminal-first TradingView strategy lab for downloading market data, backtesting Python strategies with Pine-like behavior, and optimizing SL/TP parameters.

1.0k
Aug 18, 2026
RepositoryPython
defeat-beta/defeatbeta-api

An open-source alternative to Yahoo Finance's market data APIs with higher reliability.

813
Nov 10, 2026
RepositoryPython
Glyphack/pytse-client

work with Tehran stock exchange data 💹 in Python

315
Nov 27, 2026