Skip to main content
Lacuna

Stress-test your alpha before the market does.

Open-source quantitative research validation for finding where alpha breaks.

CI   Latest release   PyPI   Python 3.11+   Rust 2024   Arrow compatible   MIT License

Quick start · Capabilities · Documentation · v0.14.3


Lacuna is the evidence layer between quantitative research and confidence in a backtest. Give it signals, returns, trades, events, or experiment history; it looks for leakage, instability, overfitting, unrealistic costs, and missing point-in-time evidence.

It complements your research stack instead of replacing it. Results are returned as structured, versioned evidence that can be inspected, audited, rendered, and archived.

Quick start

Install the core distribution and verify the runtime:

python -m pip install --upgrade lacuna-quant
lacuna doctor --strict

Given explicit signal and price frames, a complete study is deliberately small:

import lacuna as lc

study = lc.SignalStudy(
    signal=signal,
    prices=prices,
    horizons=("1D", "5D", "20D"),
    signal_observed_at="open",
    entry="current_close",
    price_adjustment="total_return_adjusted",
)

report = study.audit(bootstrap_resamples=2_000, seed=42)

print(report.summary())
report.to_html("lacuna-audit.html")
report.bundle("study.lacuna")

Lacuna preserves weak or missing evidence as UNKNOWN; it never silently turns uncertainty into a pass. See the copy-pasteable guided signal audit for runnable data, output inspection, CLI usage, and bundle verification.

Optional method families stay explicit:

python -m pip install "lacuna-quant[statistics,report,pandas]"
python -m pip install lacuna-options

Stable-ABI wheels support CPython 3.11+ on Linux x86-64/arm64, macOS arm64, and Windows x86-64.

What Lacuna validates

Research risk Evidence Lacuna provides
Weak signals Group-aware IC, flexible buckets, neutralization, decay, multi-lag turnover, and diagnostic portfolio projections
Leakage and bad timing Availability-safe joins, explicit label boundaries, purged/CPCV splits, revisions, membership history, and future-data checks
Overfitting Bootstrap and permutation inference, PBO/CSCV, PSR/DSR, Reality Check, SPA, and multiple-testing correction
Fragile conclusions Parameter surfaces, perturbations, subperiods, regimes, universe transitions, and append-only trial history
Unrealistic trading assumptions Commission, spread, slippage, impact, borrow, stress, break-even, liquidity, and capacity evidence
Unreproducible research Immutable AnalysisResult values, standardized audits, canonical JSON/HTML with deterministic ordering and encoding for fixed evidence, and .lacuna bundles whose internal SHA-256 integrity is verifiable (integrity, not authenticity: bundles are unsigned)

Additional support includes availability-anchored event studies, generic factor-panel ingestion, DuckDB and scikit-learn adapters, Arrow-compatible and optional pandas boundaries, and an independently versioned options-research extension.

Evidence first

signals · returns · trades · events · trials
                      │
                      ▼
            explicit Python policy
                      │
          Polars · NumPy/SciPy · Rust
                      │
                      ▼
               AnalysisResult
                      │
          audit · report · JSON · bundle

Python owns methodology, temporal semantics, validation, provenance, findings, and public result construction. Renderers only present stored evidence; they do not recalculate statistics.

Findings keep state separate from severity:

  • PASS: the supplied evidence satisfies the declared rule;
  • WARN / FAIL: weakness or a violated contract is visible;
  • UNKNOWN: the source cannot establish the claim;
  • NOT_APPLICABLE: the methodology does not apply.

Performance without a Rust quota

Most work belongs in optimized Polars or NumPy. Rust ships only when full-call benchmarks beat an already optimized reference without changing public semantics.

In v0.14, grouped rank IC and built-in PBO/CSCV cleared that admission gate. Other candidates either improved without Rust or closed with a documented negative decision. Native execution remains single-threaded, reference implementations remain directly testable, and cp311-abi3 portability is a release requirement.

See the native decision ledger for workloads, measurements, correctness evidence, and rejected migrations.

Documentation

Start here Use it for
Getting started Installation and a first complete audit
Concepts Architecture, data semantics, and evidence contracts
Subsystems Method contracts, formulas, edge cases, and failure behavior
Public API Import paths and callable reference
Alphalens migration Moving factor workflows without importing hidden semantics
Engineering handbook Development, testing, native work, performance, and releases

The technical specification defines the full product boundary. The roadmap and v1 readiness ledger separate completed work from the remaining independent-user evidence requirement.

Development setup
git clone https://github.com/eyenoticeall/Lacuna.git
cd Lacuna
uv sync --group dev --group docs --extra all

uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pytest

cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
uv run mkdocs build --strict

Read CONTRIBUTING.md before submitting changes. Security reports follow SECURITY.md.

License

Lacuna is released under the MIT License. Artifacts published before the MIT-only change retain their original grants.


Lacuna mark

Bring the research. Lacuna will look for the gaps in the evidence.

Metadata

Release files for lacuna-quant 0.14.3

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

Source distribution (sdist)

Source distribution for lacuna-quant 0.14.3
File Size Uploaded Provenance Actions
lacuna_quant-0.14.3.tar.gz 262.3 kB With provenance Details for lacuna_quant-0.14.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for lacuna-quant 0.14.3
File Actions
lacuna_quant-0.14.3-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for lacuna_quant-0.14.3-cp311-abi3-win_amd64.whl
lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_x86_64.whl
lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_aarch64.whl
lacuna_quant-0.14.3-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for lacuna_quant-0.14.3-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 2.2 MB

Release files / lacuna_quant-0.14.3.tar.gz

Download URL lacuna_quant-0.14.3.tar.gz
Size 262.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ce2291efb2e2eba13199e9c66e677c27921ddcdecfe7c010865303de732901ae
BLAKE2b-256 checksum
How to use checksums
186612d6c581f73dcfb24f6a9cbee8145c8bad8eaea9e3c598fe5afe4e172759
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 Nov 22, 2026.

Transparency log

Release files / lacuna_quant-0.14.3-cp311-abi3-win_amd64.whl

Download URL lacuna_quant-0.14.3-cp311-abi3-win_amd64.whl
Size 419.6 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3926a22f4d6565720a9624d973919eb4e6dfabf6712f1a53151da2a4bd87fc29
BLAKE2b-256 checksum
How to use checksums
3d90c14f763d5531e3b00b14b1a53797d980a5b4ebedc07c7c99f07818768b7b
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 Nov 22, 2026.

Transparency log

Release files / lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_x86_64.whl
Size 502.8 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
5a6a9662478085ca99e35d2f97cbf9c375f16d45708168c29864b0a463b5ed5f
BLAKE2b-256 checksum
How to use checksums
c3c6d19531a422ef1ed5f141a1d767fd4f8e772d8b66b1e170780a543dcda04f
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 Nov 22, 2026.

Transparency log

Release files / lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL lacuna_quant-0.14.3-cp311-abi3-manylinux_2_28_aarch64.whl
Size 493.0 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
76ef78d5d1c124f47adbef52844ddb0455e5797e55b32afd71cdbd8fb3480f3a
BLAKE2b-256 checksum
How to use checksums
4d0f179872a37bf99bc16342dfdb262ab10da076fa2d5d39d436ec960d3a3288
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 Nov 22, 2026.

Transparency log

Release files / lacuna_quant-0.14.3-cp311-abi3-macosx_11_0_arm64.whl

Download URL lacuna_quant-0.14.3-cp311-abi3-macosx_11_0_arm64.whl
Size 479.4 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a1f170d1ee6cd9217b9795686a8dd76d531b213cf90bacca470206f6564933a3
BLAKE2b-256 checksum
How to use checksums
92886e36ce727fb5c90c736afc8f00346fb42896afc4e394b5ffa103848c98a0
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 Nov 22, 2026.

Transparency log

Security for lacuna-quant 0.14.3

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for lacuna_quant-0.14.3.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 22, 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