1---2name: tushare-data3description: This skill should be used when the user asks '查一下XX的行情', '拉一下财务数据', '估值数据', 'PE/PB多少', '股东变化', '业绩预告', or when any analysis/research task needs A-share market data, financial statements, valuation metrics, or shareholder data. Tushare Pro is the PRIMARY structured data source — more stable and comprehensive than AKShare. Requires a TUSHARE_TOKEN env var (your own Tushare Pro token).4---56# Tushare Data78Primary structured data source for A-share investment research via the [Tushare Pro](https://tushare.pro) API. A thin CLI wrapper (`scripts/fetch_tushare.py`) over the `tushare` Python SDK.910## When to Use1112- Any task needing stock fundamentals, valuation, or financial statements13- Preferred over AKShare for: financial statements, PE/PB/PS, shareholder data, earnings forecasts14- AKShare remains preferred for: ETF data, sector fund flows, northbound capital (Tushare needs higher points)1516## Setup17181. Get a token: register at https://tushare.pro and copy your API token from the user center. Financial-statement interfaces need ~2000 points.192. Install deps and export your token:2021```bash22python3 -m venv .venv23.venv/bin/pip install tushare pandas24export TUSHARE_TOKEN=<your Tushare Pro token> # never hard-code this25PY=.venv/bin/python326```2728The script reads the token from the `TUSHARE_TOKEN` env var (or a `--token` flag). Keep it in your shell profile or a secret manager, not in the skill.2930## Available Interfaces3132### Market Data33| Mode | Description | Key Fields |34|------|-------------|------------|35| `daily` | Daily OHLCV | open, high, low, close, vol, pct_chg |36| `weekly` | Weekly OHLCV | Same as daily |37| `monthly` | Monthly OHLCV | Same as daily |38| `daily_basic` | Daily valuation | PE, PE_TTM, PB, PS, turnover, total_mv, circ_mv, dv_ratio |39| `adj_factor` | Adjustment factor | For computing forward/backward adjusted prices |40| `stock_basic` | Stock list | ts_code, name, industry, area, list_date, act_name |41| `trade_cal` | Trading calendar | cal_date, is_open, pretrade_date |4243### Financial Statements44| Mode | Description | Key Fields |45|------|-------------|------------|46| `income` | Income statement | revenue, total_revenue, n_income, basic_eps, ebit, ebitda |47| `balancesheet` | Balance sheet | total_assets, total_liab, total_hldr_eqy, inventories |48| `cashflow` | Cash flow | n_cashflow_act, n_cashflow_inv_act, free_cashflow |49| `fina_indicator` | Financial ratios | ROE, ROA, grossprofit_margin, netprofit_margin, current_ratio, debt_to_assets, netprofit_yoy |5051### Earnings & Dividends52| Mode | Description | Key Fields |53|------|-------------|------------|54| `forecast` | Earnings forecast | type (预增/预减/扭亏/首亏), net_profit_min/max, p_change_min/max |55| `express` | Earnings express | Quick earnings release before full report |56| `dividend` | Dividends | cash_div, stk_div, record_date, ex_date |5758### Shareholder & Capital59| Mode | Description | Key Fields |60|------|-------------|------------|61| `top10_holders` | Top 10 shareholders | holder_name, hold_amount, hold_ratio, hold_change |62| `stk_holdernumber` | Shareholder count | Tracks concentration/dilution |63| `moneyflow` | Capital flow | Net inflow by trade size |64| `margin` | Margin trading | Market-wide margin data |6566### Index & Fund67| Mode | Description | Key Fields |68|------|-------------|------------|69| `index_daily` | Index OHLCV | Same as daily for indices |70| `index_weight` | Index components | con_code, weight |71| `fund_basic` | Fund list | name, fund_type, management |72| `concept` | Concept themes | Thematic stock groups |73| `concept_detail` | Concept members | Stocks in each concept |7475## Command Reference7677```bash78# Stock info79$PY scripts/fetch_tushare.py --mode stock_basic --symbols 002463.SZ8081# Daily price (date range)82$PY scripts/fetch_tushare.py --mode daily --symbols 002463.SZ --start 20260101 --end 202603178384# Daily valuation (PE/PB/turnover/market cap)85$PY scripts/fetch_tushare.py --mode daily_basic --symbols 002463.SZ --start 202603018687# Income statement / ratios / balance sheet / cash flow88$PY scripts/fetch_tushare.py --mode income --symbols 002463.SZ89$PY scripts/fetch_tushare.py --mode fina_indicator --symbols 002463.SZ90$PY scripts/fetch_tushare.py --mode balancesheet --symbols 002463.SZ91$PY scripts/fetch_tushare.py --mode cashflow --symbols 002463.SZ9293# Earnings forecast / dividends / shareholders94$PY scripts/fetch_tushare.py --mode forecast --symbols 002463.SZ95$PY scripts/fetch_tushare.py --mode dividend --symbols 002463.SZ96$PY scripts/fetch_tushare.py --mode top10_holders --symbols 002463.SZ97$PY scripts/fetch_tushare.py --mode stk_holdernumber --symbols 002463.SZ9899# Index components (CSI 300) / concept themes100$PY scripts/fetch_tushare.py --mode index_weight --symbols 000300.SH101$PY scripts/fetch_tushare.py --mode concept102```103104## Tushare vs AKShare Decision Guide105106| Need | Use Tushare | Use AKShare |107|------|-------------|-------------|108| Daily OHLCV | ✅ More stable | Backup |109| PE/PB/PS valuation | ✅ daily_basic | Limited |110| Financial statements | ✅ Structured, typed | Basic summary |111| Earnings forecast | ✅ forecast/express | Not available |112| Shareholder data | ✅ top10_holders | Not available |113| Dividend data | ✅ dividend | Not available |114| ETF search/data | Use AKShare | ✅ Better coverage |115| Northbound capital | Use AKShare | ✅ Free |116| Sector fund flows | Use AKShare | ✅ Free |117| Limit-up/down pool | Use AKShare | ✅ Free |118119(For AKShare-based fetching, see the sibling `stock-market-data` and `financial-data-fetcher` skills.)120121## Rules1221231. **Always set TUSHARE_TOKEN env var** before calling the script — never hard-code it1242. **Tushare stock codes use suffix**: .SZ (Shenzhen), .SH (Shanghai), .BJ (Beijing)1253. **Date format**: YYYYMMDD (no dashes)1264. **Rate limit**: ~50 requests/minute at 2000 points level1275. **Financial data lag**: statements available after company announces (check ann_date)