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.2


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.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 lacuna-quant 0.14.2
File Size Uploaded Provenance Actions
lacuna_quant-0.14.2.tar.gz 260.0 kB With provenance Details for lacuna_quant-0.14.2.tar.gz

Built distributions (wheels)

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

Total release size: 2.2 MB

Release files / lacuna_quant-0.14.2.tar.gz

Download URL lacuna_quant-0.14.2.tar.gz
Size 260.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2d89c1ea1f873e209272af0a637fa85335c5fb340dcdb1d497bcd512ef07b72d
BLAKE2b-256 checksum
How to use checksums
bcb798c9207fdb1ed5c0feb2838ce87825fc9d1cac2dae9ef7033e591033044c
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 21, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.2-cp311-abi3-win_amd64.whl
Size 418.9 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
eccaae93ff8ef7f8c5b86e4b3e40e6fb9abfbf8942e113ad9f9b872545a60527
BLAKE2b-256 checksum
How to use checksums
3205cfeef3af83d3b5b0eb4c1e655c2849a60be4cd0316f07176186098541219
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 21, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.2-cp311-abi3-manylinux_2_28_x86_64.whl
Size 502.1 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
f45958bfc9f91fadf931b6cf9eaa4cf5e130782001c6c1b472090b496112b7b7
BLAKE2b-256 checksum
How to use checksums
33fa53d5c853c5be2f3af9df8ab3106d1519db5a0e6c7db295b7700f06163ae6
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 21, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.2-cp311-abi3-manylinux_2_28_aarch64.whl
Size 492.3 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
ef76e757332fbc933cc4a0cc76e8f5833136a504e0535297a9ab57e5aee03f62
BLAKE2b-256 checksum
How to use checksums
898e26a566c4a752eba839d839e4f72f293bbfd56ac01b1a9c0b5a6e8f7233c3
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 21, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.2-cp311-abi3-macosx_11_0_arm64.whl
Size 478.6 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d19982086177c725d169c243b9a07ceec5a412104493aab1cec92debae2cf92f
BLAKE2b-256 checksum
How to use checksums
4ee59d699e25ae41a6a379d5ff2f2233963149898d84a7ff2d556deb9e670b7a
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 21, 2026.

Transparency log

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

Select from 5 files

Attestation for lacuna_quant-0.14.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 21, 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