Skip to main content

yuzu — Python bindings

Python bindings for the citrusinvest backtest engine: the yuzu backtest core plus the lemon strategy DSL, compiled from Rust. The engine boundary is pure data — (strategy, panels, config) → report — so the bindings are thin and fast.

import yuzu

report = yuzu.run_backtest(
    "close > sma(close, 20)",          # lemon source (or a JSON Expr dict/string)
    panels={
        "close": df_close,             # DataFrame (dates × symbols), or a
                                       # {"dates": [...], "symbols": [...], "data": [[...]]} dict
    },
    config={"fee_ratio": 0.001, "benchmark_key": "spy"},
)
report["equity"]                        # NAV curve, base 1.0
report["metrics"]["sharpe"]             # headline metrics
report["monthly_returns"]               # calendar tables, trades, bootstrap bands, ...

The report is the same JSON contract the engine's WASM and server boundaries emit — see docs/backtest-engine.md in the repository for the full schema and the BacktestConfig knobs (fees, slippage, square-root market impact, liquidity cap, delisting handling, benchmark comparison, bootstrap bands).

DSL tooling is included:

yuzu.parse("close > sma(close, 20)")   # -> Expr tree as a dict
yuzu.format(tree)                       # -> canonical lemon source
yuzu.lint("clsoe > 1", ["close", "pe"]) # -> [{"line": 1, "col": 1, "message": "unknown series `clsoe` — did you mean `close`?"}]

Panels

A panel is a dense dates × symbols matrix of floats (None/NaN = missing):

  • DataFrame (pandas/polars duck-type): index = dates (int YYYYMMDD, strings, or anything with strftime), columns = symbols.
  • dict: {"dates": [20240102, ...], "symbols": ["AAPL", ...], "data": [[...], ...]}.

Series names are the engine's (close, high, low, volume, pe, …); a volume panel is required for the liquidity cap / market-impact features, and high/low enable per-trade MAE/MFE.

Install

pip install yuzu-backtest          # from PyPI (distribution name), imports as `yuzu`

Build from source

pip install maturin
pip install ./crates/yuzu-py       # or: maturin develop -m crates/yuzu-py/Cargo.toml

Wheels are abi3 (Python ≥ 3.9). License: MIT.

Versioning: major.minor mirrors the engine workspace version (a 0.2.x wheel is built from the 0.2 engine series); the patch segment is the bindings' own, so binding-only fixes can ship without an engine release. Each wheel is a snapshot of the whole repository at its release tag.

Metadata

Release files for yuzu-backtest 0.2.0

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

Source distribution (sdist)

Source distribution for yuzu-backtest 0.2.0
File Size Uploaded Provenance
yuzu_backtest-0.2.0.tar.gz 101.4 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for yuzu-backtest 0.2.0
File
yuzu_backtest-0.2.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
yuzu_backtest-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
yuzu_backtest-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
yuzu_backtest-0.2.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
yuzu_backtest-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.4 MB

Release files / yuzu_backtest-0.2.0.tar.gz

Download URL yuzu_backtest-0.2.0.tar.gz
Size 101.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0452a7dc27cb7723bdd3ce752652293a0203e3d28d86e64e9ca2ac52f605822f
BLAKE2b-256 checksum
How to use checksums
d81030eeafd30070fed20fedf2c69b0f50fcffd81fa6e5571b953fa964003a0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

Release files / yuzu_backtest-0.2.0-cp39-abi3-win_amd64.whl

Download URL yuzu_backtest-0.2.0-cp39-abi3-win_amd64.whl
Size 593.6 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
773155529ec9e795cc702c63399335ed2c819dee9648bdc8b5160440a9075bf9
BLAKE2b-256 checksum
How to use checksums
48f0637f4bc50d9cb07a59e6f4023118fafd92e23e3a948d680d89773359ad09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

Release files / yuzu_backtest-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL yuzu_backtest-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 703.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
590fcb5a3af2e788a62c821f014b57287d56c6732048d9aa335f96f6f8868bad
BLAKE2b-256 checksum
How to use checksums
e73ce6ce8ac4c480c7ffec0166a23df09ddff50934ea8c8b57dae4b408f3568c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

Release files / yuzu_backtest-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL yuzu_backtest-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 674.4 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
ad7f70ff894e542a2140fcceb0a07c89469054675231e5c44bef58f6e3656407
BLAKE2b-256 checksum
How to use checksums
8fcd777fa1cbcef2aea19418a5391c387288d96b35dd4aaa0cdc02a641f1bd4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

Release files / yuzu_backtest-0.2.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL yuzu_backtest-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Size 620.9 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7aca2d9ec9e48bf24ce516cf12f3f3722f44a165ade27638200b7e334771bf9c
BLAKE2b-256 checksum
How to use checksums
90004e1c57a27a554d05c78206e9d10e658b4e63e25870c97ca3164483a953f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

Release files / yuzu_backtest-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL yuzu_backtest-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 658.8 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
11780643c22256e66fd853794acb6673134a476c353f7fbfd82f6e145ed136ea
BLAKE2b-256 checksum
How to use checksums
afb2e19d7ec9539c77ceb585cfee4a94ce9bb9b2802f4015cbfca4104925b7dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

Security for yuzu-backtest 0.2.0

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 yuzu_backtest-0.2.0.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 Jul 9, 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 release files Full provenance

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