Scripts de Python
lookahead-guard — Look-Ahead Bias Detector for Quant Backtests
Este anuncio se muestra en su idioma original (inglés).
Mechanically prove your backtest is not peeking at the future.
Qué recibes: 1 archivo · 31.58 KB · ZIP
Ver opciones de compraDescripción del producto
The bug that silently improves your backtest
scipy.ndimage.minimum_filter1d(x, 20) looks innocent. Its default origin=0 makes it a centered window [t-10, t+9] — it reads 9 future days, runs without error or warning, and only makes the equity curve prettier. One missing parameter once invalidated 14 rounds of research.
lookahead-guard turns "this isn't a lookahead bug, right?" from a prayer into a re-runnable gate.
Four independent layers
A — Primitive semantics. Does this rolling/filter primitive equal the true trailing window
[t-n+1, t]? Compared cell-by-cell against a reference implementation for a=1..30.B — Future-blind test (the only decisive one). Perturb data after time t; if any output at or before t changes, it is a lookahead bug. Depends on no returns, no assumptions.
C — Static AST sentinel. Flags centered windows, negative shift, full-sample standardization, bfill, random splits.
D — Permutation test. Uses a circular-shift null rather than naive shuffling — naive shuffling destroys autocorrelation and yields optimistic p-values.
What it does not do
It does not predict returns, rank strategies, or promise profit. It answers exactly one question: does this code or signal peek at the future?
Install
pip install lookahead-guard
pip install "lookahead-guard[full]" # adds pandas/scipy for the B layerHonest boundaries — please read
Layer C is a heuristic, not a proof. Passing C does not mean you are clean; B is the real test.
full-sample-statdeliberately marks cross-sectional statistics MEDIUM, because that pattern is often legitimate.negative-shiftalone is usually innocent —shift(-1)is standard when building forward-return labels.Layer A must compare against the same window. An earlier version compared against
len(a)instead ofnand became a new contamination source; there is a regression test for that bug.
MIT licensed. Pure Python, no network calls, no telemetry, runs fully offline.
Qué recibes
1 archivo · 31.58 KB
- lookahead-guard-0.1.0.zipZIP · 31.58 KB
Scripts de Python
lookahead-guard — Look-Ahead Bias Detector for Quant Backtests
Este anuncio se muestra en su idioma original (inglés).
Mechanically prove your backtest is not peeking at the future.
Incluido en Getly ProObtener Pro
Preguntas frecuentes
¿Tengo acceso al instante?
Sí. Es un producto digital: puedes descargarlo justo después del pago, directamente desde tu biblioteca.
¿Puedo usarlo en proyectos comerciales?
Sí. Se permite el uso comercial: úsalo en tu propio negocio y en cosas que vendas. No puedes revender ni redistribuir el archivo en sí.
¿Cuál es vuestra política de reembolso?
Puedes pedir un reembolso dentro de 30 días. Si algo no va bien, solicítalo desde tu pedido y el equipo de Getly lo revisa.
¿Qué formatos y tamaños de archivo recibiré?
Descargarás 1 archivo - ZIP - 31.58 KB en total.
¿Recibo actualizaciones gratis?
Sí: cuando el vendedor publica una versión nueva, puedes volver a descargar los archivos más recientes desde tu biblioteca sin coste extra. Mira el registro de cambios para ver las últimas actualizaciones.
Precio
$19.00

