Skip to main content

0xarchive-backtest

0xArchive backtest: a strategy's equity curve beating 12 random books

A deterministic backtester for Hyperliquid perps, on 0xArchive data. The engine is Rust; strategies are Python. The same strategy, data and parameters give the same result hash on every machine, so a result is a claim anyone can check.

It is the engine behind 0xarchive-quant, a quant research skill for coding agents: hand Claude Code or Codex a wallet, an idea or a script, and it comes back with a verdict you can rerun.

Install

pip install "0xarchive-backtest[curated]"

Prebuilt for macOS, Linux and Windows; Python 3.12 or later (3.11 without [curated], the pinned numpy, pandas and scipy that strategies may import).

Quickstart

Pull a minute dataset with your 0xArchive API key. Months are inclusive. Free keys read only the last 30 days, so this September window needs a paid plan:

export OXARCHIVE_API_KEY="0xa_your_api_key"
0xbt data pull --markets BTC,ETH,SOL,HYPE --from 2026-09 --to 2026-09

Write a strategy:

# momentum.py: each day, long the strongest of four perps over 3 days and short the weakest
import oxarchive_backtest as oxb
from oxarchive_backtest import x


def strategy(lookback="3d"):
    return oxb.Strategy(
        universe=["BTC", "ETH", "SOL", "HYPE"],
        clock=x.daily(),
        signal=lambda h: h.close.ret(lookback),
        weights=x.long_short(0.25),
    )

Backtest it, then put it through the gauntlet:

0xbt backtest momentum.py --start 2026-09-01 --end 2026-10-01
0xbt gauntlet momentum.py --start 2026-09-01 --end 2026-10-01 \
  -g lookback=1d,3d --card card.md

The backtest prints the return, Sharpe, drawdown, fees and funding, and a result hash. The gauntlet runs every check on the best setting and reads the verdict off a fixed ladder. This one stops at fails nulls: one in ten random books did as well, over the 5% bar, so a month of momentum on four markets is not an edge.

The gauntlet

A gauntlet report card: verdict holds out of sample, deflated Sharpe 0.93 over 4 tries, short of the 0.95 bar

0xbt gauntlet runs, in order: the grid as trials; costs and a benchmark; nulls (the flipped signal, random books and the strategy's own signal at random lags, redrawn at its holding period); the candidate on six clock phases, flagged "clock luck" when some of them lose; a split and walk-forward; the deflated Sharpe over every try; and robustness. The verdict is the first rung whose rule fails:

Rung Verdict
1 loses after costs
2 fails nulls
3 in-sample only
4 holds out of sample
5 passes deflated Sharpe
6 passes sealed holdout

0xbt study init starts a trial ledger: every backtest below it is recorded, the deflated Sharpe counts all of them, and the last months of data stay sealed until one candidate is committed, once.

What the engine models

Minute bars with taker flow, funding, open interest and liquidations; taker and maker fees; funding payments; leverage limits and liquidation; point-in-time universes (x.top_n, x.rule) so delisted markets are included; stops, take-profits, trailing and time exits checked every minute; and deterministic math, so results don't depend on the platform.

MIT licensed.

Metadata

Release files for 0xarchive-backtest 0.3.2

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

Source distribution (sdist)

Source distribution for 0xarchive-backtest 0.3.2
File Size Uploaded Provenance Actions
0xarchive_backtest-0.3.2.tar.gz 200.8 kB With provenance Details for 0xarchive_backtest-0.3.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for 0xarchive-backtest 0.3.2
File Actions
0xarchive_backtest-0.3.2-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for 0xarchive_backtest-0.3.2-cp311-abi3-win_amd64.whl
0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for 0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for 0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
0xarchive_backtest-0.3.2-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for 0xarchive_backtest-0.3.2-cp311-abi3-macosx_11_0_arm64.whl
0xarchive_backtest-0.3.2-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for 0xarchive_backtest-0.3.2-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 20.6 MB

Release files / 0xarchive_backtest-0.3.2.tar.gz

Download URL 0xarchive_backtest-0.3.2.tar.gz
Size 200.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d3fe0a3a8a1d5107b33539a5be313725160b6197c36d6c582d003365e0326ee7
BLAKE2b-256 checksum
How to use checksums
3b08ec0b013f57efe8ba0a06fdc16c4113e66a1e2c750e905e3a7590f23488f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 8, 2026.

Transparency log

Release files / 0xarchive_backtest-0.3.2-cp311-abi3-win_amd64.whl

Download URL 0xarchive_backtest-0.3.2-cp311-abi3-win_amd64.whl
Size 4.1 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
29b85086d880142898a20987ec1f87c2406a5639d06f701970389e3a93890eab
BLAKE2b-256 checksum
How to use checksums
5b528002e87dfca97d1f0c43ef5b093ad145375314897e7e1426fdc911d1b186
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 8, 2026.

Transparency log

Release files / 0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL 0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
aedd4bd7d3b3ec9b1a67337747e31a09bc44a0d5e31ed44317bc7f12a8f8e7a4
BLAKE2b-256 checksum
How to use checksums
6d9c3ce7d6611c2b4931471b88639d8902a307d0f79441b6e4ec386f381158f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 8, 2026.

Transparency log

Release files / 0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL 0xarchive_backtest-0.3.2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 4.1 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
73763ed058b38635abb5aa415a138a6084d564bbbbb0a5e9d3e90339c6f83b4f
BLAKE2b-256 checksum
How to use checksums
b1c0c11e00f4e6282282fda5f47a736b738287ba133182022bebb5df16c6761a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 8, 2026.

Transparency log

Release files / 0xarchive_backtest-0.3.2-cp311-abi3-macosx_11_0_arm64.whl

Download URL 0xarchive_backtest-0.3.2-cp311-abi3-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3fdc2076b726805dabd8159bc63a13888a0e24bd4ba02df213713271363a9c33
BLAKE2b-256 checksum
How to use checksums
e1280caa3bee6e8b543e6007f796aca58e260d03ac2cdf2910e996ab7f8a0ded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 8, 2026.

Transparency log

Release files / 0xarchive_backtest-0.3.2-cp311-abi3-macosx_10_12_x86_64.whl

Download URL 0xarchive_backtest-0.3.2-cp311-abi3-macosx_10_12_x86_64.whl
Size 4.1 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7b3354cc3f5551c60425b8270adab35ede63e6fa8827b36da2039063ef325c84
BLAKE2b-256 checksum
How to use checksums
7f0809cf9b8d8dca5f17f8223a315c9ad4c5d7e33ab80b82a8b5ce0daa02cf19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 8, 2026.

Transparency log

Security for 0xarchive-backtest 0.3.2

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for 0xarchive_backtest-0.3.2.tar.gz

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 Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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