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

@@ -130,16 +130,13 @@ def main() -> None:
print(line(f" {c} 2006-", describe(rr[c].dropna())))
# deflated Sharpe: every configuration this and the previous round tried
n = 0
for f in ("trials_us.csv", "trials_us_sweep.csv"):
path = os.path.join(RESULTS, f)
if os.path.exists(path):
with open(path) as fh:
n += sum(1 for line in fh if not line.startswith(("combo,", "score,")))
n += 12 + 60 + 20 # rotation schemes, fund_eval variants, defensive variants
from research.lab.trials import count_trials
n = count_trials(RESULTS, "us")
if n < 1:
raise ValueError("A trial ledger is required for DSR")
r = monthly_blend(R.loc[SPAN[0]:SPAN[1]].fillna(0.0), three)
dsr = deflated_sharpe(r, n)
out["dsr"] = {"n_trials": n, **{k: float(v) for k, v in dsr.items()}}
out["dsr"] = {"observed_trials_lower_bound": n, "role": "development", **{k: float(v) for k, v in dsr.items()}}
print(f"\nDSR of the 3-sleeve book: {dsr['dsr']:.3f} (Sharpe {dsr['sr_annual']:.2f} vs "
f"expected max of {n} unskilled trials {dsr['sr0_annual']:.2f})")
print("\nyearly returns (3 sleeves vs SPY):")