
Tushare Finance
Pull A-share, HK, US, fund, futures, bond, and macro series from Tushare Pro inside the agent via Python and 220+ documented APIs.
Overview
Tushare Finance is an agent skill for the Build phase that fetches China and global financial market data through 220+ Tushare Pro APIs using Python and a configured token.
Install
npx skills add https://github.com/stanleychanh/tushare-finance-skill-for-claude-code --skill tushare-financeWhat is this skill?
- 220+ Tushare Pro interfaces for China and cross-market finance data
- Quick reference table: stock_basic, daily, fina_indicator, income, index_daily, fund_nav, gdp, cpi
- Token onboarding flow with TUSHARE_TOKEN env var and python tushare/pandas dependency check
- Four-step fetch flow: index lookup, read reference/接口文档, pro_api call, DataFrame result
- Allowed-tools: Bash(python:*) and Read for scripted data pulls
- 220+ Tushare Pro data interfaces documented
- 8+ APIs named in the quick-reference table (stock, daily, fina_indicator, income, index, fund, gdp, cpi)
Adoption & trust: 4.6k installs on skills.sh; 64 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need authoritative A-share and macro figures in your agent workflow but do not want to hand-roll every Tushare endpoint and parameter format.
Who is it for?
Solo builders building quant dashboards, research bots, or internal finance tooling on Tushare Pro.
Skip if: Users without a Tushare account/token or who only need generic US-market APIs with no China coverage.
When should I use this skill?
User requests stock prices, financial analysis, index quotes, GDP/CPI macro data, or Chinese market figures via Tushare.
What do I get? / Deliverables
You get working Python calls that return pandas DataFrames for the requested series after Token and dependency setup.
- Python snippets calling pro_api() methods
- pandas DataFrame datasets for requested symbols and date ranges
Recommended Skills
Journey fit
Build/Integrations is where solo builders wire external data APIs into agents, dashboards, or analysis scripts. Integrations matches Tushare Token setup, pandas DataFrames, and per-interface reference docs—not portfolio operations monitoring.
How it compares
A Tushare Pro skill package with 220+ indexed endpoints—not a hosted MCP market data server.
Common Questions / FAQ
Who is tushare-finance for?
Developers and indie quants wiring Tushare Pro into agent-driven Python workflows for stocks, funds, and macro data.
When should I use tushare-finance?
During Build when integrating market or macro data pulls into scripts, backtests, or reporting agents that speak Chinese finance APIs.
Is tushare-finance safe to install?
It runs Bash(python:*) and uses your TUSHARE_TOKEN against tushare.pro—treat the token as a secret and review the Security Audits panel on this page.
SKILL.md
READMESKILL.md - Tushare Finance
# 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 环境: ```bash python -c "import tushare, pandas; print('OK')" ``` 如报错,安装依赖: ```bash 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()` | 居民消费价格指数 | **完整接口列表**:查看 [接口文档索引](reference/README.md) ## 数据获取流程 1. **查找接口**:根据需求在 [接口索引](reference/README.md) 找到对应接口 2. **阅读文档**:查看 `reference/接口文档/[接口名].md` 了解参数 3. **编写代码**: ```python 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](reference/README.md) 接口文档按类别组织: - 股票数据(39 个接口) - 指数数据(18 个接口) - 基金数据(11 个接口) - 期货期权(16 个接口) - 宏观经济(10 个接口) - 港股美股(23 个接口) - 债券数据(16 个接口) ## 参考资源 - **Tushare 官方文档**:https://tushare.pro/document/2 - **API 测试工具**:https://tushare.pro/document/1 name: Sync to ClawHub on: push: branches: [ master ] paths: - 'SKILL.md' - 'metadata.json' - 'README.md' - 'scripts/**' - 'reference/**' permissions: contents: write jobs: sync: runs-on: ubuntu-latest timeout-minutes: 10 # 增加超时时间到 10 分钟 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' - name: Install ClawHub CLI run: npm install -g clawhub - name: Authenticate ClawHub env: CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }} run: | clawhub login --token "$CLAWHUB_TOKEN" --no-browser - name: Get version from metadata id: version run: | VERSION=$(node -p "require('./metadata.json').version") echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Publish to ClawHub env: NODE_OPTIONS: "--max-old-space-size=4096" run: | echo "Publishing to ClawHub..." # 尝试发布(允许失败) clawhub publish . \ --slug tushare-finance \ --name "tushare-finance" \ --version ${{ steps.version.outputs.version }} \ --changelog "Automated sync from GitHub commit ${{ github.sha }}" \ --no-input || true # 等待一段时间让 ClawHub 处理 echo "Waiting for ClawHub to process..." sleep 30 # 验证是否发布成功 echo "Verifying publication..." if clawhub search tushare-finance | grep -q "v${{ steps.version.outputs.version }}"; then echo "✅ Successfully published v${{ steps.version.outputs.version }} to ClawHub!" else echo "⚠️ Could not verify publication, but this may be due to ClawHub processing delay" echo "ℹ️ Please check ClawHub manually: https://clawhub.com/skill/tushare-finance" fi - name: Create GitHub Release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v${{ steps.version.outputs.version }} release_name: Release v${{ steps.version.outputs.version }} body: | ## Changes Automated release synced to ClawHub Commit: ${{ gith