
tushare
Tushare 专业金融数据平台,提供A股行情、历史K线、财务数据、宏观数据、指数数据等,覆盖全面、数据质量高。当用户提及 Tushare、获取A股数据、查询财务报表、下载宏观数据,或需要高质量、多维度金融数据时使用。与 baostock(免费但功能有限)和 jqdatasdk(需注册但有积分门槛)不同,tushare 数据最全但需注册获取 Token。免费替代方案可用 baostock 或 akshare。
- Installs
- 199
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/lzwme/finance-quant-skills --skill tushare- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads tushare automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Tushare 数据获取
任务目标
- 本 Skill 用于:通过 Tushare 数据接口获取 A 股市场数据、财务指标和宏观数据
- 能力包含:实时行情、历史K线、财务数据、指标数据、股票信息、宏观数据、指数数据
- 触发条件:用户提及 Tushare 或需要获取 A 股数据、财务信息、宏观数据时
前置准备
- 依赖说明:安装 tushare 库(已包含在 dependency 中)
- 凭证配置:需配置 Tushare Token(凭证名: TUSHARE_TOKEN,环境变量: TUSHARE_TOKEN)
- 账号申请:访问 https://tushare.pro/ 注册账号并获取 API Token(详见 references/tushare_quickstart.md)
操作步骤
- 标准流程:
- 确定数据需求 — 智能体理解用户意图(行情/K线/财务/宏观/指数等)
- 调用对应脚本 — 根据数据类型选择脚本
- 解析结果 — 智能体分析返回的 JSON 格式数据
- 脚本调用映射:
- 行情/K线/复权数据 →
python scripts/market_data.py --type daily --ts_code 000001.SZ --start_date 20240101 --end_date 20240131 - 财务数据/利润表/资产负债表 →
python scripts/financial_data.py --type financial --ts_code 000001.SZ --period 2023 - 股票列表/交易日历 →
python scripts/stock_info.py --type stock_basic - 指数数据/宏观数据 →
python scripts/macro_index_data.py --type index_daily --ts_code 000001.SH --start_date 20240101 --end_date 20240131
- 行情/K线/复权数据 →
- 可选分支:
- 当需要多只股票数据:使用 --ts_code 参数逗号分隔
- 当需要复权数据:使用 --type adj_factor 获取复权因子
- 当需要指定报告期:使用 --period 参数(YYYY 或 YYYYMM)
使用示例
- 示例1:获取股票日K线数据
- 场景/输入:用户说"查看平安银行最近一个月的K线数据"
- 预期产出:返回日期、开盘价、最高价、最低价、收盘价、成交量等OHLCV数据
- 关键要点:调用
python scripts/market_data.py --type daily --ts_code 000001.SZ --start_date 20240301 --end_date 20240331
- 示例2:查询财务数据
- 场景/输入:用户说"获取招商银行2023年的财务指标"
- 预期产出:返回ROE、ROA、毛利率、净利率等财务指标
- 关键要点:调用
python scripts/financial_data.py --type fina_indicator --ts_code 600036.SH --period 2023
- 示例3:获取指数数据
- 场景/输入:用户说"查询上证指数最近的走势"
- 预期产出:返回上证指数的日期、收盘价、成交量等数据
- 关键要点:调用
python scripts/macro_index_data.py --type index_daily --ts_code 000001.SH --start_date 20240301 --end_date 20240331
快速参考
常用代码示例
import tushare as ts
import pandas as pd
# 设置 Token(需先设置环境变量 TUSHARE_TOKEN)
ts.set_token(os.environ.get('TUSHARE_TOKEN', ''))
pro = ts.pro_api()
# 获取日K线数据
df = pro.daily(ts_code='000001.SZ', start_date='20240101', end_date='20241231')
# 获取财务指标
df = pro.fina_indicator(ts_code='600036.SH', period='2023')
# 获取指数数据
df = pro.index_daily(ts_code='000001.SH', start_date='20240101', end_date='20241231')
与其他数据源对比
| 特性 | tushare | jqdatasdk | baostock | akshare |
|---|---|---|---|---|
| 费用 | 免费/付费 | 需注册积分 | 免费 | 免费 |
| 注册要求 | ✅ 需要 | ✅ 需要 | ❌ 不需要 | ❌ 不需要 |
| 数据范围 | 全面(含宏观) | A股+因子 | A股为主 | 全面 |
| 宏观数据 | ✅ 丰富 | ❌ | ❌ | ✅ |
| 调用频率 | 免费有限制 | 有 | 无限制 | 无限制 |
资源索引
- 脚本:
- scripts/market_data.py (用途与参数:获取行情/K线/复权数据,支持 --type/--ts_code/--start_date/--end_date)
- scripts/financial_data.py (用途与参数:获取财务数据/利润表/资产负债表/现金流量表/指标,支持 --type/--ts_code/--period)
- scripts/stock_info.py (用途与参数:获取股票列表/交易日历/名称变更,支持 --type/--ts_code/--start_date/--end_date)
- scripts/macro_index_data.py (用途与参数:获取指数数据/宏观数据/Shibor,支持 --type/--ts_code/--start_date/--end_date)
- 参考:
- references/tushare_quickstart.md (何时读取:首次配置或认证失败时)
- references/api_reference.md (何时读取:需要查看详细API参数说明时)
注意事项
- 脚本执行需配置 Tushare Token,首次使用需先完成凭证配置
- Tushare 股票代码格式:上海市场为 XXXXXX.SH,深圳市场为 XXXXXX.SZ
- 部分数据(如财务数据)可能有延迟,建议在交易日9:30-15:00之外获取
- 脚本返回 JSON 格式数据,智能体负责解析并转换为用户友好的展示
- 调用频率有限制,免费账户每分钟最多120次调用(详见 Tushare 官方文档)
- 首次使用建议先读取 tushare_quickstart.md 完成认证配置
FAQ
What does the tushare skill do?
Tushare 专业金融数据平台,提供A股行情、历史K线、财务数据、宏观数据、指数数据等,覆盖全面、数据质量高。当用户提及 Tushare、获取A股数据、查询财务报表、下载宏观数据,或需要高质量、多维度金融数据时使用。与 baostock(免费但功能有限)和 jqdatasdk(需注册但有积分门槛)不同,tushare 数据最全但需注册获取 Token。免费替代方案可用 baostock 或 akshare。
How do I install tushare?
Run npx skills add https://github.com/lzwme/finance-quant-skills --skill tushare in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/tushare/ (personal) or .claude/skills/tushare/ (project).
Which AI agents can use tushare?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is tushare safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains tushare?
It is published by lzwme in lzwme/finance-quant-skills. It has 199 recorded installs.
More from lzwme/finance-quant-skills
pywencai
lzwme/finance-quant-skills
同花顺问财数据查询:使用中文自然语言查询A股、指数、基金、港美股、可转债等市场数据;当用户需要通过自然语言从问财获取选股、财务、资金流、技术指标等数据时使用。
akshare
lzwme/finance-quant-skills
AKShare 开源金融数据接口库,提供股票、期货、期权、基金、外汇、债券、指数、加密货币等全品类金融数据;当用户需要获取各类金融市场数据时使用
baostock
lzwme/finance-quant-skills
BaoStock 免费开源 A 股数据平台,无需注册、无需 API Key,支持股票行情、K线、财务数据、行业分类、指数成分股查询。当用户提及 baostock、需要获取A股历史行情、财务报表、交易日历,或需要免费、免注册的A股数据时使用。与 tushare(数据更全但需注册)和 jqdatasdk(聚宽数据)不同,baostock 完全免费无限制,适合快速入门和低成本数据需求。
tdxquant
lzwme/finance-quant-skills
通达信量化数据获取技能。当用户提及 tdxquant、通达信、TdxQuant、tqcenter,并且需要获取A股数据(行情快照、K线、财务、板块、可转债、新股、交易数据等)、查询交易日历、执行通达信公式、订阅行情、交易下单时使用
backtrader
lzwme/finance-quant-skills
Backtrader 开源量化回测框架,支持多数据源、多策略、多周期回测与实盘交易,纯Python实现。当用户需要开发量化策略、进行回测分析、编写交易逻辑、回测参数优化,或提及 backtrader、量化回测框架时使用。若用户仅需数据获取而无回测需求,引导使用 baostock/akshare/tushare 等数据 Skill。
miniqmt
lzwme/finance-quant-skills
MiniQMT 迅投量化交易接口,基于 XtQuant Python 库(xtdata 行情 / xttrader 交易),供外部 Python 程序连接 MiniQMT 客户端,支持 A 股/期货/期权的行情获取(K线、分笔、财务数据等)和交易下单(报单、撤单、查询资产/委托/持仓)。当用户提及 miniqmt、xtquant、获取实时行情、量化交易下单、回测数据获取,或需要用外部 Python 程序连接 MiniQMT 客户端进行程序化交易时使用。若需在 QMT 客户端内编写/回测内置策略(ContextInfo/passorder),请用 qmt-strategy 技能。
Popular business & finance skills
website-builder
flowkit-labs/skills
Build and preview a hosted website for a business from a plain-language brief. Use for a new business homepage, landing page, service showcase, portfolio, online store, or customer portal, and for updates to sites hosted by this builder. Add bookings, checkout, or member accounts as needed and automate reminders, customer follow-ups, and reports after launch. Follow the user's choice when they specify another host or ask to edit an existing codebase.
sales-funnel-blueprint
autonnel/autonnel-skills
Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.
sales-enablement
coreyhaines31/marketingskills
When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),
revops
coreyhaines31/marketingskills
When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.
pricing
coreyhaines31/marketingskills
When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.
offers
coreyhaines31/marketingskills
When the user wants to design, construct, or improve an offer — the thing they actually sell — including value framing, bonus stacking, guarantee design, scarcity/urgency, naming, and payment structure. Also use when the user mentions 'offer,' 'offer design,' 'build an offer,' 'grand slam offer,' 'irresistible offer,' 'value stack,' 'bonus stack,' 'guarantee,' 'risk reversal,' 'money-back guarantee,' 'scarcity,' 'urgency,' 'high-ticket offer,' 'productize a service,' 'naming an offer,' 'payment plan,' 'down-sell,' 'upsell offer,' or 'why isn't my offer converting.' Best for services, agencies, courses, coaching, info products, high-ticket B2B, and direct-response. If you run pure self-serve SaaS, read pricing first — tiers and packaging do more work there. For price level itself (tiers, freemium, value metric), see pricing. For the page that presents the offer, see copywriting. For the launch moment, see launch. For sales collateral, see sales-enablement.