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.xtdata and a
local DuckDB-backed mock without changing strategy logic. 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 xtquant package directly:
from xtquant import 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="back_ratio",
)
Lower-level DuckDB access is available through:
from qmt_data_layer import DuckDbMarketData
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.
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.20260702.2.tar.gz.
File metadata
- Download URL: xtquant_duck-0.1.20260702.2.tar.gz
- Upload date:
- Size: 29.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 |
b4f598952c054a4e8d2bba5103f6f36be73f60fcc0f64ec3f08727501e3c53c9
|
|
| MD5 |
513f54ccf2afc52c5471a49e84e6d0ee
|
|
| BLAKE2b-256 |
e51ebfdb202773e0cb398e022d7241c756b954cc4b1fd7c8170b68a2b584b195
|
Provenance
The following attestation bundles were made for xtquant_duck-0.1.20260702.2.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.20260702.2.tar.gz -
Subject digest:
b4f598952c054a4e8d2bba5103f6f36be73f60fcc0f64ec3f08727501e3c53c9 - Sigstore transparency entry: 2045149696
- Sigstore integration time:
-
Permalink:
drunkpig/xtquant-duck@09194e20a7a80cf3899c542a2d1e7e83be9b8cbb -
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@09194e20a7a80cf3899c542a2d1e7e83be9b8cbb -
Trigger Event:
push
-
Statement type:
File details
Details for the file xtquant_duck-0.1.20260702.2-py3-none-any.whl.
File metadata
- Download URL: xtquant_duck-0.1.20260702.2-py3-none-any.whl
- Upload date:
- Size: 10.5 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 |
b276a6e632a5e5863aeb86688fea315510e2f598e031dfffecfaaabd3fab904f
|
|
| MD5 |
022aebe1a51b9338977c0993dd2d9b9a
|
|
| BLAKE2b-256 |
f708b633b0a26afc48657ebc9852c124b947bb065a2ad823b1d6414a4fe67cdd
|
Provenance
The following attestation bundles were made for xtquant_duck-0.1.20260702.2-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.20260702.2-py3-none-any.whl -
Subject digest:
b276a6e632a5e5863aeb86688fea315510e2f598e031dfffecfaaabd3fab904f - Sigstore transparency entry: 2045150145
- Sigstore integration time:
-
Permalink:
drunkpig/xtquant-duck@09194e20a7a80cf3899c542a2d1e7e83be9b8cbb -
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@09194e20a7a80cf3899c542a2d1e7e83be9b8cbb -
Trigger Event:
push
-
Statement type: