Python client SDK for qmtserver remote MiniQMT gateways.
Project description
qmtclient
远程 qmtserver 的轻量 Python 客户端 SDK。适用于没有 MiniQMT、没有 xtquant 的策略机、服务器或笔记本。
qmtclient -- HTTP RPC / WebSocket / token --> qmtserver + MiniQMT + xtquant
安装
使用 PyPI 安装:
uv pip install qmtclient
开发本仓库:
git clone https://github.com/gly11/qmtclient.git
cd qmtclient
uv sync
基础用法
from qmtclient import QmtClient
client = QmtClient("http://192.168.1.10:8000", token="dev-token")
print(client.health())
print(client.status())
print(client.xtdata.get_full_tick(["000001.SZ"]))
默认使用 qmtserver /v1。真实 token 不要写进源码,建议从环境变量读取。
策略接口
ticks = client.market.get_full_tick(["000001.SZ"])
daily = client.market.daily_bars(["000001.SZ"], start_time="20260501")
asset = client.account.asset("example-account")
orders = client.account.cached_orders(limit=20)
交易入口在 client.trading。它只组装参数并调用 qmtserver;是否允许真实交易由 qmtserver 的配置、保护和审计决定。
事件
for event in client.events(types=["stock_order", "stock_trade"]):
print(event)
离线测试
from qmtclient import FakeQmtClient
fake = FakeQmtClient.from_fixture("examples/fixtures/market_daily.json")
print(fake.market.daily_bars(["000001.SZ"]))
边界
- 不直接连接 MiniQMT。
- 不依赖
xtquant。 - 不绕过 qmtserver 的 token、RPC 白名单、透明 RPC 开关或交易保护。
- 不做 GUI。
文档
开发检查
uv run python -m unittest discover -s tests
uv run ruff check .
uv run ruff format --check .
uv run ty check
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 qmtclient-0.2.0.tar.gz.
File metadata
- Download URL: qmtclient-0.2.0.tar.gz
- Upload date:
- Size: 43.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94d317a66e31c0f9a4ac90fb42ece4b62fa6fe9c3ec89342614d39d7a9c55b35
|
|
| MD5 |
9afbe4f17a85548814ca258ae6b92a77
|
|
| BLAKE2b-256 |
b75b83991f7de22a0a6e166ccea686da49b210c1b472134c2b039cb8e1d4abba
|
Provenance
The following attestation bundles were made for qmtclient-0.2.0.tar.gz:
Publisher:
publish.yml on gly11/qmtclient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qmtclient-0.2.0.tar.gz -
Subject digest:
94d317a66e31c0f9a4ac90fb42ece4b62fa6fe9c3ec89342614d39d7a9c55b35 - Sigstore transparency entry: 1633388404
- Sigstore integration time:
-
Permalink:
gly11/qmtclient@9278fc3c45774122fb3c67ab340fd4744de165c1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/gly11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9278fc3c45774122fb3c67ab340fd4744de165c1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file qmtclient-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qmtclient-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.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 |
e89e3dc150f245177903b88263e4d102c37e5298c67cda68db1eee485dbd86f2
|
|
| MD5 |
a9c980fdbd3bd7694b21470892583cad
|
|
| BLAKE2b-256 |
bdb4613ce110bf9d6e5ed47ae81b21fb4ff4610dd745dc57689c03130d1137cb
|
Provenance
The following attestation bundles were made for qmtclient-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on gly11/qmtclient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qmtclient-0.2.0-py3-none-any.whl -
Subject digest:
e89e3dc150f245177903b88263e4d102c37e5298c67cda68db1eee485dbd86f2 - Sigstore transparency entry: 1633388412
- Sigstore integration time:
-
Permalink:
gly11/qmtclient@9278fc3c45774122fb3c67ab340fd4744de165c1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/gly11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9278fc3c45774122fb3c67ab340fd4744de165c1 -
Trigger Event:
push
-
Statement type: