openquanter
Python bindings for OpenQuanter, a Rust quantitative trading framework whose defining choice is that a backtest models the thing that ends accounts: the venue closing your position.
Two things are exposed. They are useful independently, and the first one does not ask you to migrate anything.
Evaluate the backtest you already have
The question a backtest cannot answer about itself — how much of the best result was bought by the searching:
import openquanter as oq
oq.sharpe_ratio(returns)
oq.deflated_sharpe_ratio(sharpes, best_sharpe, n_observations, skew, kurtosis)
oq.probability_of_backtest_overfitting(columns, n_blocks=16)
Every refusal says why — too few observations, zero variance, a matrix that will not split — because the reason is the half you act on.
Run a strategy on the Rust engine
A strategy with no framework in it, driven by the engine:
class Cross:
name = "cross"
def on_tick(self, ctx):
if self.crossed_up(ctx.last) and ctx.position == 0:
return [oq.Order("buy", 1)]
return None
result = oq.run_backtest(Cross(), ticks, balance=100_000)
print(result) # RunResult(strategy='cross', ticks=50000, fills=178, …)
If the venue would have closed the account, the result says so — in its
repr, not only in a field, because the repr is what gets read.
Throughput mode, and what it costs
batch=n calls the strategy once per batch and mirrors the account onto
the strategy object, which runs up to about 7x faster. It is not
free, and this package measures the cost rather than asserting it is
small: a decision made after seeing a tick cannot be placed before that
tick was seen, so batched decisions are late.
oq.compare_modes(Cross, ticks, balance=100_000, batch=64)
On the example crossover: batch=8 buys 2.8x for 1.3% of the strategy's
edge, batch=64 buys 5.8x for 18%, batch=512 buys 6.9x and takes the
edge away. Which of those is acceptable is a property of your strategy,
so the binding measures and does not choose. batch=1 is exactly
compatibility mode, and a test asserts the two runs are identical.
Did it use the future?
A strategy built from the whole window — indicators precomputed over all
of it, a threshold chosen from its distribution — sends orders a live run
could not. lookahead_check builds the strategy again from each prefix of
the data alone and reruns it; one that decides differently on a prefix
than on the whole window is reported, tick by tick.
report = oq.lookahead_check(lambda known: Cross(), ticks, balance=100_000)
report.clean # True: it decided from the past alone
build receives the ticks the strategy may know about. Up to
max_points (200) points are rerun, evenly spread, and sampled says
when that was fewer than all of them.
Status
Alpha. The APIs are documented and not yet stable. The Rust core is early and specific about it — see the status section for what is built and what is designed, and docs/WHY.md for what the project is for.
The framework stays usable without Python: the engine builds and tests with no interpreter present, and this package is a binding rather than the way the framework is used. That is D16, along with why the small surface came first.
Apache-2.0.
Metadata
Release files for openquanter 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openquanter-2.0.0.tar.gz | 325.7 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| openquanter-2.0.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| openquanter-2.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| openquanter-2.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| openquanter-2.0.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 1.7 MB
Release files / openquanter-2.0.0.tar.gz
| Download URL | openquanter-2.0.0.tar.gz |
|---|---|
| Size | 325.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afc7eb682ae63f14d83491ee1e19abe0dcef5f18e411b5bbe97087c921bb955a
|
|
BLAKE2b-256 checksum How to use checksums |
59c5ec42a72d6c9d3e47d135d9dbb33d969dcda28f3a979a4a2cef67e7924cb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / openquanter-2.0.0-cp39-abi3-win_amd64.whl
| Download URL | openquanter-2.0.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 244.1 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
088204acc141faf27795bc44c2db08099e22120813082c24ac834066f244f593
|
|
BLAKE2b-256 checksum How to use checksums |
eb6bd363e1477fd9009424915eb01946e24c52c149835339244abca731f099e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / openquanter-2.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | openquanter-2.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 399.2 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
60fb82e1fc8c1829293353c4df74e65558cb97551fa74e4a7bdfa5597785f772
|
|
BLAKE2b-256 checksum How to use checksums |
9ae9886dbc008299a47b6d1b26917ef8a96b7549047bad5a77d9af50e431cd4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / openquanter-2.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | openquanter-2.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 389.8 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7422ef75dac5c6ddb47b7662e1c48c877fd87f14f83834825f034f91e6d0e4db
|
|
BLAKE2b-256 checksum How to use checksums |
89d896a362dd9d73661bef8ddb457cecffb5bda1d95d0e6eda94148b3aff12d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / openquanter-2.0.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | openquanter-2.0.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 352.9 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
717a940177cfed5a8e0722827512445b138fa9315e82dece8885add5135e2597
|
|
BLAKE2b-256 checksum How to use checksums |
030fcf73a9bbb5ae84cb56aa8194892d5a773874ef8bf422729752f07263b304
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency log