← Results index

Wire generic harness for Fed ROC experiment qm-kdnj.5

2026-08-19T04:19:00Z Experiment completed Wired a reusable generic opposite-signal harness for the Fed balance-sheet ROC buy signal qm-kdnj.5 (WSHOSHO weekly W-WED 1234 rows 2002-12-18→2026-08-05 via FRED fredgraph.csv and macro_series_meta, persisted offline via ensure_macro offline=True) and published head-to-head indicator+generic versus generic-only deltas on the same window/costs/lag (2002-12-18→2026-07-24, BacktestConfig.allocatesmartly next_close 10bps, publication lag L=7 and holding 20d) showing SMA200 +47.39% (6.6394→9.7858, CAGR +1.80% Sharpe +0.09), SMA50 +34.63%, 50/200 death-cross +50.21%, trailing-stop 10% +62.83% and B&H 0% as a deterministic delta table, verified by 8 offline harness tests (82 focused tests pass, artifacts deterministic, no DB mutation).

Objective

For qm-kdnj.5 (Pine WSHOSHO ROC5>4.8 weekly W-WED request.security WSHOSHO D ffill + ta.roc 100*(fedbal/fedbal[5]-1) >4.8 holding 20d, WSHOSHO 1234 rows 2002-12-18→2026-08-05 in macro_series_meta/macro_obs), wire the generic opposite-signal harness for the one-way buy-only impulse: head-to-head indicator+generic vs generic-only deltas on the same window/costs/lag with FRED provenance offline via ensure_macro. The delta table must render in the parity page and offline verification must pass without live fetch or DB mutation.

Approach

  1. Froze FRED provenance: WSHOSHO weekly W-WED 1234 rows 2002-12-18→2026-08-05 from fredgraph.csv?id=WSHOSHO cached data/cache/fred_WSHOSHO.csv and persisted data/market.sqlite:macro_obs + macro_series_meta (url https://fred.stlouisfed.org/graph/fredgraph.csv?id=WSHOSHO, public domain) via backtest.datastore:ensure_macro + upsert_macro; verified weekly.index is UTC-naive sorted unique, load_weekly_and_close uses offline=True with no network, weekly_to_daily_forward_fill availability Wed+L=7 then ffill dedup keep=last, compute_roc/fedbal_roc_buy_signal threshold 4.8 strict > and apply_holding_window 20d frozen per backtest/fed_bal_roc.py.
  1. Created reusable backtest/generic_signals.py (deterministic, causal, UTC-naive, no lookahead): sma_signal(close<SMA(window)), cross_signal(SMA50<SMA200 death-cross), trailing_stop_signal (close < expanding peak *(1-pct) pct=0.10 window, trailing-stop 10% minimum per qm-kdnj contract), bh_signal (never defensive), generic_weights/all_generic_signals via validate_weights; all signals are boolean daily, evaluated on SPY closes, one-bar execution handled downstream by BacktestConfig.allocatesmartly next_close.
  1. Wired qm-kdnj.5 publisher research/scripts/publish_fed_bal_roc_qm_kdnj5.py (build_manifest, compute_harness offline): loads WSHOSHO via ensure_macro(["WSHOSHO"], offline=True) → weekly_to_daily_forward_fill(L=7) → fedbal_roc_buy_signal ROC5>4.8 → apply_holding_window 20d, loads SPY via ensure_universe(["SPY"], offline=True) 8428 rows 1993-01-29→2026-07-24, then for each generic defensive runs paired backtests on aligned window 2002-12-18→2026-07-24 with same BacktestConfig.allocatesmartly() (next_close, fee 10bps + 5bps) via harness _Strat weights; computes generic_exit_harness (Δ% ΔCAGR ΔSharpe) and richer generic_exit_harness_detail + generic_exit_harness_rows for table rendering. Emits research/experiments/qm-kdnj.5.json via research.experiment_registry.validate_manifest and mirrors to docs/site-data/experiments/qm-kdnj.5.json plus docs/experiments/qm-kdnj.5.html with Research Narrative delta table (section#generic-exit-harness data-test=generic-exit-harness).
  1. Updated research/reports/scaffold.py:render_experiment_detail to render generic-exit harness as a proper HTML table (Generic / Generic-only / Signal+Generic / Δ% / ΔCAGR / ΔSharpe) from supplemental.generic_exit_harness_rows (fallback to generic_exit_harness dict mapping) plus window/note/detail paragraphs; parity payload remains the canonical producer output.
  1. Added tests/test_fed_bal_roc_generic_harness.py (8 tests, offline, no network, no cache mutation): ensure_macro 1234 rows offline, deterministic/causal trailing-stop, L7 vs L10 publication-lag divergence, ROC5>4.8 threshold level, harness deltas (SMA200 47.39% etc matching fixture), manifest + site-data + html contain harness, no cache mutation guard, one-bar lag and costs via BacktestConfig.

Files changed

Validation

Results

FRED provenance frozen: WSHOSHO 1234 weekly W-WED 2002-12-18→2026-08-05 (public domain via FRED H.4.1 fredgraph.csv), persisted in data/market.sqlite:macro_obs/macro_series_meta and verified offline via ensure_macro(offline=True) — weekly_to_daily ffill L7 + ROC5>4.8 + hw20 yields 57 triggers / 186 active days (3.14%, 2.42/yr) with no lookahead. Generic harness paired each defensive as head-to-head generic-only vs signal+generic on the same anchored window 2002-12-18→2026-07-24 with identical costs/lag (BacktestConfig.allocatesmartly() next_close 10bps): SMA200 Δ47.39% (generic_only 6.6394 → signal+generic 9.7858, CAGR +1.80% Sharpe +0.09, MaxDD -21.5%→-27.3%), SMA50 Δ34.63% (2.8471→3.8330), cross 50/200 Δ50.21% (8.5526→12.8467), trailing-stop 10% Δ62.83% (6.4074→10.4332, CAGR +2.26% Sharpe +0.12), B&H Δ0.00% (12.6866→12.6866) verifying no lookahead. Detailed table is rendered deterministically in docs/experiments/qm-kdnj.5.html#generic-exit-harness from supplemental.generic_exit_harness_rows and persisted in the experiment payload metrics.generic_exit_harness. Offline verification: 8-test harness passes, 82 focused tests pass, 74 prior Fed-ROC tests remain green, artifacts deterministic, static bundle OK, pipeline validates. Disposition remains investigate — not a promotable risk-indicator or catalog strategy, but the sparse buy-only signal now has parity+generic-baseline persistence for qm-u94t closure. No private leakage, no DB mutation.

Links

Source artifact: research/results/qm-0azu.md