One stock API for US, Hong Kong and China A-share markets

Choose the data your application needs: current quotes for market dashboards, historical bars for research and backtesting, and order books and trades for market monitoring. TickDB provides REST queries and WebSocket streams. Available symbols, historical depth and usage rights depend on the plan and data availability.

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.

China A-share market data API

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.

US stock market data API

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.

Hong Kong stock market data API

Choose stock data for your use case

On small screens, scroll horizontally to view the full table.

Your taskData to useAccess methodWhat to check
Display prices or maintain a watchlistQuote snapshots and updatesREST queries or WebSocket streamsSymbol coverage, quote timestamps and entitlements
Research historical prices or backtestHistorical bars and price adjustmentsREST queriesHistorical depth, bar interval, adjustment settings and missing data
Monitor bid/ask prices and spreadsOrder-book dataREST queries or WebSocket streamsAvailable depth by market and account entitlements
Follow executed tradesTrade dataREST queries or WebSocket streamsQuery/subscription coverage and account entitlements

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())

Plans and data access

Trial access and paid entitlements differ. Confirm your symbols, historical depth, subscription limits, and access to order-book and trade data. External display and redistribution require confirmation of the applicable contract and permissions.

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.

Review plans and data access

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.

Market dashboards and watchlists

Display stock prices with quote snapshots and maintain cross-market watchlists with quote updates. Show quote timestamps and choose data according to symbol coverage and account entitlements.

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.