DuckDB-backed local mock implementation of selected xtquant APIs.
Project description
xtquant-duck
DuckDB-backed local mock implementation of selected xtquant APIs.
The goal is to let research code switch between real QMT xtquant and a local
DuckDB-backed mock by changing only the import. QMT semantics are the canonical
reference; unsupported mock behavior raises NotImplementedError instead of
silently returning placeholder data.
Install
uv pip install xtquant-duck
For local development:
git clone git@github.com:drunkpig/xtquant-duck.git
cd xtquant-duck
uv sync --all-extras --dev
Basic Usage
Set the DuckDB database path:
$env:QMT_MOCK_DUCKDB = "C:\data-tick\duckdb\qmt_mock.duckdb"
Use the mock package as an xtquant-compatible module:
import xtquant_duck as xtquant
xtdata = xtquant.xtdata
data = xtdata.get_market_data_ex(
field_list=["time", "open", "high", "low", "close", "volume"],
stock_list=["600036.SH"],
period="1d",
start_time="20220101",
end_time="20251231",
dividend_type="front_ratio",
)
The packaged qmt_data_layer module is kept for database build and validation
tools. Strategy code should use the xtquant_duck API above so switching back
to real miniQMT only changes the import.
Default database path is C:\data-tick\duckdb\qmt_mock.duckdb; override it with
QMT_MOCK_DUCKDB.
Documentation
See docs/MOCK_XTQUANT_API.md for supported APIs, parameters, return shapes, and strict unsupported behavior.
The production DuckDB file uses QMT-canonical tables qmt_tick_v1 and
qmt_daily_v1; legacy raw_* tables are retained only as rebuild/audit inputs.
Tests
uv run python -m unittest discover -s test -v
The unit tests build a temporary DuckDB database and do not read or write the default production database.
Project details
Release history Release notifications | RSS feed
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 xtquant_duck-0.1.20260704.6.tar.gz.
File metadata
- Download URL: xtquant_duck-0.1.20260704.6.tar.gz
- Upload date:
- Size: 32.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cac6506119969c460353483dc0e7661d01412b0fc7bc2923b5d99edc5697308a
|
|
| MD5 |
14f3537fded0cef0427b10dda4e6e460
|
|
| BLAKE2b-256 |
c167605ed6d594b2bebaddb7f9dbfc8ee11c1e10e59b8f3b1db5ab8376c16fd7
|
Provenance
The following attestation bundles were made for xtquant_duck-0.1.20260704.6.tar.gz:
Publisher:
publish.yml on drunkpig/xtquant-duck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtquant_duck-0.1.20260704.6.tar.gz -
Subject digest:
cac6506119969c460353483dc0e7661d01412b0fc7bc2923b5d99edc5697308a - Sigstore transparency entry: 2066356922
- Sigstore integration time:
-
Permalink:
drunkpig/xtquant-duck@dc8b4cdcd92ee2fb562bda5624532eb69bdbe3a2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/drunkpig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc8b4cdcd92ee2fb562bda5624532eb69bdbe3a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file xtquant_duck-0.1.20260704.6-py3-none-any.whl.
File metadata
- Download URL: xtquant_duck-0.1.20260704.6-py3-none-any.whl
- Upload date:
- Size: 11.3 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 |
03cf44339bc730b0fd6e2fbeaef1cebf495113d0a91458e4a8ed8aa7ff429435
|
|
| MD5 |
2f2bed48f7bf234756c9fde64a6dc547
|
|
| BLAKE2b-256 |
f5f546c0cf1a6095d0ae72b9304ce5873f5b2d479401438f31f3f5b4ca48ac37
|
Provenance
The following attestation bundles were made for xtquant_duck-0.1.20260704.6-py3-none-any.whl:
Publisher:
publish.yml on drunkpig/xtquant-duck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtquant_duck-0.1.20260704.6-py3-none-any.whl -
Subject digest:
03cf44339bc730b0fd6e2fbeaef1cebf495113d0a91458e4a8ed8aa7ff429435 - Sigstore transparency entry: 2066356955
- Sigstore integration time:
-
Permalink:
drunkpig/xtquant-duck@dc8b4cdcd92ee2fb562bda5624532eb69bdbe3a2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/drunkpig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc8b4cdcd92ee2fb562bda5624532eb69bdbe3a2 -
Trigger Event:
push
-
Statement type: