Skip to main content

Python client SDK for qmtserver remote MiniQMT gateways.

Project description

qmtclient

远程 qmtserver 的轻量 Python 客户端 SDK。适用于没有 MiniQMT、没有 xtquant 的策略机、服务器或笔记本。

qmtclient  -- HTTP RPC / WebSocket / token -->  qmtserver + MiniQMT + xtquant

安装

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"])
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/offline_strategy.json")
print(fake.market.get_full_tick(["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

qmtclient-0.1.0.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qmtclient-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file qmtclient-0.1.0.tar.gz.

File metadata

  • Download URL: qmtclient-0.1.0.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qmtclient-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd72d3ea538f6028f2c79acfd8fc3a6520dc0474e1c0a6b4391fc94538696ca6
MD5 262a92dbe6f3adc49f741c7f7a4459e8
BLAKE2b-256 6d899ad62e59ec95b4671331f1cd4cb49c147ef57d27c8a43f3650e83d62bc32

See more details on using hashes here.

Provenance

The following attestation bundles were made for qmtclient-0.1.0.tar.gz:

Publisher: publish.yml on gly11/qmtclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qmtclient-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qmtclient-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qmtclient-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e6dcf22957904eb9233b58db3d0ed06e2516dcb3256f6bb522d38732b724255
MD5 45c8988802cd664f44176a415f4cfe40
BLAKE2b-256 bfa388105d9059d237508e9588cb77bd46a7228226a48304b04668d0e9d42e90

See more details on using hashes here.

Provenance

The following attestation bundles were made for qmtclient-0.1.0-py3-none-any.whl:

Publisher: publish.yml on gly11/qmtclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page