Tushare Pro
Fetch Chinese stock and futures market data via Tushare API. Supports stock quotes, futures data, company fundamentals, and macroeconomic indicators. Use whe...
yishan
@manifoldor
What This Skill Does
Command-line interface for fetching Chinese stock and futures market data via the Tushare API. Supports stock quotes, daily/weekly/monthly K-line data, real-time quotes, fund flows, company fundamentals, futures contracts, and macroeconomic indicators like GDP, CPI, and PPI.
Replaces manually scraping Chinese financial websites or building custom API integrations by providing a unified CLI for Tushare Pro's comprehensive market data.
When to Use It
- Retrieve daily stock prices for a specific A-share ticker over a date range
- Get real-time quotes for one or more Chinese stocks during trading hours
- Fetch futures contract daily data for commodities like copper or index futures
- Look up company fundamentals and basic information for listed Chinese firms
- Pull macroeconomic indicators such as GDP, CPI, or PPI for economic analysis
- Obtain fund flow data for a stock or across the entire market on a given date
Install
$ openclaw skills install @manifoldor/tushareTushare 金融数据接口
获取中国 A 股市场和期货市场的实时及历史数据。
前提条件
1. 注册 Tushare 账号
访问 https://tushare.pro/weborder/#/login?reg=503098 注册账号并获取 API Token。
2. 配置 Token
# 添加到 ~/.zshrc
export TUSHARE_TOKEN="your-api-token-here"
然后执行:
source ~/.zshrc
3. 安装依赖
pip3 install tushare pandas --user
快速开始
获取股票列表
python3 scripts/market.py stock_basic
获取日线行情
python3 scripts/market.py daily --ts_code 000001.SZ --start_date 20240101 --end_date 20240131
获取实时行情
python3 scripts/market.py realtime 000001
股票数据
股票基础信息
python3 scripts/market.py stock_basic
python3 scripts/market.py stock_basic --exchange SSE # 仅上交所
python3 scripts/market.py stock_basic --exchange SZSE # 仅深交所
日线行情
# 获取单只股票近期数据
python3 scripts/market.py daily --ts_code 000001.SZ
# 指定日期范围
python3 scripts/market.py daily --ts_code 600519.SH --start_date 20240101 --end_date 20240131
# 获取指定交易日全市场数据
python3 scripts/market.py daily --trade_date 20240115
周线行情
# 获取周线数据
python3 scripts/market.py weekly --ts_code 000001.SZ
# 指定日期范围
python3 scripts/market.py weekly --ts_code 600519.SH --start_date 20230101 --end_date 20240131
月线行情
# 获取月线数据
python3 scripts/market.py monthly --ts_code 000001.SZ
# 指定日期范围
python3 scripts/market.py monthly --ts_code 600519.SH --start_date 20200101 --end_date 20240131
股票代码格式:
- 深交所:
000001.SZ,000002.SZ,300001.SZ(创业板) - 上交所:
600000.SH,600519.SH,688001.SH(科创板)
实时行情
python3 scripts/market.py realtime 000001
python3 scripts/market.py realtime 600519
资金流向
# 获取指定股票资金流向
python3 scripts/market.py moneyflow --ts_code 000001.SZ
# 获取指定日期全市场资金流向
python3 scripts/market.py moneyflow --trade_date 20240115
公司信息
python3 scripts/market.py company
期货数据
期货合约基础信息
python3 scripts/market.py fut_basic
# 指定交易所
python3 scripts/market.py fut_basic --exchange CFFEX # 中金所
python3 scripts/market.py fut_basic --exchange SHFE # 上期所
python3 scripts/market.py fut_basic --exchange DCE # 大商所
python3 scripts/market.py fut_basic --exchange CZCE # 郑商所
交易所代码:
CFFEX- 中国金融期货交易所SHFE- 上海期货交易所DCE- 大连商品交易所CZCE- 郑州商品交易所INE- 上海国际能源交易中心
期货日线行情
# 获取铜期货数据
python3 scripts/market.py fut_daily --ts_code CU.SHF
# 获取沪深300股指期货
python3 scripts/market.py fut_daily --ts_code IF.CFX
# 指定日期范围
python3 scripts/market.py fut_daily --ts_code RB.SHF --start_date 20240101 --end_date 20240131
期货代码格式:
- 上期所:
CU.SHF(铜),RB.SHF(螺纹钢),AU.SHF(黄金) - 大商所:
M.DCE(豆粕),I.DCE(铁矿石) - 郑商所:
SR.CZC(白糖),CF.CZC(棉花) - 中金所:
IF.CFX(沪深300),IC.CFX(中证500)
期货持仓排名
python3 scripts/market.py fut_holding --trade_date 20240115 --symbol CU
宏观经济
GDP 数据
python3 scripts/market.py gdp
输出示例:
📈 GDP数据 (88 条):
2023年4季度: GDP 347909亿元, 增速 5.2%
2023年3季度: GDP 319992亿元, 增速 4.9%
...
CPI 数据
python3 scripts/market.py cpi
PPI 数据
python3 scripts/market.py ppi
命令速查表
| 命令 | 功能 | 示例 |
|---|---|---|
stock_basic | 股票基础信息 | --exchange SSE |
daily | 日线行情 | --ts_code 000001.SZ --start_date 20240101 |
weekly | 周线行情 | --ts_code 000001.SZ --start_date 20230101 |
monthly | 月线行情 | --ts_code 000001.SZ --start_date 20200101 |
realtime | 实时行情 | 000001 |
moneyflow | 资金流向 | --ts_code 000001.SZ |
company | 公司信息 | - |
fut_basic | 期货基础信息 | --exchange SHFE |
fut_daily | 期货日线 | --ts_code CU.SHF |
fut_holding | 持仓排名 | --symbol CU |
gdp | GDP数据 | - |
cpi | CPI数据 | - |
ppi | PPI数据 | - |
常见问题
错误:请设置 TUSHARE_TOKEN 环境变量
→ 在 ~/.zshrc 中添加 export TUSHARE_TOKEN="your-token" 并执行 source ~/.zshrc
错误:没有数据返回 → 检查股票/期货代码格式是否正确(如:000001.SZ, CU.SHF)
错误:权限不足 → Tushare 部分接口需要积分或付费权限,请在官网查看接口权限要求
如何获取股票代码?
python3 scripts/market.py stock_basic | grep "平安"
参考文档
- 股票接口文档: references/stock_api.md
- 期货接口文档: references/futures_api.md
- Tushare 官网: https://tushare.pro
Related skills
Stock Info Explorer
@kys42A Yahoo Finance (yfinance) powered financial analysis tool. Get real-time quotes, generate high-resolution charts with moving averages + indicators (RSI/MACD/Bollinger/VWAP/ATR), summarize fundamentals, and run a one-shot report that outputs both a text summary and a Pro chart.
tushare-finance
@stanleychanh获取中国金融市场数据(A股、港股、美股、基金、期货、债券)。支持220+个Tushare Pro接口:股票行情、财务报表、宏观经济指标。当用户请求股价数据、财务分析、指数行情、GDP/CPI等宏观数据时使用。
Access Finnhub API for real-time stock quotes, company news, market data, financial statements, and trading signals
@matthewxfz3Access Finnhub API for real-time stock quotes, company news, market data, financial statements, and trading signals. Use when you need current stock prices, company news, earnings data, or market analysis.
Stock Market Pro
@kys42Yahoo Finance (yfinance) powered stock analysis skill: quotes, fundamentals, ASCII trends, high-resolution charts (RSI/MACD/BB/VWAP/ATR), plus optional web a...
A股量化 AkShare
@mbpzA股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
Yahoo Finance
@ajanrajGet stock prices, quotes, fundamentals, earnings, options, dividends, and analyst ratings using Yahoo Finance. Uses yfinance library - no API key required.