Deterministic Python research engine for prediction-market evidence-backed backtests
Project description
batter
batter is a deterministic Python research engine for prediction-market evidence-backed backtests. Given a backtest spec and an EvidenceDataset, it produces a canonical result_hash — identical bytes across ubuntu / macos / windows on Python 3.12+ — enabling reproducible research and auditability of strategy claims. Engine 0.4 adds Monte Carlo bootstrap confidence intervals and a sign-permutation Sharpe test so credibility signals travel with every result.
The PyPI package is batter; the Python module is pancake_engine (sklearn-style rename: pip install batter then import pancake_engine).
Install
pip install batter
Quickstart
import json
from pancake_engine import run_backtest, BacktestSpec, EvidenceDataset, BacktestConfig
spec = BacktestSpec(**json.load(open("spec.json")))
dataset = EvidenceDataset(**json.load(open("dataset.json")))
config = BacktestConfig()
result = run_backtest(spec, dataset, config)
print(result.result_hash) # deterministic SHA-256 over canonical JSON
print(result.metrics.sharpe)
print(result.bootstrap_ci) # 95% CI on cagr / sharpe / sortino (0.4+)
Determinism
The same (spec, dataset, config) produces the same result_hash across ubuntu / macos / windows on Python 3.12+. Verification method, fixture set, and numeric bounds are documented in docs/math-audit-0.4.md §"Verification verdict".
Supported Python versions: 3.12 and 3.13. Python 3.11 is permanently out of scope — sum() semantics changed in 3.12 (compensated float accumulation), causing the bootstrap CI values to differ by 1 ULP and producing a different result_hash. No code change can reconcile this without reverse-engineering 3.12's exact internal accumulation path. See docs/py311-investigation-2026-05-27.md for the full root-cause analysis and docs/math-audit-0.4.md §"Known scope qualifier — Python 3.11" for the audit entry.
Cross-platform
CI enforces a 6-cell matrix (ubuntu-latest + macos-latest + windows-latest) × (Python 3.12 + 3.13). See the badge above.
License
Apache-2.0 — Copyright 2026 Michael Mustopo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file batter-0.4.2.tar.gz.
File metadata
- Download URL: batter-0.4.2.tar.gz
- Upload date:
- Size: 205.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e841d1cf8eefc71610798549ab94449e999a7b615e6a85146f55f3a347f32b8e
|
|
| MD5 |
d8f109f6e16e8ca2d503af79779f14d3
|
|
| BLAKE2b-256 |
3730136da2de9a32d0967857849c931442f172ca79deca32a1afc2fcfae756ee
|
Provenance
The following attestation bundles were made for batter-0.4.2.tar.gz:
Publisher:
publish.yml on usepancake/batter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
batter-0.4.2.tar.gz -
Subject digest:
e841d1cf8eefc71610798549ab94449e999a7b615e6a85146f55f3a347f32b8e - Sigstore transparency entry: 1635866693
- Sigstore integration time:
-
Permalink:
usepancake/batter@665f7577ecfa3cc36dbb2f7825c0d81c17947eb7 -
Branch / Tag:
refs/tags/0.4.2 - Owner: https://github.com/usepancake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@665f7577ecfa3cc36dbb2f7825c0d81c17947eb7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file batter-0.4.2-py3-none-any.whl.
File metadata
- Download URL: batter-0.4.2-py3-none-any.whl
- Upload date:
- Size: 70.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6503b75543449b530be136064d51311ef1acaad9702a51e796c95c0c5a2b8e74
|
|
| MD5 |
ce6ab86ee21db1dadc847885283ce22a
|
|
| BLAKE2b-256 |
e146f2fa9c1a25969f59803a734915f69138c66bf7d1405090a55e8dd456c908
|
Provenance
The following attestation bundles were made for batter-0.4.2-py3-none-any.whl:
Publisher:
publish.yml on usepancake/batter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
batter-0.4.2-py3-none-any.whl -
Subject digest:
6503b75543449b530be136064d51311ef1acaad9702a51e796c95c0c5a2b8e74 - Sigstore transparency entry: 1635866823
- Sigstore integration time:
-
Permalink:
usepancake/batter@665f7577ecfa3cc36dbb2f7825c0d81c17947eb7 -
Branch / Tag:
refs/tags/0.4.2 - Owner: https://github.com/usepancake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@665f7577ecfa3cc36dbb2f7825c0d81c17947eb7 -
Trigger Event:
release
-
Statement type: