Skip to content

About

QMT / miniQMT A-share execution runtime for QuantStrategyLab, dry-run first.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

100 Commits

Folders and files

Repository files navigation

QmtPlatform

English | 简体中文

A-share quant platform layer for miniQMT / QMT, built on QuantPlatformKit and CnEquityStrategies.

Status

Experimental. The pinned CN policy has no selectable runtime profiles. Retired profiles are rejected before offline evaluation or order preview; historical catalog metadata and adapters remain available. This project is not financial advice and does not guarantee any trading result.

What this is

QmtPlatform provides the QMT platform integration layer. It loads strategy profiles from CnEquityStrategies, reads local market-history inputs, and evaluates target weights against a synthetic portfolio. QuantPlatformKit supplies shared runtime and strategy contracts; QuantRuntimeSettings supplies runtime target definitions.

What this is not

This repository does not implement strategy research or publish snapshot artifacts. It has no miniQMT / QMT broker connection. The offline broker adapter returns blocked for non-dry-run order requests and never reports them as submitted.

Quick start

Requirements: Python 3.11 or later and Git. Run these commands from the repository root. The package installation resolves the dependency revisions declared in pyproject.toml.

python3 -m pip install -e '.[test]'
python3 -m pytest -q tests

python3 main.py

Query GET /profiles to inspect the disabled historical profiles. No profile can currently pass preflight or run through /dry-run. The retained industry ETF smoke scripts reject their retired profiles under this policy.

Configuration

Use .env.example as the dry-run configuration reference. Export its values in your shell; the entrypoint reads environment variables. The preflight command validates the selected profile and required input paths without accessing broker credentials.

Variable Required Default Purpose
STRATEGY_PROFILE Unless RUNTIME_TARGET_JSON is set none QMT-enabled strategy profile ID.
QMT_DRY_RUN_ONLY No true Keep true; preflight rejects false, and the HTTP dry-run endpoint always uses dry-run settings.
QMT_EXECUTION_MODE No dry_run Set to paper only for offline paper admission; this value does not create a broker connection.
QMT_PAPER_ADMISSION_INPUT_SHA256 For --paper-admission none Pre-recorded SHA-256 digest of the fixed market-history input.
QMT_MARKET_HISTORY_PATH For market-history profiles none Local CSV path with date,symbol,close columns.
RUNTIME_TARGET_JSON No none JSON runtime target from QuantRuntimeSettings; takes precedence over STRATEGY_PROFILE.
PORT No 8080 HTTP port; the Flask entrypoint binds to 0.0.0.0.

Retired profiles

cn_industry_etf_rotation and cn_industry_etf_rotation_aggressive are no longer selectable, including through aliases, environment configuration or RUNTIME_TARGET_JSON. The QMT rollout allowlist is empty. Historical definitions and adapters remain available for reading and isolated contract tests; they do not grant runtime selection.

Offline paper admission

--paper-admission currently rejects retired profiles at configuration validation. The retained checks below describe the offline contract for an eligible profile. The command checks a local configuration and fixed input file. It requires QMT_EXECUTION_MODE=paper, QMT_DRY_RUN_ONLY=true, and a pre-recorded SHA-256 digest matching QMT_MARKET_HISTORY_PATH.

After configuring the profile and input path, replace <expected-sha256> with that recorded digest:

export QMT_EXECUTION_MODE=paper
export QMT_DRY_RUN_ONLY=true
export QMT_PAPER_ADMISSION_INPUT_SHA256='<expected-sha256>'
python3 scripts/preflight_qmt_runtime.py --paper-admission

The command loads the strategy contract and hashes the local input. It does not call a QMT SDK or provider, read credentials, create orders, or evaluate a broker account. The word paper here names an offline check, not a broker paper-trading connection.

Disabled-target lifecycle validation

With the current empty allowlist, the retained industry ETF target fails preflight and is reported as attention. The weekday Runtime Target Lifecycle workflow runs deterministic preflight and a fixture-backed dry-run for a fixed disabled target. It publishes disabled / dry_run status. A completed cycle whose target weights are empty because of the risk gate is a successful no-order check; a preflight or dry-run failure is reported as attention. These reports do not change target settings, establish a broker connection, or submit orders.

HTTP endpoints

Method Path Response
GET /probe Health, active profile, and dry-run setting.
GET /profiles Platform profile matrix.
GET, POST /dry-run Strategy target weights and order previews using local inputs.

Related repositories

Repository layout

application/    offline broker adapter and dry-run cycle
data/fixtures/  sample market-history and snapshot inputs
scripts/        preflight and local smoke commands
tests/          automated tests
main.py         Flask HTTP entrypoint

Contributing

See CONTRIBUTING.md. AI assistants and maintainers also follow AGENTS.md. Documentation follows the QuantStrategyLab documentation style guide.

Security

See SECURITY.md for private vulnerability reporting. Do not put credentials or account identifiers in issues, examples, or logs.

License

MIT.

About

QMT / miniQMT A-share execution runtime for QuantStrategyLab, dry-run first.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages