agentleFS
HaochenhustHaochenhust/ch-skills/skills/tushare-data/SKILL.md

tushare-data

Skill9 starsChanged 4 months agoMITView on GitHub

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).

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always set TUSHARE_TOKEN env var: before calling the script — never hard-code it

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tushare Data

Primary structured data source for A-share investment research via the Tushare Pro API. A thin CLI wrapper (scripts/fetch_tushare.py) over the tushare Python SDK.

When to Use

  • Any task needing stock fundamentals, valuation, or financial statements
  • Preferred over AKShare for: financial statements, PE/PB/PS, shareholder data, earnings forecasts
  • AKShare remains preferred for: ETF data, sector fund flows, northbound capital (Tushare needs higher points)

Setup

  1. Get a token: register at https://tushare.pro and copy your API token from the user center. Financial-statement interfaces need ~2000 points.
  2. Install deps and export your token:
python3 -m venv .venv
.venv/bin/pip install tushare pandas
export TUSHARE_TOKEN=<your Tushare Pro token>      # never hard-code this
PY=.venv/bin/python3

The 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.

Available Interfaces

Market Data

ModeDescriptionKey Fields
dailyDaily OHLCVopen, high, low, close, vol, pct_chg
weeklyWeekly OHLCVSame as daily
monthlyMonthly OHLCVSame as daily
daily_basicDaily valuationPE, PE_TTM, PB, PS, turnover, total_mv, circ_mv, dv_ratio
adj_factorAdjustment factorFor computing forward/backward adjusted prices
stock_basicStock listts_code, name, industry, area, list_date, act_name
trade_calTrading calendarcal_date, is_open, pretrade_date

Financial Statements

ModeDescriptionKey Fields
incomeIncome statementrevenue, total_revenue, n_income, basic_eps, ebit, ebitda
balancesheetBalance sheettotal_assets, total_liab, total_hldr_eqy, inventories
cashflowCash flown_cashflow_act, n_cashflow_inv_act, free_cashflow
fina_indicatorFinancial ratiosROE, ROA, grossprofit_margin, netprofit_margin, current_ratio, debt_to_assets, netprofit_yoy

Earnings & Dividends

ModeDescriptionKey Fields
forecastEarnings forecasttype (预增/预减/扭亏/首亏), net_profit_min/max, p_change_min/max
expressEarnings expressQuick earnings release before full report
dividendDividendscash_div, stk_div, record_date, ex_date

Shareholder & Capital

ModeDescriptionKey Fields
top10_holdersTop 10 shareholdersholder_name, hold_amount, hold_ratio, hold_change
stk_holdernumberShareholder countTracks concentration/dilution
moneyflowCapital flowNet inflow by trade size
marginMargin tradingMarket-wide margin data

Index & Fund

ModeDescriptionKey Fields
index_dailyIndex OHLCVSame as daily for indices
index_weightIndex componentscon_code, weight
fund_basicFund listname, fund_type, management
conceptConcept themesThematic stock groups
concept_detailConcept membersStocks in each concept

Command Reference

# Stock info
$PY scripts/fetch_tushare.py --mode stock_basic --symbols 002463.SZ

# Daily price (date range)
$PY scripts/fetch_tushare.py --mode daily --symbols 002463.SZ --start 20260101 --end 20260317

# Daily valuation (PE/PB/turnover/market cap)
$PY scripts/fetch_tushare.py --mode daily_basic --symbols 002463.SZ --start 20260301

# Income statement / ratios / balance sheet / cash flow
$PY scripts/fetch_tushare.py --mode income --symbols 002463.SZ
$PY scripts/fetch_tushare.py --mode fina_indicator --symbols 002463.SZ
$PY scripts/fetch_tushare.py --mode balancesheet --symbols 002463.SZ
$PY scripts/fetch_tushare.py --mode cashflow --symbols 002463.SZ

# Earnings forecast / dividends / shareholders
$PY scripts/fetch_tushare.py --mode forecast --symbols 002463.SZ
$PY scripts/fetch_tushare.py --mode dividend --symbols 002463.SZ
$PY scripts/fetch_tushare.py --mode top10_holders --symbols 002463.SZ
$PY scripts/fetch_tushare.py --mode stk_holdernumber --symbols 002463.SZ

# Index components (CSI 300) / concept themes
$PY scripts/fetch_tushare.py --mode index_weight --symbols 000300.SH
$PY scripts/fetch_tushare.py --mode concept

Tushare vs AKShare Decision Guide

NeedUse TushareUse AKShare
Daily OHLCV✅ More stableBackup
PE/PB/PS valuation✅ daily_basicLimited
Financial statements✅ Structured, typedBasic summary
Earnings forecast✅ forecast/expressNot available
Shareholder data✅ top10_holdersNot available
Dividend data✅ dividendNot available
ETF search/dataUse AKShare✅ Better coverage
Northbound capitalUse AKShare✅ Free
Sector fund flowsUse AKShare✅ Free
Limit-up/down poolUse AKShare✅ Free

(For AKShare-based fetching, see the sibling stock-market-data and financial-data-fetcher skills.)

Rules

  1. Always set TUSHARE_TOKEN env var before calling the script — never hard-code it
  2. Tushare stock codes use suffix: .SZ (Shenzhen), .SH (Shanghai), .BJ (Beijing)
  3. Date format: YYYYMMDD (no dashes)
  4. Rate limit: ~50 requests/minute at 2000 points level
  5. Financial data lag: statements available after company announces (check ann_date)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.