This skill obtains Chinese financial market data through 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
- Obtain Token
- Configure environment variables:
export TUSHARE_TOKEN="your_token"
2. Verify Dependencies
Check the Python environment:
python -c "import tushare, pandas; print('OK')"
If there is an error, install dependencies:
pip install tushare pandas
Common Interface 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: View Interface Documentation Index
Data Retrieval Process
- Find Interface: According to requirements, in Interface Index find the corresponding interface
- Read Documentation: View
reference/接口文档/[接口名].mdto understand 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 Results: 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 Tool:https://tushare.pro/document/1