Stock API — Real-Time & Historical Market Data for Quants & Exchanges

TickDB's stock API covers 25,000+ symbols across US, Hong Kong and China A-share markets, with real-time and historical market data for quant research, backtesting and exchange market data systems.

Three stock markets. 25,000+ symbols.

Total market symbols
25,285
China A-shares
7,570
US stocks
14,371
Hong Kong stocks
3,344

Data updated:

The stock API covers US, Hong Kong and China A-share markets. The combined market categories contain over 25,000 symbols, including instruments such as ETFs and bonds; this is not a common-stock count or a free-access list.

China A-shares

600519.SH · 000001.SZ · 920186.BJ

Shanghai, Shenzhen and Beijing stocks, with up to five order-book levels per side. Use trading sessions and calendars to distinguish auctions from continuous trading.

Explore this market — China A-shares

US stocks

AAPL.US · TSLA.US · MSFT.US

NYSE, Nasdaq and other US venues, with best bid and ask quotes. Pre-market, post-market and overnight coverage depends on the symbol and entitlement.

Explore this market — US stocks

Hong Kong stocks

700.HK · 9988.HK · 3690.HK

Hong Kong stock data with up to ten order-book levels per side. Follow pre-opening and intraday activity through quotes, depth and individual trades.

Explore this market — Hong Kong stocks

Stock market data for research and live applications

Real-time stock market data API

Query a quote snapshot over REST or subscribe to WebSocket updates for prices, volume and price changes. Event timestamps identify the data time; they are not an end-to-end latency guarantee.

Historical stock data and adjusted bars

Retrieve minute, hourly, daily, weekly and monthly bars with unadjusted, forward-adjusted or backward-adjusted prices. Record the query time and adjustment mode for backtests, and distinguish completed bars from the forming bar. History depends on entitlements and availability.

Stock quotes, order books and trades

Depth supports up to five levels per side for A-shares, ten for Hong Kong and one for US stocks. Actual depth varies with liquidity and session status. Depth and trades require paid entitlements and support spread monitoring, trade analysis and market displays.

Cross-market stock data API

Keep market suffixes such as .US, .HK, .SH, .SZ and .BJ when building a cross-market watchlist. Align trading days, time zones, currencies and price adjustments before comparing securities.

Stock API examples: REST, Python and WebSocket

These examples demonstrate the documented API, not live results. Confirm symbols and entitlements first. Keep your API key in a server-side environment variable. Python examples require requests or websockets respectively.

Quote snapshot
curl --fail-with-body -H "X-API-Key: $TICKDB_API_KEY" \
  "https://api.tickdb.ai/v1/market/ticker?symbols=AAPL.US,700.HK,600519.SH&type=stock"
Historical stock data in Python
import os
import requests

response = requests.get(
    "https://api.tickdb.ai/v1/market/kline",
    headers={"X-API-Key": os.environ["TICKDB_API_KEY"]},
    params={
        "symbol": "600519.SH", "type": "stock",
        "interval": "1d", "limit": 100, "adjust": "forward",
    },
    timeout=15,
)
response.raise_for_status()
result = response.json()
if result["code"] != 0:
    raise RuntimeError(result.get("message", "API error"))
print(result["data"])
WebSocket stock quotes
import asyncio
import json
import os
from urllib.parse import urlencode
import websockets

async def main():
    query = urlencode({"api_key": os.environ["TICKDB_API_KEY"]})
    async with websockets.connect(
        "wss://api.tickdb.ai/v1/realtime?" + query
    ) as ws:
        await ws.send(json.dumps({
            "cmd": "subscribe",
            "data": {
                "channel": "ticker", "type": "stock",
                "symbols": ["AAPL.US", "700.HK", "600519.SH"],
            },
        }))
        async for message in ws:
            print(json.loads(message))

asyncio.run(main())

Free is a 7-day trial for selected instruments, with quotes and permitted bar queries. It does not allow start_time/end_time historical ranges. Depth, trades and specified historical ranges require the appropriate entitlements; check the current plan for symbols and quotas.

Use Cases

Quant research and screening

Build a research universe from the symbol catalog, snapshots and historical bars. Calculate momentum and volatility, with screening coverage set by market entitlements.

Strategy backtesting

Evaluate strategies with historical prices and adjustment data. Track gaps, trading days and query times; the current catalog is not a historical constituent universe.

Exchange market data systems

Supply data for market displays, price references and cross-market monitoring. This is a data service, not order matching or execution. Confirm external display and redistribution rights under the applicable agreement.

FAQ

Which markets does the stock API cover?

The stock API covers US, Hong Kong and China A-share markets. The combined market categories contain over 25,000 symbols, including instruments such as ETFs and bonds; this is not a common-stock count or a free-access list.

How do I use a stock API in Python?

Use Python requests with the X-API-Key header and call /v1/market/ticker for symbols such as AAPL.US, 700.HK and 600519.SH. Subscribe to WebSocket ticker for ongoing updates. Access to example symbols depends on account permissions.

Should I use REST or a WebSocket stock API?

Use REST for on-demand snapshots and historical bars, and WebSocket for ongoing quote, depth and trade updates. Channels, subscription limits and coverage depend on your plan; full-market streams require the corresponding market entitlement.

How do I query historical bars?

Bars support 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 1d, 1w and 1M: lowercase m means minutes, uppercase M means months. start_time/end_time use milliseconds; the default is 100 bars, capped at 1,000. The last bar may still be forming. Historical access depends on entitlements and availability.

Which stock price adjustments are supported?

A-shares, Hong Kong and US stocks support adjust=none (default), forward and backward. Record the query time and adjustment mode for archives or backtests; adjusted historical prices can change with corporate actions or data updates.

Is there a free stock API trial?

Free is a 7-day trial for selected instruments, with quotes and permitted bar queries. It does not allow start_time/end_time historical ranges. Depth, trades and specified historical ranges require the appropriate entitlements; check the current plan for symbols and quotas.

Does the stock API execute or match orders?

Supply data for market displays, price references and cross-market monitoring. This is a data service, not order matching or execution. Confirm external display and redistribution rights under the applicable agreement.

Start Streaming Real-time Market Data

Sign up for a free API Key. WebSocket real-time streaming. Get started in minutes.