Skip to content

feat: add QMT built-in Python read-only bridge - #126

Merged
Atlas2005 merged 5 commits into
mainfrom
pr126-qmt-built-in-python-bridge-v1
Jul 15, 2026
Merged

feat: add QMT built-in Python read-only bridge#126
Atlas2005 merged 5 commits into
mainfrom
pr126-qmt-built-in-python-bridge-v1

Conversation

@Atlas2005

Copy link
Copy Markdown
Owner

Summary

Adds the first production-shaped read-only bridge between QuantPilot
and the broker-provided QMT built-in Python runtime.

The bridge exports bounded, atomic account snapshots from QMT to the
Windows QuantPilot runtime without using external XtQuant/MiniQMT
connectivity and without enabling any broker mutation capability.

Main changes

  • Added a QMT built-in Python 3.6-compatible read-only exporter.
  • Added atomic snapshot replacement under the configured bridge root.
  • Added HMAC-based redacted account binding using a local random key.
  • Added Windows msvcrt single-writer locking.
  • Added sequence recovery across QMT and Windows runtime restarts.
  • Added bounded account, position, order, and trade normalization.
  • Added runtime configuration schema v2 support for
    qmt_builtin_bridge.
  • Added strict Runtime Doctor and bridge inspection support.
  • Added a narrow provisioning exception only when the first snapshot
    is genuinely absent.
  • Preserved DPAPI secrets and Docker volumes during Windows runtime
    migration.
  • Added Windows deployment and operational documentation.

Real QMT compatibility fixes

Real broker-runtime testing established that
get_trade_detail_data requires an active QMT strategy-bar context.

The exporter now:

  • reads injected account and accountType values during init;
  • schedules the initial query cycle from after_init;
  • uses QMT timer callbacks only to mark work as due;
  • executes all provider queries only from handlebar;
  • queries in the exact order:
    • account
    • position
    • order
    • deal;
  • writes one atomic completed snapshot per due cycle;
  • preserves due work when atomic snapshot writing fails;
  • prevents overlapping and re-entrant query cycles.

Read-only boundary

The exporter contains no invocation of:

  • passorder;
  • cancellation functions;
  • order placement functions;
  • equivalent broker mutation APIs.

Every real-QMT acceptance snapshot reported:

  • order_submission_enabled=false;
  • cancel_enabled=false;
  • passorder_invoked=false;
  • cancel_invoked=false.

Validation

Offline

  • Python 3.6 grammar validation: passed
  • ASCII/GBK source validation: passed
  • Direct QMT-call AST audit: passed
  • Lifecycle reachability audit: passed
  • Broker mutation-call audit: passed
  • Focused QMT bridge/runtime suite:
    167 passed, 3 skipped
  • Full suite:
    1800 passed, 4 skipped
  • git diff --check: passed

Real broker QMT

Environment:

  • broker-provided QMT built-in CPython 3.6.8, 64-bit;
  • test stock account;
  • simulation-signal mode.

Confirmed:

  • account binding valid;
  • msvcrt writer lock acquired and released correctly;
  • timer registered;
  • sequence resumed from prior completed snapshots;
  • two consecutive handlebar query cycles completed;
  • account query succeeded;
  • position query succeeded;
  • order query succeeded;
  • trade query succeeded;
  • failure count was zero;
  • atomic temp files were absent after replacement;
  • formal bridge inspector returned validation_result=valid;
  • strategy stop halted sequence advancement;
  • writer byte lock was released after stop.

No real-account change, order submission, cancellation, or live
DeepSeek call was performed.

@Atlas2005
Atlas2005 merged commit 5a6d3e9 into main Jul 15, 2026
2 checks passed
@Atlas2005
Atlas2005 deleted the pr126-qmt-built-in-python-bridge-v1 branch July 15, 2026 06:33
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