qmt-bridge-trading
通过 QMT Bridge HTTP API 执行证券交易:持仓/资产/委托查询、单笔与批量下单、撤单、清仓。 在用户提到 qmt-bridge 交易、下单、持仓、清仓、撤单、查询资产,或需操作 miniQMT 账户时使用。 本文件随 QMT Trading Skill(qmt-trading-skill…
Skill by atorber
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/atorber-qmt-bridge-trading
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, finance
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/qmt-bridge-trading
What's inside
- Skill name
qmt-bridge-trading- Description
- 通过 QMT Bridge HTTP API 执行证券交易:持仓/资产/委托查询、单笔与批量下单、撤单、清仓。 在用户提到 qmt-bridge 交易、下单、持仓、清仓、撤单、查询资产,或需操作 miniQMT 账户时使用。 本文件随 QMT Trading Skill(qmt-trading-skill 仓库)发布于 skills/qmt-bridge-trading/SKILL.md。
- License
- MIT
- Instructions
- 249 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
- Instructions call the network
Files (5)
- SKILL.md
- _common.py · scripts/
- liquidate.py · scripts/
- place_order.py · scripts/
- trading_status.py · scripts/
SKILL.md (first lines)
# QMT Trading Skill · 交易
> **发布位置**:`qmt-trading-skill` 仓库 `skills/qmt-bridge-trading/SKILL.md`。集成说明见 [`skills/README.md`](../README.md)、[路线图](../ROADMAP.md) 与文档 [agent-skills.md](../../docs/agent-skills.md)。相关 Skill:复盘 [execution-review](../qmt-bridge-execution-review/SKILL.md)、风控 [portfolio-risk](../qmt-bridge-portfolio-risk/SKILL.md)、撤单 [order-ops](../qmt-bridge-order-ops/SKILL.md)。
通过已部署的 **QMT Bridge** 服务(FastAPI + miniQMT)完成真实交易操作。服务端须在 **Windows** 上运行,并启用交易模块。
## 可执行脚本(优先使用)
在仓库根目录执行(需 `pip install -e .`,环境变量见 `.env`)。**优先调用脚本**,避免在对话中手写长 curl/Python;脚本只输出摘要,不 dump 全量 JSON。
| 脚本 | 作用 | 示例 |
|------|------|------|
| `scripts/trading_status.py` | 只读:health + 账户状态 + 持仓/资产摘要 | `python skills/qmt-bridge-trading/scripts/trading_status.py` |
| `scripts/place_order.py` | 单笔下单(默认预览) | `.../place_order.py 000001.SZ --buy --volume 100 --execute --confirm` |
| `scripts/liquidate.py` | 清仓计划/执行(默认预览) | `.../liquidate.py` → 确认后 `.../liquidate.py --execute --confirm` |
路径均相对于本 skill 目录:`skills/qmt-bridge-trading/scripts/`。
**实盘提交**须同时带 `--execute --confirm`(`place_order` / `liquidate`)。交易前先跑 `trading_status.py`。
## 前置检查(每次交易前)
1. **服务可用**:`GET /api/meta/health`(无需 Key)
2. **交易已启用**:启动参数含 `--trading` 或 `QMT_BRIDGE_TRADING_ENABLED=true`
3. **认证**:所有 `/api/trading/*` 请求头携带 `X-API-Key: <密钥>`(与服务端 `QMT_BRIDGE_API_KEY` 一致)
4. **账户**:多账户时传 `account_id`;留空则使用服务端默认户(`QMT_BRIDGE_DEFAULT_ACCOUNT` 指定 stock/credit)
5. **连接**:下单前建议 `GET /api/trading/account_status`,确认交易通道已连接
## 连接信息
从用户环境或项目 `.env` 读取(勿在对话中复述完整 API Key):
| 变量 | 含义 |
|------|------|
| `QMT_BRIDGE_HOST` / 用户提供的 IP | 服务端地址 |
| `QMT_BRIDGE_PORT` | 端口,默认 `8000` |
| `QMT_BRIDGE_API_KEY` | 交易认证密钥 |
| `QMT_BRIDGE_STOCK_ACCOUNT_ID` | 普通证券账户(可选) |
| `QMT_BRIDGE_CREDIT_ACCOUNT_ID` | 信用两融账户(可选) |
| `QMT_BRIDGE_DEFAULT_ACCOUNT` | 默认户 `stock` / `credit`(默认 stock) |
**Python 客户端**(推荐,仓库已内置):
```python
from qmt_bridge import QMTClient
client = QMTClient(host="192.168.1.100", port=8000, api_key="***")
```
**curl**:所有交易请求加 `-H "X-API-Key: $QMT_BRIDGE_API_KEY"`。
## 核心常量
| 字段 | 值 | 说明 |
|------|-----|------|
| `order_type` | `23` | 买入 |
| `order_type` | `24` | 卖出 |
| `price_type` | `5` | 最新价(默认) |
| `price_type` | `11` | 限价(须填 `price`) |
| `price_type` | `42` | 最优五档即时成交剩余撤销 |
**股票代码**:`代码.交易所`,如 `000001.SZ`、`600519.SH`。
**数量**:A 股通常为 100 的整数倍;卖出时使用 **`can_use_volume`(可用数量)**,勿超过持仓。
## 操作流程
### 1. 查询持仓
```bash
python skills/qmt-bridge-trading/scripts/trading_status.py
```
或 API / 客户端:
```python
resp = client.query_positions(account_id="") # 可选 account_id
positions = resp.get("data", resp)
```
持仓记录常用字段:`stock_code`、`volume`(总持仓)、`can_use_volume`(可卖)、`open_price`、`market_value`。
**单标的持仓**:`GET /api/trading/position/{stock_code}` 或 `client.query_single_position("000001.SZ")`。
### 2. 查询资产与委托(辅助)
```python
asset = client.query_asset() # 资金、市值等
orders = client.query_orders() # 当日委托;cancelable_only=True 仅可撤
trades = client.query_trades() # 当日成交
```
### 3. 单笔下单
**执行前必须向用户确认**:标的、方向、数量、价格类型与价格。
```bash
# 预览
python skills/qmt-bridge-trading/scripts/place_order.py 000001.SZ --buy --volume 100
# 提交
python skills/qmt-bridge-trading/scripts/place_order.py 000001.SZ --buy --volume 100 --execute --confirm
```
```python
result = client.place_order(
stock_code="000001.SZ",
order_type=23, # 买入
order_volume=100,
price_type=5, # 最新价
price=0.0,
strategy_name="",
order_remark="agent",
account_id="",
)
# 返回示例: {"order_id": <int>, "status": "submitted"}
```
```bash
curl -s -X POST "http://HOST:PORT/api/trading/order" \From atorber/qmt-trading-skill, MIT.
More from atorber/qmt-trading-skill
- 0.610score
qmt-bridge-execution-review
atorber
通过 QMT Bridge 生成当日交易复盘:客观证据(委托/成交/滑点/不操作基线/规则标签)+ Agent 层投顾/基金经理/交易员三角色专家评审与综合裁决。 在用户提到今日成交、交易复盘、今日操作评估、执行质量、三角色复盘、专家复盘、 不操作少赚多亏时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.610score
qmt-bridge-setup
atorber
安装、配置并启动 QMT Bridge(qmt-server / PM2),检查健康状态,并同步本仓客户端 .env。 在用户提到安装 Bridge、启动 qmt-server、PM2 守护、Bridge 连不上、健康检查、 配置 miniQMT 路径或 API Key 时使用。不涉及下单。
SkillBFreshness: B★ 25Claude Code +9 - 0.610score
qmt-bridge-feishu-doc
atorber
将 QMT Trading Skill 复盘/盈亏/分析报告同步到飞书云文档:规定云空间目录与标题命名, 通过官方 lark-cli 与 lark-doc、lark-drive、lark-shared Skill 完成(不用仓库 scripts/ 飞书脚本)。 在用户提到上传飞书、同步复盘文档、飞书云文档时使用。
SkillBFreshness: B★ 25Claude Code +9 - 0.610score
qmt-bridge-return-analysis
atorber
通过 QMT Bridge 分析 1/2/3/4/5/10/30 日累计涨幅、形态/量价涨跌概率, 并输出下一交易日操作策略与观察点。支持 --holdings 自动读持仓、缺 K 线则下载。 在用户提到持仓阶段强弱、N日涨幅、涨跌概率、量价、明日怎么观察时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-event-calendar
atorber
通过 QMT Bridge 查询交易日历、节假日、交易时段,并支持用户自定义的财报/持仓事件检查规程。 在用户提到是否交易日、节假日、交易时间、财报日、日历时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-financial-download
atorber
通过 QMT Bridge 将财报下载到服务端缓存(POST)。在用户提到下载财报、补财务数据、 刷新 Pershareindex、下载 ROE 数据、财报缓存时使用;筛选指标请用 fundamental-screen。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-fundamental-screen
atorber
通过 QMT Bridge 筛选财报指标:按字段过滤、显示中文名称。缺数时可自动补下载。 在用户提到基本面、财报筛选、ROE、EPS、排雷时使用;仅下载缓存请用 financial-download。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-hk-connect
atorber
通过 QMT Bridge 查询港股通标的、连接方向与经纪商字典,辅助港股通投资筛选。 在用户提到港股通、沪港通、深港通、港股标的时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-kline-backfill
atorber
校验近N个交易日两市成交额(上证+深证)是否可用于复盘。默认仅用 get_full_tick 写当日 与本地日缓存,不拉历史 K 线。用户提到补齐K线、近3日量能缺失、复盘前校验时使用。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-market-watch
atorber
通过 QMT Bridge 对自选标的做行情快照:涨跌幅、现价、指数环境、交易日校验。 在用户提到看盘、自选监控、盘前检查、行情快照、大盘环境时使用。只读,不下单。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-option
atorber
通过 QMT Bridge 查询期权链、合约详情与列表,辅助期权策略与对冲分析。 在用户提到期权、期权链、认沽认购、对冲时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-order-ops
atorber
通过 QMT Bridge 管理当日委托:查询可撤单、单笔/批量撤单、委托详情。 在用户提到撤单、取消委托、查挂单、可撤订单、错单处理时使用。写操作须用户确认。
SkillBFreshness: B★ 25Claude Code +9
Signals
- Stars
- 25
- Forks
- 7
- Open issues
- 0
- Last commit (this folder)
- Aug 14, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/atorber/qmt-trading-skill
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from atorber
- 0.610score
qmt-bridge-setup
atorber
安装、配置并启动 QMT Bridge(qmt-server / PM2),检查健康状态,并同步本仓客户端 .env。 在用户提到安装 Bridge、启动 qmt-server、PM2 守护、Bridge 连不上、健康检查、 配置 miniQMT 路径或 API Key 时使用。不涉及下单。
SkillBFreshness: B★ 25Claude Code +9 - 0.610score
qmt-bridge-execution-review
atorber
通过 QMT Bridge 生成当日交易复盘:客观证据(委托/成交/滑点/不操作基线/规则标签)+ Agent 层投顾/基金经理/交易员三角色专家评审与综合裁决。 在用户提到今日成交、交易复盘、今日操作评估、执行质量、三角色复盘、专家复盘、 不操作少赚多亏时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.610score
qmt-bridge-feishu-doc
atorber
将 QMT Trading Skill 复盘/盈亏/分析报告同步到飞书云文档:规定云空间目录与标题命名, 通过官方 lark-cli 与 lark-doc、lark-drive、lark-shared Skill 完成(不用仓库 scripts/ 飞书脚本)。 在用户提到上传飞书、同步复盘文档、飞书云文档时使用。
SkillBFreshness: B★ 25Claude Code +9 - 0.610score
qmt-bridge-return-analysis
atorber
通过 QMT Bridge 分析 1/2/3/4/5/10/30 日累计涨幅、形态/量价涨跌概率, 并输出下一交易日操作策略与观察点。支持 --holdings 自动读持仓、缺 K 线则下载。 在用户提到持仓阶段强弱、N日涨幅、涨跌概率、量价、明日怎么观察时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-daily-pnl
atorber
通过 QMT Bridge 查看当日盈亏:结合当前持仓、昨仓与当日买卖成交计算,含已清仓标的。 在用户提到今日盈亏、当日收益、赚了多少、盘面盈亏时使用。只读。
SkillBFreshness: B★ 25Claude Code +9 - 0.607score
qmt-bridge-event-calendar
atorber
通过 QMT Bridge 查询交易日历、节假日、交易时段,并支持用户自定义的财报/持仓事件检查规程。 在用户提到是否交易日、节假日、交易时间、财报日、日历时使用。只读。
SkillBFreshness: B★ 25Claude Code +9
Cite this page
qmt-bridge-trading skill. Agent Mart. https://agentmart.dev/skills/atorber-qmt-bridge-trading (last updated 2026-10-24)