Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.

Status

Alpha. The APIs are documented and not yet stable. The Rust core is pre-alpha 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.0a1

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.0a1
File Size Uploaded
openquanter-2.0.0a1.tar.gz 158.4 kB Details

Built distributions (wheels)

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

Total release size: 1.3 MB

Release files / openquanter-2.0.0a1.tar.gz

Download URL openquanter-2.0.0a1.tar.gz
Size 158.4 kB
Tags Source
SHA-256 checksum
How to use checksums
13e777ad7a01b41cba8317d46097a02a73fa9e0b7fe76b14f0ef03c1dc7f8ec5
BLAKE2b-256 checksum
How to use checksums
49663ea33b25c4284afe83225c580bda1e7a8178a73b8c9efaac5469c521cf7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / openquanter-2.0.0a1-cp39-abi3-win_amd64.whl

Download URL openquanter-2.0.0a1-cp39-abi3-win_amd64.whl
Size 188.3 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f912302ddc71badf247b945b679eed607eecaebf1cb5359299fe4362c567f80b
BLAKE2b-256 checksum
How to use checksums
34874b8f202242baa55508789149b266c7fe1ccf3450ab377b0aa2d1ec155894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / openquanter-2.0.0a1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL openquanter-2.0.0a1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 337.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4bdc2483fcb623d6db1dea3d3bdd9c064ab32bf282674ad2dc6d569335e1f418
BLAKE2b-256 checksum
How to use checksums
982941d2afea3b909e4b2b0e885feca6f760b89bf95ae3836fefb946a70ef75f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / openquanter-2.0.0a1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL openquanter-2.0.0a1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 331.3 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
fc66d03e6865bf0a6a6359a81ba2b78569ba982f0bc9a6e2e83a6a59c2a10c20
BLAKE2b-256 checksum
How to use checksums
117da2aed4999d532803044c6b5ec253ce43376ed52e184f5ed11acef4efec71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / openquanter-2.0.0a1-cp39-abi3-macosx_11_0_arm64.whl

Download URL openquanter-2.0.0a1-cp39-abi3-macosx_11_0_arm64.whl
Size 296.4 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d982f3b0b17b2d58dad2eee87b98a2167cfd480a256908823521496dd0ecc7ff
BLAKE2b-256 checksum
How to use checksums
b864f1539b1053ca524184af383923674a16ceb143a887dabe22328d7213a0a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

2.0.0

5 release files

This release

2.0.0a1 This release

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