Skip to content

Sweep Runner ​

Parameter sweep tool, supporting two modes.

Pure Arithmetic Mode (arithmetic) ​

Runs only pure functions like classify_regime(), no LLM required, completes in seconds.

bash
uv run python -m scripts.sweep_runner --mode arithmetic \
  --param regime.trend_ma_spread_pct \
  --range 2.0,8.0,0.5 \
  --train-start 2018-01-01 --train-end 2023-12-31 \
  --assets NDQ.AX,GC=F \
  --ground-truth docs/wiki/sweep_ground_truth/regime_events.yaml

Mandatory: The --ground-truth file must be provided (git timestamp validation prevents post-hoc event addition).

P&L Mode (pnl) ​

Runs walk-forward paper trading, requires an LLM. Each trial performs a sanity check and outlier marking.

bash
uv run python -m scripts.sweep_runner --mode pnl \
  --param reward.weight_max_drawdown \
  --range -1.0,-0.1,0.1 \
  --train-start 2024-05-13 --train-end 2024-11-15 \
  --assets NDQ.AX,GC=F

Parameter Format ​

--param uses the section.key format, corresponding to fields in core/config/tunable.py:

  • regime.trend_ma_spread_pct
  • regime.crash_atr_pct_min
  • verdict.buy_confidence_overdrive
  • reward.weight_max_drawdown
  • oracle_accuracy.buy_positive

Range Format ​

--range start,end,step (e.g., 2.0,8.0,0.5 generates 2.0, 2.5, 3.0, ..., 8.0)

Sanity Check (P&L Mode) ​

After each trial, an automatic check is performed:

  • UNCLEAR rate > 30% → outlier
  • Single verdict proportion > 90% → outlier (verdict collapse)
  • Annualized return deviation from median > 3x MAD → outlier

Outliers are rerun once; if still an outlier, they are excluded from the summary.