fix: unify backtest execution and add forward validation candidates

Share point-in-time signals and a cash-funded order ledger across backtests and trading. Correct eligibility, missing-price fills, quality factors, regime inputs, warmup windows, and cash-injection accounting. Add reproducible registered-strategy comparisons and paired forward candidates with a 20% resize band.

Validation: 125 Python tests, 23 web tests, TypeScript/Vite build, 87 strategy causality checks, and real-data target/order/equity parity for 10 strategies.
This commit is contained in:
2026-10-01 02:24:01 -07:00
parent 761725d2c8
commit 722cade974
45 changed files with 1561 additions and 1021 deletions

View File

@@ -5,7 +5,7 @@ rules (PIT S&P 500 members, next-open fills, 10 bp costs, phase averaging).
PYTHONPATH=. uv run --with numba python -m research.lab.us_sweep --part construction
PYTHONPATH=. uv run --with numba python -m research.lab.us_sweep --part overlays
Every configuration is appended to data/research/results/trials_us_sweep.csv
Every configuration is appended to data/research/results/trials_us_sweep.jsonl
so the deflated Sharpe of the final pick can count them.
"""
@@ -100,11 +100,10 @@ def fmt(name, st) -> str:
def log_trials(rows, part):
os.makedirs(RESULTS, exist_ok=True)
path = os.path.join(RESULTS, "trials_us_sweep.csv")
df = pd.DataFrame([{k: v for k, v in r.items() if not k.startswith("_") and k != "blocks"} for r in rows])
df["part"] = part
df.to_csv(path, mode="a", header=not os.path.exists(path), index=False)
from research.lab.trials import append_trials
records = [{k: v for k, v in r.items() if not k.startswith("_") and k != "blocks"} for r in rows]
append_trials(os.path.join(RESULTS, "trials_us_sweep.jsonl"), records,
{"part": part, "role": "development; historical data already examined"})
def construction(p, S) -> list[dict]: