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


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, deterministic JSON/HTML, and verifiable .lacuna bundles

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

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.1
File Size Uploaded
lacuna_quant-0.14.1.tar.gz 244.0 kB Details

Built distributions (wheels)

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

Total release size: 2.1 MB

Release files / lacuna_quant-0.14.1.tar.gz

Download URL lacuna_quant-0.14.1.tar.gz
Size 244.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b36687ff4811505891521179959d47fac6b86446a58fb666823f4a50c7ee37d2
BLAKE2b-256 checksum
How to use checksums
7764e421c847ea26e101376c556dbbc0ef9d5da6c89413994bbfbc575fda6361
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 Sep 29, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.1-cp311-abi3-win_amd64.whl
Size 414.0 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6560b5bca2e1eb13beaad8186e7b02fe993748c91c059a014090ad49e52f228a
BLAKE2b-256 checksum
How to use checksums
929edc529213329db440d9e9b28049f4382711bbc42d1ed4ed28c3ea809e87fa
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 Sep 29, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.1-cp311-abi3-manylinux_2_28_x86_64.whl
Size 503.4 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
680e867a262a76c744bda8005cebcc179ff3847523308c8be77e1444b6984ece
BLAKE2b-256 checksum
How to use checksums
cbaef5e66e5650f363ea5fea2ad9cdd057afd2cedeb2210c55967a133e8a5966
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 Sep 29, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 491.5 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
35c7978409cebd281267305ac7adf3fa6858e6caa82b2f1438846ce6c48353b3
BLAKE2b-256 checksum
How to use checksums
836e60ef8a2a02d722a6fcef17cc037a30c8db830000df973c667853057fec9f
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 Sep 29, 2026.

Transparency log

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

Download URL lacuna_quant-0.14.1-cp311-abi3-macosx_11_0_arm64.whl
Size 475.6 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
42640e9457229fdfda36f1222bde225cca9ae93cc0fce47fc19b4f72109aa8c6
BLAKE2b-256 checksum
How to use checksums
4b0dbdea18f9563ee222857b8a0aafd84a153e98d43ad17948987971930a8c4f
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 Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.14.1 This release

5 release files

0.14.0

5 release files

0.13.0

5 release files

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