tushare-finance: 220+ Chinese Financial Data APIs for Your AI Agent
With 11,800+ downloads and 110 installs, tushare-finance is the go-to financial data skill for Chinese market analysis on ClawHub. It wraps the Tushare Pro API — one of the most comprehensive free-to-use Chinese financial data platforms — giving OpenClaw agents access to 220+ data endpoints covering A-shares, H-shares, US-listed stocks, funds, futures, bonds, and macro indicators.
The Problem It Solves
Getting clean, structured Chinese financial data is surprisingly hard. Official exchange data is fragmented. Bloomberg and Wind require expensive subscriptions. Most Python finance libraries focus on US markets. Tushare Pro fills this gap — but setting up the API client, remembering 220+ endpoint names, and translating between data requirements and specific method calls takes expertise.
tushare-finance provides the expertise as a skill. Your agent knows which interface to call for each data type, what parameters to pass, and how to interpret the results.
Core Concept
The skill uses the tushare Python library with your personal Tushare Pro token. All data comes back as pandas DataFrames — the standard format for financial data analysis in Python.
import tushare as ts
pro = ts.pro_api() # reads TUSHARE_TOKEN from env
# Any of 220+ endpoints, same pattern
df = pro.daily(ts_code='000001.SZ', start_date='20241201', end_date='20241231')The skill's intelligence lies in knowing which of the 220+ endpoints corresponds to each data request, and translating natural language requests into the right API call.
Deep Dive
Data Categories
Tushare Pro's endpoints are organized across major categories:
| Category | Endpoints | Examples |
|---|---|---|
| Stock Data | 39 endpoints | Daily prices, real-time quotes, IPO calendar |
| Index Data | 18 endpoints | SSE/SZSE/CSI indices, index components |
| Fund Data | 11 endpoints | NAV, fund portfolio, fund manager history |
| Futures | Multiple | Daily/minute data, position limits |
| Bonds | Multiple | Bond issuance, yield curve data |
| Macro Economy | Multiple | GDP, CPI, PPI, PMI, M2, FX reserves |
| Financial Reports | Multiple | Income statement, balance sheet, cash flow |
Stock Data — Most Used Endpoints
# Daily OHLCV for a stock
df = pro.daily(ts_code='600519.SH', start_date='20240101', end_date='20241231')
# → date, open, high, low, close, vol, amount
# All listed stocks
df = pro.stock_basic(exchange='', list_status='L')
# → ts_code, symbol, name, area, industry, list_date
# Real-time quote snapshot
df = pro.daily(ts_code='000001.SZ', trade_date='20241231')Financial Reports
# Income statement
df = pro.income(ts_code='600036.SH', start_date='20240101', end_date='20241231')
# Balance sheet
df = pro.balancesheet(ts_code='600036.SH', period='20241231')
# Key financial indicators (ROE, ROA, PE, etc.)
df = pro.fina_indicator(ts_code='000858.SZ', start_date='20240101', end_date='20241231')Macroeconomic Data
# GDP
df = pro.gdp(start_q='2020Q1', end_q='2024Q4')
# CPI — consumer price index
df = pro.cpi(start_m='202001', end_m='202412')
# M2 money supply
df = pro.money_supply(start_m='202001', end_m='202412')
# Exchange rates
df = pro.fx_daily(ts_code='USDCNY.CFETS', start_date='20240101', end_date='20241231')Index Data
# Index daily data (CSI 300)
df = pro.index_daily(ts_code='399300.SZ', start_date='20240101', end_date='20241231')
# Index components (who's in the CSI 300 right now)
df = pro.index_weight(index_code='399300.SZ', trade_date='20241231')Stock Code Format
A critical convention: Tushare uses ts_code format — {symbol}.{exchange}:
| Exchange | Code | Example |
|---|---|---|
| Shanghai Stock Exchange | .SH | 600519.SH (Kweichow Moutai) |
| Shenzhen Stock Exchange | .SZ | 000001.SZ (Ping An Bank) |
| Beijing Stock Exchange | .BJ | 430047.BJ |
| Hong Kong | .HK | 00700.HK (Tencent) |
Dates use YYYYMMDD format (no dashes): 20241231, not 2024-12-31.
Setup
clawhub install tushare-financeGet your Tushare token at tushare.pro (free registration):
export TUSHARE_TOKEN="your_tushare_token_here"Verify the Python dependencies:
python -c "import tushare, pandas; print('OK')"
# If missing: pip install tushare pandasComparison: Chinese Financial Data Sources
| Source | Cost | Coverage | API Quality | Agent-native |
|---|---|---|---|---|
| tushare-finance | Free (Tushare Pro) | A+H+US+macro | ✅ pandas | ✅ |
| Wind (万得) | ¥10,000+/year | Comprehensive | ✅ | ❌ |
| Bloomberg | $2,000+/month | Global | ✅ | ❌ |
| akshare (Python lib) | Free | A-share focus | ✅ | ⚠️ no skill |
| Raw exchange data | Free | Limited | ❌ complex | ❌ |
Tushare Pro's free tier has rate limits and some premium endpoints require points (earned through community contribution), but the free tier covers the most commonly needed data.
Practical Tips
- Cache heavy queries — historical data doesn't change; save DataFrames locally to avoid hitting rate limits on repeated analysis
- Use
stock_basic()first — always start by fetching the full stock list to validate ts_codes before querying price data - Date format discipline —
YYYYMMDDthroughout, no exceptions; wrong format returns empty DataFrames without error - Batch by date, not by stock — Tushare's
trade_dateparameter returns all stocks for that date; more efficient than looping per stock - Points system awareness — some advanced endpoints (e.g., Lv2 data, institutional holdings) require Tushare points; check endpoint documentation before relying on them
Considerations
- Rate limits on free tier: Tushare Pro's free tier allows ~200 calls/minute. Heavy backtesting or large-scale screening may hit limits.
- Historical depth varies: Most equity data goes back to 2000+; some macro indicators have shorter history.
- Data quality: Tushare Pro is community-maintained. Occasional gaps or adjustments exist, especially around corporate actions (splits, dividends). Always validate critical data points.
- Mainland China focus: While H-share and US data is available, depth and frequency is strongest for A-share markets.
The Bigger Picture
Chinese financial markets are the second-largest in the world, yet English-language tooling and AI agents overwhelmingly default to US market data. tushare-finance corrects this gap — giving agents access to the same data that Chinese quant funds and analysts use, without expensive subscriptions or custom API integrations.
For agents doing portfolio analysis, earnings research, or macroeconomic modeling with a China focus, this skill is the foundation everything else builds on.
View the skill on ClawHub: tushare-finance