REA
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
天勤量化开发包, 期货量化, 实时行情/历史数据/实盘交易
如果你是作者,可把这段代码贴到 README。徽章会链接回本页。
[](https://mcp.popnx.com/en/skills/shinnytech-tqsdk-python)在同一工作中把 AI 连到服务的 MCP
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
Codebase intelligence for TypeScript and JavaScript, exposed as structured MCP analysis tools.
MCP server for terminal commands, file operations, and process management
同类工作,排序与 Skill 列表相同
| 本项 tqsdk-python | rea | andrej-karpathy-skills | graphify | MoneyPrinterTurbo | |
|---|---|---|---|---|---|
| 作者 | shinnytech | morluto | multica-ai | Graphify-Labs | harry0703 |
| Skill 数 | 1 | 1 | 1 | 1 | 1 |
| GitHub 星标 | 5,144 | 463,670 | 233,682 | 148,887 | 143,987 |
| 最近代码更新 | 2026年10月26日 | 2026年11月17日 | 2026年4月20日 | 2026年11月17日 | 2026年11月16日 |
| 许可证 | Apache-2.0 | MIT | – | Apache-2.0 | MIT |
shinnytech 提供的 1 个 Skill(指令集),AI 读取后照做 · 不是 MCP server
MCP = 手
把 AI 连到外部服务或数据,例如读取 Notion 或开发票。需要有程序或服务器在运行。
Skill = 手册
教 AI 怎么做某项工作的文本文件,不连接任何服务。
有些会重叠:少数 Skill 带有调用工具的脚本,少数 MCP 只提供知识。请从你想完成的工作出发。
Codex
依据开发者 README 和 repo 中的文件夹
GitHub account shinnytech (organization), 10 years old
★ 5,144 stars · code last changed 2026年10月26日
1 scripts that can run on a computer: scripts/check_environment.py
No internet calls found in the scripts
No hooks or writes to machine settings found
Checked automatically from the repo files at commit cde7f57 (read only, nothing was run). Not a safety guarantee: read it and decide for yourself
第一步:你用哪个 AI?
选择你用的应用,本页只显示该应用的安装方法
Files are byte-for-byte the same as on GitHub at commit cde7f57 · View on GitHub ↗
1 scripts
Once uploaded it runs on Claude’s systems, not on your computer. No need to unzip
All 15 files · 81 KB
SKILL.md5 KBagents/openai.yaml1 KBreferences/account-type-matrix.md4 KBreferences/accounts-and-trading.md5 KBreferences/environment-setup.md4 KBreferences/error-faq.md7 KBreferences/example-map.md5 KBreferences/market-data.md5 KBreferences/object-fields.md7 KBreferences/order-functions-and-position-tools.md10 KBreferences/scenario-and-margin.md8 KBreferences/simulation-and-backtest.md4 KBreferences/wait-update-and-update-loop.md5 KBscripts/check_environment.py2 KBLICENSE11 KB+Create skillUpload a skillpick tqsdk-trading-and-data.zip
SettingsCapabilitiesCode execution and file creation
Turn on Code execution and file creation first (newer menus: Create and edit files) · personal plans: Settings → Capabilities · Team/Enterprise: an admin turns it on under Organization settings → Plugins & skills · every plan, including Free
Upload once; it works in claude.ai and Claude Desktop, and in recent Claude Code signed in with a Claude account (not with an API key)
Cowork and cloud sessions use the skills turned on in your claude.ai account, not ~/.claude/skills on your computer (Claude Desktop scheduled tasks run locally and still load it)
Checked against official docs 2026年11月12日 · Source: support.claude.com, support.claude.com, code.claude.com
复制这句话,粘贴到 Claude Code 的对话中
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
重新打开 Claude Code,输入 /tqsdk-trading-and-data,或直接提出相关任务,Claude 会自动选用
Checked against official docs 2026年11月12日 · Source: code.claude.com
Skill 是 AI 会照做的指令。安装前先阅读文件,只安装可信开发者的 Skill。
Mac:按 Command+空格输入 Terminal · Windows:下方命令在 PowerShell 中无法使用,请改用上方的“让 AI 帮你安装”
这条命令把 repo 下载到临时文件夹,只复制含 SKILL.md 的文件夹
git clone --depth 1 https://github.com/shinnytech/tqsdk-python.git /tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57 && mkdir -p ~/.claude/skills && cp -R '/tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57/doc/ai_editor/skills/tqsdk-trading-and-data' ~/.claude/skills/tqsdk-trading-and-dataChatGPT 桌面应用内置 Codex,Codex 从 ~/.agents/skills 文件夹读取 Skill
在 ChatGPT 桌面应用中打开 Codex,把这句话粘贴到对话中
The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
把 tqsdk-trading-and-data 文件夹放到 ~/.agents/skills/tqsdk-trading-and-data
~ 是你的主文件夹($HOME)
不用终端:下载 ZIP,解压后把 tqsdk-trading-and-data 文件夹移到 ~/.agents/skills
Skill 是 AI 会照做的指令。安装前先阅读文件,只安装可信开发者的 Skill。
Mac:按 Command+空格输入 Terminal · Windows:下方命令在 PowerShell 中无法使用,请改用上方的“让 AI 帮你安装”
这条命令把 repo 下载到临时文件夹,只复制含 SKILL.md 的文件夹
git clone --depth 1 https://github.com/shinnytech/tqsdk-python.git /tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57 && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57/doc/ai_editor/skills/tqsdk-trading-and-data' ~/.agents/skills/tqsdk-trading-and-dataChecked against official docs 2026年11月15日 · Source: learn.chatgpt.com
不能使用你自己安装的 Skill,只能使用目录中插件自带的 Skill
想在 ChatGPT 中使用这个 Skill,请按上面的方法使用 ChatGPT 桌面应用
Checked against official docs 2026年11月15日 · Source: learn.chatgpt.com
复制这句话,粘贴到 Codex 的对话中 · 适用于 ChatGPT 桌面应用中的 Codex、Codex CLI 和 IDE 扩展
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Codex 会自动发现新安装的 Skill;如果没有出现,请重启 Codex · 使用方法:在 ChatGPT 中输入 @ 并选择 Skill · 在 Codex CLI 或 IDE 扩展中运行 /skills,或输入 $ 加 Skill 名称
Checked against official docs 2026年11月15日 · Source: learn.chatgpt.com
Skill 是 AI 会照做的指令。安装前先阅读文件,只安装可信开发者的 Skill。
Mac:按 Command+空格输入 Terminal · Windows:下方命令在 PowerShell 中无法使用,请改用上方的“让 AI 帮你安装”
这条命令把 repo 下载到临时文件夹,只复制含 SKILL.md 的文件夹
git clone --depth 1 https://github.com/shinnytech/tqsdk-python.git /tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57 && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57/doc/ai_editor/skills/tqsdk-trading-and-data' ~/.agents/skills/tqsdk-trading-and-data复制这句话,粘贴到 Cursor 的对话中
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
在 Cursor 的 Agent 聊天中输入 / 并选择 tqsdk-trading-and-data
Checked against official docs 2026年11月12日 · Source: cursor.com
Skill 是 AI 会照做的指令。安装前先阅读文件,只安装可信开发者的 Skill。
Mac:按 Command+空格输入 Terminal · Windows:下方命令在 PowerShell 中无法使用,请改用上方的“让 AI 帮你安装”
这条命令把 repo 下载到临时文件夹,只复制含 SKILL.md 的文件夹
git clone --depth 1 https://github.com/shinnytech/tqsdk-python.git /tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57 && mkdir -p ~/.cursor/skills && cp -R '/tmp/popnx-skill-shinnytech-tqsdk-python-cde7f57/doc/ai_editor/skills/tqsdk-trading-and-data' ~/.cursor/skills/tqsdk-trading-and-data适用于其他能读取 Skill 的应用。这句话列出了 Claude Code、Codex 和 Cursor 的路径,AI 会按你的应用选择 · Copy this sentence into the app’s chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Checked against official docs 2026年11月12日 · Source: code.claude.com, learn.chatgpt.com, cursor.com
其他支持 Agent Skills 的应用(如 Gemini CLI、GitHub Copilot)使用不同文件夹,请查看该应用的指南,再把含 SKILL.md 的文件夹复制过去。
已于 2026年11月11日 对照 Claude Code、Codex 和 Cursor 官方指南核实 skill 文件夹
✓ 命令已检查 2026年11月17日
以下文字来自开发者的 repo,不是 PopNx MCP 的指令
2,905 个字符 · 在 GitHub 打开完整文件
---
name: tqsdk-trading-and-data
description: "使用 TqSdk Python SDK 获取行情与历史数据、编写或排查交易与回测程序,并在需要本地运行时检查环境、安装缺失的 TqSdk。适用于明确使用 TqSdk、TqApi、TargetPosTask 等接口的开发、数据和账户问题;通用金融问答或其他数据产品不必使用本技能。"
---
# TqSdk Trading and Data
用实际接口完成用户的 TqSdk 任务。先确定任务和运行环境,按需读取专题参考,再生成最小可运行方案并验证结果。技能包是使用说明,不是已安装的 SDK,也不代表已经连接任何账户。
## 开始处理
1. **确认任务范围。** 区分接口解释、代码编写、本地执行和实盘操作。尊重用户指定的账户、合约、时间范围和项目约束;只有缺少会影响结果的必要信息时才询问。
2. **需要本地运行时,先检查环境。** 用项目实际运行脚本的解释器执行 [scripts/check_environment.py](scripts/check_environment.py)。只解释接口时不必安装软件。若状态为 `not_installed`,按 [environment-setup.md](references/environment-setup.md) 在当前项目环境中安装 TqSdk,验证导入后继续任务。已有版本可用时不自动升级;导入损坏不能当成未安装处理。
3. **以用户版本为准。** 优先检查已安装 SDK 的签名、docstring 和相关源码;有仓库时参考对应版本的源码。发布文档和技能示例可能比用户版本新,不要虚构接口或为了一个示例擅自升级。技能内的仓库路径不保证存在于用户电脑上,替代入口见 [example-map.md](references/example-map.md)。
4. **选择运行模式。** 仅取数或无账户要求的入门程序可显式用 `TqSim()`;用户要求快期模拟、实盘或股票账户时保留该选择。`TqAuth` 是快期服务认证,`TqAccount` 是期货资金账户。实盘登录失败时报告错误,不能悄悄换成模拟账户。
5. **验证并交付。** 先做语法和导入检查,再按任务验证实际数据、输出文件或回测结果。缺少认证时继续完成可离线验证的部分,明确未运行的步骤。报告使用的解释器、SDK 版本和实际验证结果;不能把语法通过说成行情或交易成功。
## 按任务读取
| 当前任务 | 参考文件 |
| --- | --- |
| 安装、解释器、依赖或导入错误 | [environment-setup.md](references/environment-setup.md) |
| `wait_update`、`is_changing`、超时与异步通知 | [wait-update-and-update-loop.md](references/wait-update-and-update-loop.md) |
| 行情、K 线、Tick、合约发现和历史下载 | [market-data.md](references/market-data.md) |
| 选择本地模拟、快期模拟、实盘、股票或多账户 | [account-type-matrix.md](references/account-type-matrix.md) |
| 读取资金、持仓、委托、成交 | [accounts-and-trading.md](references/accounts-and-trading.md) |
| 手工下单、撤单、目标持仓、调度执行和最小开仓手数 | [order-functions-and-position-tools.md](references/order-functions-and-position-tools.md) |
| 数据与账户对象的字段含义 | [object-fields.md](references/object-fields.md) |
| 模拟与历史回测 | [simulation-and-backtest.md](references/simulation-and-backtest.md) |
| 保证金、风险度和 `TqScenario` 试算 | [scenario-and-margin.md](references/scenario-and-margin.md) |
| 运行错误与排查顺序 | [error-faq.md](references/error-faq.md) |
| 官方示例、文档和源码定位 | [example-map.md](references/example-map.md) |
## 编写代码时保持的规则
- `get_*` 通常返回持续更新的引用。订阅一次并保存对象,用 `wait_update()` 推进,再用 `is_changing()` 或明确的就绪条件处理相关更新。需要历史快照时显式复制;不要通过反复订阅或 `sleep()` 等待数据。
- K 线 `iloc[-1]` 是正在形成的柱。按收盘信号交易时,在新柱出现后使用 `iloc[-2]` 和已完成的窗口;检查长度、`NaN` 和数据时间。回测保持用户原有信号、撮合和估值时点,不用未来数据。
- 当前行情示例优先使用 `KQ.m@...` 主连;主连不能直接下单。交易用用户指定或已核实的真实合约,必要时读取主连的 `underlying_symbol`;不能把合约列表第一项当成主力。历史回测按目标日期核实合约覆盖,不用今天的 `expired=False` 排除历史合约。
- `insert_order()` 返回不代表成交,`FINISHED` 也可能是撤单或拒单。结合 `volume_left`、`last_msg` 和成交记录判断;有时限时报告实际状态,不能将超时当作已撤单。
- 同一账户、同一合约选择一种持仓控制方式。不要把 `TargetPosTask` 与手工下单混用;股票账户不使用期货 `offset` 或 `TargetPosTask`。多账户操作明确传入 `account=`。
- 用环境变量、交互式隐藏输入或项目已有安全配置提供凭据,不把真实密码写进示例、日志或聊天。安装、导入和只读取数不包含实盘下单授权;执行实盘下单或撤单前,确认操作参数在用户已有授权范围内。
- API 会话用上下文管理器或 `finally: api.close()` 释放。回测处理 `BacktestFinished`,交互式取数在需要时设置合理超时并报告是否收到有效数据。
- `TqScenario` 只做期货快照试算。计算当前账户风险时显式传入该账户权益;说明保证金数据来自行情还是账户查询及可能的回退。试算结果不保证真实可成交手数,详细限制按需读取专题参考。
提问、分享技巧或报告无法使用。按“有帮助”数量排序。