Tushare Alternative: Real-Time China A-Share and Hong Kong Stock Data API for Python

  1. iTick
  2. Market Data
Tushare Alternative: Real-Time China A-Share and Hong Kong Stock Data API for Python - iTick
Tushare Alternative: Real-Time China A-Share and Hong Kong Stock Data API for Python

Tushare Alternative: Real-Time China A-Share and Hong Kong Stock Data API for Python

Tushare is one of the most popular Python data interfaces for China markets, especially for research datasets and fundamentals. When a strategy moves from research to intraday or live trading, many quants pair it with - or replace it by - a real-time feed. Here is how Tushare Pro and iTick compare.

How Tushare Pro access works

Tushare Pro grants dataset permissions through a points system. Daily bars are available with basic points, richer datasets need more points, and minute-level data requires a separate permission. Rules change over time, so check tushare.pro for the current details.

Tushare Pro vs iTick

iTickTushare Pro
Access modelFree plan + monthly subscriptionsPoints-based permissions
Daily barsYesYes (basic points)
Minute barsIncludedSeparate permission
Real-time pushWebSocket (quote, tick, depth)Mainly HTTP pull
Level 2 order bookYesNo
Research datasets & fundamentalsCore fundamentalsVery broad
HK, US, forex, cryptoReal-timePartial

A common setup: Tushare for fundamentals and research datasets, iTick for real-time and intraday prices.

A-share quotes and minute bars in Python

Use region=SH for Shanghai, SZ for Shenzhen and HK for Hong Kong.

      import requests, pandas as pd

H = {"accept": "application/json", "token": "YOUR_API_TOKEN"}

for region, code in [("SH", "600519"), ("SZ", "000001"), ("HK", "700")]:
    q = requests.get("https://api.itick.org/stock/quote",
                     params={"region": region, "code": code}, headers=H).json()["data"]
    print(region, code, q["ld"])

# 1-minute bars for Kweichow Moutai
bars = requests.get("https://api.itick.org/stock/kline",
                    params={"region": "SH", "code": "600519", "kType": 1, "limit": 240},
                    headers=H).json()["data"]
df = pd.DataFrame(bars).rename(columns={"t": "time", "o": "open", "h": "high",
                                        "l": "low", "c": "close", "v": "volume"})
df["time"] = pd.to_datetime(df["time"], unit="ms")
print(df.tail())

    

Live A-share ticks over WebSocket

      import json, websocket

def on_open(ws):
    ws.send(json.dumps({"ac": "subscribe",
                        "params": "600519$SH,000001$SZ,700$HK",
                        "types": "quote,tick,depth"}))

ws = websocket.WebSocketApp("wss://api.itick.org/stock",
                            header={"token": "YOUR_API_TOKEN"},
                            on_open=on_open,
                            on_message=lambda ws, m: print(json.loads(m)))
ws.run_forever(ping_interval=20)

    

For backtesting with this data, see Python backtesting with iTick historical data.

FAQ

What is Tushare? A Python financial data interface widely used for China market research; Tushare Pro uses a points system for access.

Is there a Tushare alternative with real-time A-share data? Yes - iTick provides real-time quotes, ticks and Level 2 depth for SSE, SZSE and HKEX stocks.

Do I need points for minute data on iTick? No. Minute K-lines are part of the stock API.

Can I use iTick and Tushare together? Yes, and many teams do.


Get a free iTick API key and query Shanghai, Shenzhen and Hong Kong stocks in minutes.