This skill retrieves Chinese financial market data via the Tushare Pro API, supporting 220+ data interfaces.
Quick Start
1. Token Configuration
Ask the user: Have you configured a Tushare Token?
If not configured, guide the user:
- Visit https://tushare.pro to register
- Get Token
- Configure environment variables:
export TUSHARE_TOKEN="your_token"
2. Verify dependencies
Check the Python environment:
python -c "import tushare, pandas; print('OK')"
If an error occurs, install dependencies:
pip install tushare pandas
Common Interfaces Quick Reference
| Data Type | Interface Method | Description |
|---|---|---|
| Stock list | pro.stock_basic() |
Get all stock lists |
| Daily quotes | pro.daily() |
Get daily quote data |
| Financial indicators | pro.fina_indicator() |
Financial indicators (ROE, etc.) |
| Income statement | pro.income() |
Income statement data |
| Index quotes | pro.index_daily() |
Index daily data |
| Fund net value | pro.fund_nav() |
Fund net value data |
| GDP data | pro.gdp() |
Gross domestic product |
| CPI data | pro.cpi() |
Consumer price index |
Complete interface list: See Interface Documentation Index
Data Retrieval Process
- Find interface: According to requirements, in Interface Index find the corresponding interface
- Read documentation: See
reference/接口文档/[接口名].mdto learn about parameters - Write code:
import tushare as ts # 初始化(使用环境变量中的 Token) pro = ts.pro_api() # 调用接口 df = pro.daily(ts_code='000001.SZ', start_date='20241201', end_date='20241231') - Return result: DataFrame format
Parameter Format Description
- Date: YYYYMMDD (e.g., 20241231)
- Stock code: ts_code format (e.g., 000001.SZ, 600000.SH)
- Return format:pandas DataFrame
Interface Documentation Reference
Interface Index:reference/README.md
Interface documentation is organized by category:
- Stock data (39 interfaces)
- Index data (18 interfaces)
- Fund data (11 interfaces)
- Futures and options (16 interfaces)
- Macroeconomics (10 interfaces)
- Hong Kong and US stocks (23 interfaces)
- Bond data (16 interfaces)
Reference Resources
- Tushare Official Documentation:https://tushare.pro/document/2
- API Testing Tools:https://tushare.pro/document/1