Skip to main content

openquanter

Python bindings for OpenQuanter (source), 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, 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openquanter 2.0.1
File Size Uploaded
openquanter-2.0.1.tar.gz 401.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for openquanter 2.0.1
File
openquanter-2.0.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
openquanter-2.0.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
openquanter-2.0.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 1.8 MB

Release files / openquanter-2.0.1.tar.gz

Download URL openquanter-2.0.1.tar.gz
Size 401.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3e70863f540c028236b68ef7590f7fe4428fd57c0b22662fb8981d1dd9a6f605
BLAKE2b-256 checksum
How to use checksums
f03fa7064ef76eda1578410852f62578e039417eb8f505b1bdd1b28f8b8b9677
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 11, 2026.

Transparency log

Release files / openquanter-2.0.1-cp39-abi3-win_amd64.whl

Download URL openquanter-2.0.1-cp39-abi3-win_amd64.whl
Size 249.6 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0ed2c86e0ebd9b202eeb91564dd20017052aef202dca093708a8ef065cc33ea2
BLAKE2b-256 checksum
How to use checksums
9d355c5f8e13876ad9742609599115100c2443b947566a78de429953df12915f
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 11, 2026.

Transparency log

Release files / openquanter-2.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL openquanter-2.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 405.6 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
efb1a2fa31236a926b635e9f50a35e2c6b1b5c98b0f17b80e9ad8ac7b4a404d1
BLAKE2b-256 checksum
How to use checksums
9141548e6610978c78fa344fece8065cc3806858dff0bd9a1a727d69f23e6c41
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 11, 2026.

Transparency log

Release files / openquanter-2.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL openquanter-2.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 394.5 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5ac74f194737afc433b7c218b0a86dab70dc815120a690319f1b3f28cbca4433
BLAKE2b-256 checksum
How to use checksums
6306f0901ef0ead23c28b950775366413643b6faffa52bd987d749ed7fb950bd
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 11, 2026.

Transparency log

Release files / openquanter-2.0.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL openquanter-2.0.1-cp39-abi3-macosx_11_0_arm64.whl
Size 356.8 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9d9e222ff6dc67b08820c7f7cebf1faa9db55e17d305d6254c0273f6003d6ac9
BLAKE2b-256 checksum
How to use checksums
70c9c0f6753f1642e42ac723b69a19918019a468a55b84a6a53dfaafdabf4ebf
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 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.1 This release

5 release files

2.0.0

5 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page