Skip to content

feat: 增加支持 Python 3.14 的 MiniQMT 原生资产查询 - #9

Merged
2233admin merged 1 commit into
mainfrom
feat/miniqmt-native-asset
Nov 9, 2026
Merged

2233admin merged 1 commit into
mainfrom
feat/miniqmt-native-asset

Conversation

@2233admin

Copy link
Copy Markdown
Owner

变更

本机 Python 3.14 无法加载券商随附的 cp311 xtquant 扩展。增加可选的 asset --backend native,让 Agent 通过既有 CLI、RPC、JSONL 和 MCP 查询 MiniQMT 资产,运行时不导入 xtquant。默认 SDK 路径保持兼容,继续遵守仓库只读边界。

Agent → asset/backend=native → 有截止时间的独立进程
      → 已校验的 ringbuffer.dll → MiniQMT IPC → 资产 JSON

只开放连接和资产查询,返回账户类型、账户标识、可用资金、冻结资金、市值和总资产。请求/响应编解码、独占回复队列、所有权标记、进程超时、原生日志隔离及二进制指纹检查均有边界处理。stdio 会话的数据 token 延迟到非原生请求才初始化,原生资产不隐式加载 SDK。

用法与协议依据见 docs/native-asset.md,范围和验收见 openspec/changes/miniqmt-native-asset/。

验证

  • 改动前基线:287 项离线测试通过;新增协议/CLI 接线测试确认缺失行为会失败。
  • 当前提交:uv run --no-sync --extra dev pytest -q,320 passed;ruff check . 与 git diff --check 通过。
  • 本机 Windows x64、Python 3.14.7:原生 CLI/RPC/JSONL 返回的六个资产字段均与独立参考 SDK 查询一致,3.14 进程没有导入 xtquant。仅执行连接和只读查询,未报撤单;真实账号和金额没有进入仓库或收据。
  • 先完成私有隔离队列回环,再执行真实只读验收;MCP 通过离线内存会话测试。

风险与退路

双向可回退:不传 --backend native 继续使用 SDK。原生后端仅支持 STOCK 账户和文档列出的二进制指纹,客户端升级会明确拒绝;尚未验证其他券商构建或大 QMT。仍使用客户端自带的 C++ 环形队列运行库,并非无厂商依赖的完整 SDK 替代。

每次请求使用独立进程和回复队列,暂不提供持久连接或高频轮询。父进程只尝试删除本次拥有的回复文件;客户端暂时持有映射时可能延迟清理。未增加交易执行、转账或任意 IPC 调用入口。

当前交付为待验收草稿,尚未合入主线。

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@repowise-bot

repowise-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

Worth a look: 1 thing to check below.

  1. This PR introduces 17 new health notes (3 high) across 2 files: 5× complex method, 4× complex conditional, 2× untested complexity (+4 more kinds) (see all)

➖ Health of changed files: 1.5 → 2.4 (+0.9; structure +0.1) Average full file score (structure and history) of 4 changed code files, weighted by size before this PR; not the repository score.


View on Repowise
Set up coverage → · Plain markdown for agents · Reviews (1) · Last reviewed commit: feat: 增加 MiniQMT 原生资产查询后端

Settings and updates

Silence one PR with [skip repowise] in the title · Bot settings
/repowise recheck reviews the current head again
/repowise review deep runs the deep review on it
/repowise remember <text> tells the reviewer what to leave out next time (reply on a finding to scope it to that file)
/repowise help lists the commands
⭐ Star Repowise · 📥 Install on another repo

@2233admin
2233admin merged commit 3efc73a into main Nov 9, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant