PluginBench
Skill
Fail
Audit score 45

tushare-finance

stanleychanh/tushare-finance-skill-for-claude-code

Access 220+ Chinese financial market APIs for stocks, indices, funds, and macroeconomic data.

What is tushare-finance?

Tushare Finance provides real-time and historical data for Chinese A-shares, Hong Kong stocks, US stocks, funds, futures, and bonds via 220+ Tushare Pro interfaces. Use it when you need stock prices, financial statements, index data, or macroeconomic indicators like GDP and CPI.

  • Query stock daily prices and historical data for A-shares, Hong Kong, and US markets
  • Retrieve financial statements including income statements and financial indicators (ROE, etc.)
  • Access index daily data for major Chinese indices
  • Fetch fund net value data and performance metrics
  • Obtain macroeconomic indicators including GDP, CPI, and other economic data
  • Support 220+ data interfaces organized across 7 categories (stocks, indices, funds, futures, macro, HK/US stocks, bonds)

How to install tushare-finance

npx skills add https://github.com/stanleychanh/tushare-finance-skill-for-claude-code --skill tushare-finance
Prerequisites
  • Tushare Pro account (register at https://tushare.pro)
  • Tushare API token obtained from your account
  • Python environment with tushare and pandas libraries installed
  • Environment variable TUSHARE_TOKEN set with your token
Claude Code
Cursor
Windsurf
Cline

How to use tushare-finance

  1. 1.Register for a Tushare Pro account at https://tushare.pro and obtain your API token
  2. 2.Set the environment variable: export TUSHARE_TOKEN="your_token"
  3. 3.Verify dependencies by running: python -c "import tushare, pandas; print('OK')" (install with pip if needed)
  4. 4.Import tushare and initialize the API: import tushare as ts; pro = ts.pro_api()
  5. 5.Call the appropriate interface method (e.g., pro.daily(), pro.fina_indicator(), pro.gdp()) with required parameters
  6. 6.Retrieve results as pandas DataFrame and process as needed

Use cases

Good for
  • Analyze historical stock prices and trading volumes for investment research
  • Compare financial metrics across companies using income statements and financial indicators
  • Track macroeconomic trends using GDP, CPI, and other official statistics
  • Monitor fund performance and net asset values over time
  • Build datasets for quantitative analysis and backtesting trading strategies
Who it's for
  • Financial analysts and researchers
  • Investment professionals and traders
  • Data scientists building financial models
  • Economists analyzing macroeconomic trends
  • Anyone needing Chinese market financial data

tushare-finance FAQ

What date format does Tushare use?

Dates must be in YYYYMMDD format (e.g., 20241231 for December 31, 2024).

How do I specify a stock code?

Use the ts_code format, such as 000001.SZ for Shenzhen stocks or 600000.SH for Shanghai stocks.

What if I don't have a Tushare token?

Visit https://tushare.pro to register a free account and generate your API token from your account dashboard.

What data categories are available?

Tushare provides 220+ interfaces across 7 categories: stocks (39), indices (18), funds (11), futures/options (16), macroeconomic (10), HK/US stocks (23), and bonds (16).

How are results returned?

All API calls return data as pandas DataFrames, which can be easily filtered, analyzed, and exported.

Full instructions (SKILL.md)

Source of truth, from stanleychanh/tushare-finance-skill-for-claude-code.


name: tushare-finance description: 获取中国金融市场数据(A股、港股、美股、基金、期货、债券)。支持220+个Tushare Pro接口:股票行情、财务报表、宏观经济指标。当用户请求股价数据、财务分析、指数行情、GDP/CPI等宏观数据时使用。 allowed-tools:

  • Bash(python:*)
  • Read

Tushare 金融数据 Skill

本 skill 通过 Tushare Pro API 获取中国金融市场数据,支持 220+ 个数据接口。

快速开始

1. Token 配置

询问用户:是否已配置 Tushare Token?

如未配置,引导用户:

  1. 访问 https://tushare.pro 注册
  2. 获取 Token
  3. 配置环境变量:export TUSHARE_TOKEN="your_token"

2. 验证依赖

检查 Python 环境:

python -c "import tushare, pandas; print('OK')"

如报错,安装依赖:

pip install tushare pandas

常用接口速查

数据类型接口方法说明
股票列表pro.stock_basic()获取所有股票列表
日线行情pro.daily()获取日线行情数据
财务指标pro.fina_indicator()财务指标(ROE等)
利润表pro.income()利润表数据
指数行情pro.index_daily()指数日线数据
基金净值pro.fund_nav()基金净值数据
GDP数据pro.gdp()国内生产总值
CPI数据pro.cpi()居民消费价格指数

完整接口列表:查看 接口文档索引

数据获取流程

  1. 查找接口:根据需求在 接口索引 找到对应接口
  2. 阅读文档:查看 reference/接口文档/[接口名].md 了解参数
  3. 编写代码
    import tushare as ts
    
    # 初始化(使用环境变量中的 Token)
    pro = ts.pro_api()
    
    # 调用接口
    df = pro.daily(ts_code='000001.SZ', start_date='20241201', end_date='20241231')
    
  4. 返回结果:DataFrame 格式

参数格式说明

  • 日期:YYYYMMDD(如 20241231)
  • 股票代码:ts_code 格式(如 000001.SZ, 600000.SH)
  • 返回格式:pandas DataFrame

接口文档参考

接口索引reference/README.md

接口文档按类别组织:

  • 股票数据(39 个接口)
  • 指数数据(18 个接口)
  • 基金数据(11 个接口)
  • 期货期权(16 个接口)
  • 宏观经济(10 个接口)
  • 港股美股(23 个接口)
  • 债券数据(16 个接口)

参考资源