Skip to main content

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xtquant_duck-0.1.20260703.3.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

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

xtquant_duck-0.1.20260703.3-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file xtquant_duck-0.1.20260703.3.tar.gz.

File metadata

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

File hashes

Hashes for xtquant_duck-0.1.20260703.3.tar.gz
Algorithm Hash digest
SHA256 7c0a83ae901e30c37b06d4c65d51b2263a973a81a8c87a0d5c0150d654833bf5
MD5 3b24e95a78646c3552d875d81af537c7
BLAKE2b-256 4df1fc86e3972302c371f410329833565670cb0f452f296cb56476db727f5eda

See more details on using hashes here.

Provenance

The following attestation bundles were made for xtquant_duck-0.1.20260703.3.tar.gz:

Publisher: publish.yml on drunkpig/xtquant-duck

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

File details

Details for the file xtquant_duck-0.1.20260703.3-py3-none-any.whl.

File metadata

File hashes

Hashes for xtquant_duck-0.1.20260703.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0528ae41c0ef1a4f6bda7a96a74729554bd617baa409977eba7c72aa93423d14
MD5 df4bf3f5280afe21ea41e1292b220d84
BLAKE2b-256 fa5a2f0a8600a455c5f5af45745eb085a1cd15b717a9617d4c7feec753604943

See more details on using hashes here.

Provenance

The following attestation bundles were made for xtquant_duck-0.1.20260703.3-py3-none-any.whl:

Publisher: publish.yml on drunkpig/xtquant-duck

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