TuShare Stock Skill

v1.0.3

面向中国 A 股的 Tushare 专用技能,提供股票数据获取、个股分析与交易观察能力。

6· 4.7k·29 current·29 all-time
byZexun Chen@magica-chen

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for magica-chen/tushare-stock-skill.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "TuShare Stock Skill" (magica-chen/tushare-stock-skill) from ClawHub.
Skill page: https://clawhub.ai/magica-chen/tushare-stock-skill
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Required env vars: TUSHARE_TOKEN
Required binaries: python3
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install tushare-stock-skill

ClawHub CLI

Package manager switcher

npx clawhub@latest install tushare-stock-skill
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description match the requested runtime footprint: python3 + tushare/pandas/requests/bs4 and a single required credential TUSHARE_TOKEN. Declared network endpoints (tushare.pro, api.waditu.com) and optional cache/env file variables align with accessing Tushare APIs and building a local endpoint catalog.
Instruction Scope
SKILL.md and the main scripts restrict runtime actions to: reading TUSHARE_TOKEN (or an explicit env file), calling Tushare/pro APIs, optionally crawling tushare.pro when running the catalog builder, and producing JSON/analysis outputs. The code reads only declared env vars and the optional env file; it does not attempt to scan home directories or other unrelated credentials.
Install Mechanism
There is no remote download/install step in the skill package. Dependencies are standard Python packages listed in requirements.txt (pandas, tushare, requests, beautifulsoup4). The one script that fetches remote content is build_catalog.py which intentionally requests the official Tushare docs (tushare.pro). No installs from untrusted URLs or archive extracts are present.
Credentials
Only one required secret is declared (TUSHARE_TOKEN) which is exactly what a Tushare client needs. Optional env vars (TUSHARE_STOCK_ENV_FILE, TUSHARE_POINTS, TUSHARE_STOCK_CACHE_DIR) are reasonable for cache/config control. The code does not access other environment variables or unrelated credentials.
Persistence & Privilege
Skill is not forced-always on and uses normal agent-invocation defaults. It does not modify other skills or system-wide settings. The package may write cache files under the declared cache dir, but it does not request elevated system privileges or persistent cross-skill changes.
Assessment
This skill appears coherent and targeted: it needs only a valid TUSHARE_TOKEN and a Python 3 environment with the listed packages. Before installing, confirm you are comfortable giving this Tushare token (it will be used to make API calls to tushare.pro/api.waditu.com). If you want to limit exposure, set TUSHARE_TOKEN in a dedicated env file and provide that path via TUSHARE_STOCK_ENV_FILE, run the skill in an isolated environment (venv/container), and review the included scripts (scripts/tushare_stock.py and scripts/build_catalog.py) yourself. Be aware build_catalog.py will fetch the official tushare.pro documentation when you run it; otherwise the skill uses the bundled references/stock_endpoints.json. If you plan to let an agent invoke the skill autonomously, remember it can call these scripts with the provided token—this is expected for a data-access skill but ensure the token's permissions/rate limits are appropriate.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

📈 Clawdis
Binspython3
EnvTUSHARE_TOKEN
Primary envTUSHARE_TOKEN
latestvk979b334z9ajncg2qehm73903n82jzp0
4.7kdownloads
6stars
4versions
Updated 1mo ago
v1.0.3
MIT-0

Tushare A 股研究技能

一个更聚焦、也更实用的 Tushare A 股技能包,专门面向中国 A 股个股研究、数据查询与交易观察。

适用场景

当你希望围绕 A 股个股做数据获取、分析判断或交易观察时,使用这个技能。它覆盖的重点包括:

  • 股票基础资料与上市清单
  • 日线、周线、月线、复权、实时与分钟级行情
  • daily_basic 每日指标与估值指标
  • 财务报表、业绩预告、分红、审计与财务指标
  • 十大股东、质押、回购、解禁、大宗交易、股东人数等股东侧数据
  • 券商盈利预测、筹码分布、技术因子、CCASS、AH 比价
  • 两融、转融通、资金流向
  • 龙虎榜、涨跌停、THS / DC / TDX / KPL 题材与板块数据
  • 个股估值、财务质量、成长性、趋势、风险提示等综合分析
  • 偏交易观察的请求,例如量价结构、资金面、均线、动量、RSI、KDJ、布林线、MACD

不要把它当成一个“全市场全资产大而全”的金融数据技能。它的设计目标不是覆盖 ETF、基金、期货、期权、宏观、新闻或海外市场,而是把中国 A 股个股这件事做深。

核心价值

  • 用自然语言直达 A 股常用 Tushare 接口
  • 支持显式接口调用,适合稳定、可复现的数据提取
  • 不只查数据,还能直接给出个股分析与交易观察结果
  • 内建积分门槛、额外权限等访问限制识别
  • 兼顾研究型场景与交易型场景

上架定位

和偏“大而全”的 Tushare 技能相比,这个包刻意选择了“更窄,但更深”的路线。

它不追求把所有资产类别、宏观指标和海外市场一次性打包,而是专注在中国 A 股个股研究这一条主线上,把:

  • 数据查询
  • 估值与财务分析
  • 风险提示
  • 资金流与龙虎榜观察
  • 技术指标与交易观察

这些最常见、也最容易真正落地使用的能力做完整。

主入口

在已安装依赖的 Python 3 环境中运行:

python scripts/tushare_stock.py run --text "<请求内容>"

脚本会:

  • 从环境变量读取 TUSHARE_TOKEN
  • 只有在显式提供 TUSHARE_STOCK_ENV_FILE 时,才会从文件中读取 TUSHARE_TOKEN
  • 作为统一入口调用 Tushare,避免临时拼接零散 import tushare as ts 代码
  • 在可能时把股票名称解析成 ts_code
  • 从自然语言中自动选择更合适的股票接口
  • 规范化常见参数,如日期区间、季度表达、分钟频率
  • 对积分不足或额外权限接口做显式拦截
  • 对“分析 / 估值 / 基本面 / 趋势 / 风险”等请求自动切到综合分析
  • 对“交易观察 / 技术分析 / 均线 / 动量 / RSI / KDJ / 布林线 / MACD”等请求自动切到交易观察
  • 默认走快档交易观察;只有明确提出更深的需求时,才补扫龙虎榜与席位数据
  • 返回结构化 JSON;查询场景优先给原始数据,分析场景给结论和支撑数据
  • 不调用 ts.set_token(...),避免主动生成本地 token 缓存文件

安装

使用前先安装 Python 依赖:

pip install -r requirements.txt

必需环境变量:

  • TUSHARE_TOKEN:所有数据查询与分析命令都依赖它

可选环境变量:

  • TUSHARE_STOCK_ENV_FILE:可选,指向包含 TUSHARE_TOKEN 的 env 文件
  • TUSHARE_POINTS:可选,用于覆盖当前积分值判断,默认 5120
  • TUSHARE_STOCK_CACHE_DIR:可选,缓存目录,默认 /tmp/tushare_stock_skill

安全与运行边界

  • runfetchanalyze 会访问 Tushare 网络接口
  • build_catalog.py 会访问 tushare.pro 官方文档页面,用于刷新本地接口目录
  • 技能不会隐式扫描家目录配置文件;如果使用文件型凭证,必须显式传入 TUSHARE_STOCK_ENV_FILE
  • 技能只读取声明过的环境变量,不会主动读取其他无关凭证

其他命令

列出支持的接口目录:

python scripts/tushare_stock.py catalog

直接调用指定接口:

python scripts/tushare_stock.py fetch --endpoint daily_basic --param ts_code=600519.SH --param start_date=20250101 --param end_date=20250301

显式触发个股分析:

python scripts/tushare_stock.py analyze --text "分析贵州茅台的估值、财务质量和趋势"

列出内置技术指标:

python scripts/tushare_stock.py indicators

根据官方文档刷新接口目录:

python scripts/build_catalog.py

输出行为

  • 面向用户的输出默认使用简体中文
  • 查询类请求优先返回原始数据,再补最少必要解释
  • 分析类请求默认返回结论、关键指标、风险提示与支撑摘要
  • 交易观察优先输出趋势、量价、资金流、龙虎榜和技术指标信号
  • 快档优先保证速度;深档才补充龙虎榜与席位扫描
  • 明确说明实际调用了哪些接口,以及受哪些积分或权限限制
  • 请求不明确时,先用中文追问一句,不要盲猜

示例请求

  • 贵州茅台近一年 daily_basic 指标
  • 最近30天龙虎榜机构交易
  • 分析宁德时代的估值和成长性
  • 看看招商银行的基本面和趋势
  • 贵州茅台当前有哪些风险信号
  • 看看贵州茅台的交易观察
  • 看看贵州茅台的快档交易观察
  • 深度看看贵州茅台交易观察,带龙虎榜和机构席位
  • 分析宁德时代均线、RSI 和布林线
  • 贵州茅台技术分析

参考资料

  • 机器可读目录:references/stock_endpoints.json
  • 人类可读摘要:references/stock_endpoints.md
  • 技术指标注册表:scripts/trading_analysis.py
  • 官方索引:https://tushare.pro/document/2?doc_id=14

扩展方式

  • 如需新增技术指标,优先扩展 scripts/trading_analysis.py
  • 使用 @register_indicator(...) 注册后,主技能与 indicators 命令会自动识别

Comments

Loading comments...