Windows MiniQMT gateway server.
Project description
qmtserver
qmtserver 是一个面向 MiniQMT / xtquant 的本地 Windows 网关服务。它把 MiniQMT 能力封装为 HTTP RPC 和 WebSocket,方便其他机器通过网络访问。
重要说明
- qmtserver 是非官方开源项目,不隶属于迅投、QMT、MiniQMT 或任何券商。
- 服务端运行环境限定为 Windows + Python 3.12/3.13。
- 交易相关接口默认关闭,并且默认 dry-run。
- 本项目不提供投资建议;真实交易风险由使用者自行承担。
特性
- CLI 连接检查:验证行情连接、交易连接、账号订阅和资金查询。
- 本地 HTTP RPC 网关:提供
/v1/rpc和白名单方法转发。 - 稳定行情 API:提供 capabilities、daily bars、intraday bars 和标准 metadata。
- Snapshot 与历史任务:支持 CSV snapshot、manifest、下载任务和运行诊断。
- 数据准备接口:提供交易日历、标的列表、instrument detail 和数据质量报告。
- 透明 RPC 实验模式:显式开启后可受控探索白名单外的公开
xtquant方法。 - 交易保护:token 鉴权、交易开关、dry-run、账号/代码/限额校验和审计日志。
- WebSocket 事件:推送连接状态、委托回报、成交回报和错误事件。
- 内置 Python 兼容客户端:用于验证
/v1API;独立客户端请使用 qmtclient。
当前版本节奏见 Release Plan。
快速开始
PyPI 安装
普通使用不需要 clone 仓库,可以直接从 PyPI 安装 qmtserver 和 PyPI 版 xtquant:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install "qmtserver[xtquant]"
源码安装
需要本地开发或运行仓库内测试时,先 clone 项目并进入项目目录:
git clone https://github.com/gly11/qmtserver.git
cd qmtserver
uv sync --extra xtquant
uv sync --extra xtquant 会安装项目依赖和 PyPI 版 xtquant。
如果 PyPI 版落后,也可以从迅投知识库下载新版后覆盖安装:
先启动并登录 MiniQMT,再检查连接:
uv run qmtserver check --userdata "D:\path\to\MiniQMT\userdata_mini" --account-id "资金账号"
启动本地网关:
uv run qmtserver serve --userdata "D:\path\to\MiniQMT\userdata_mini" --account-id "资金账号"
默认监听:
http://127.0.0.1:8000
常用入口:
GET /v1/health
GET /v1/qmt/status
GET /v1/market/capabilities
GET /v1/market/bars/daily
GET /v1/market/bars/intraday
POST /v1/snapshots
POST /v1/jobs/history-download
GET /v1/diagnostics
GET /v1/reference/calendar
GET /v1/market/bars/daily/quality
GET /v1/snapshots/{snapshot_id}/quality
GET /v1/rpc/methods
POST /v1/rpc
WS /v1/ws/events
内置兼容客户端
from qmtserver.client import QmtClient
client = QmtClient("http://127.0.0.1:8000", token="dev-token")
print(client.health())
print(client.status())
print(client.xtdata.get_full_tick(["000001.SZ"]))
新的策略项目建议使用独立包 qmtclient;本仓库内置客户端主要用于服务端兼容性验证。
文档
- Installation
- API Reference
- Built-in Client
- Operations
- Troubleshooting
- Development Roadmap
- Release Plan
- Transparent RPC
- Documentation Index
开发
uv run python -m unittest discover
uv run ruff check .
uv run ruff format --check .
uv run ty check
许可证
本项目使用 MIT License,详见 LICENSE。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qmtserver-0.3.0.tar.gz.
File metadata
- Download URL: qmtserver-0.3.0.tar.gz
- Upload date:
- Size: 133.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0645011c4370f99404aa68e0761ad304d0a5be1672a36a38ea3d3b3feab15d34
|
|
| MD5 |
8bdce33437269115e4963181adc40f60
|
|
| BLAKE2b-256 |
3de10c7f46a0286ccf67c605a38cc6a3ef4d2eb6a613c096a969a5fa9d95c6ac
|
Provenance
The following attestation bundles were made for qmtserver-0.3.0.tar.gz:
Publisher:
publish.yml on gly11/qmtserver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qmtserver-0.3.0.tar.gz -
Subject digest:
0645011c4370f99404aa68e0761ad304d0a5be1672a36a38ea3d3b3feab15d34 - Sigstore transparency entry: 1633765086
- Sigstore integration time:
-
Permalink:
gly11/qmtserver@74a0aa6f6e3e6b3c992cfd52def8ee51714376fa -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/gly11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@74a0aa6f6e3e6b3c992cfd52def8ee51714376fa -
Trigger Event:
push
-
Statement type:
File details
Details for the file qmtserver-0.3.0-py3-none-any.whl.
File metadata
- Download URL: qmtserver-0.3.0-py3-none-any.whl
- Upload date:
- Size: 57.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f57db0bfee041439ea8d3358bd17f819687b153101b02220582b81b801756fcc
|
|
| MD5 |
d5211e188034e6c3d1fa5955658026ad
|
|
| BLAKE2b-256 |
3148ba2e08b3c3e73f98825cc8d787ae37809ad73bf0d702e9b40bd02220671a
|
Provenance
The following attestation bundles were made for qmtserver-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on gly11/qmtserver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qmtserver-0.3.0-py3-none-any.whl -
Subject digest:
f57db0bfee041439ea8d3358bd17f819687b153101b02220582b81b801756fcc - Sigstore transparency entry: 1633765119
- Sigstore integration time:
-
Permalink:
gly11/qmtserver@74a0aa6f6e3e6b3c992cfd52def8ee51714376fa -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/gly11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@74a0aa6f6e3e6b3c992cfd52def8ee51714376fa -
Trigger Event:
push
-
Statement type: