Skip to main content
scripts/compare_configs.py runs backtest_config.py twice — once with each config pair — and prints a side-by-side table. Use it to evaluate any config change before applying it.

Usage

# Compare current config vs a saved old config
python scripts/compare_configs.py \
  --old-config config_old.json \
  --old-ml ml_config_old.json

# Compare two explicit config pairs with labels
python scripts/compare_configs.py \
  --old-config config_a.json --old-ml ml_config_a.json \
  --new-config config_b.json --new-ml ml_config_b.json \
  --old-label "exit=0.55 (old)" \
  --new-label "exit=0.80 (new)"

# Different backtest params
python scripts/compare_configs.py \
  --old-config config_old.json --old-ml ml_config_old.json \
  --balance 1000 --spread 3.0

CLI flags

FlagDefaultDescription
--old-configrequiredPath to the “before” config.json
--old-mlrequiredPath to the “before” ml_config.json
--new-configconfig.jsonPath to the “after” config (defaults to current)
--new-mlml_config.jsonPath to the “after” ml config (defaults to current)
--old-label"old"Display label for the old config
--new-label"new"Display label for the new config
--balance500Backtest starting balance ($)
--leverage500Leverage
--spread16.95Spread in $ round-turn

Sample output

Config comparison: exit=0.55 (old)  vs  exit=0.80 (new)
============================================================
Metric          exit=0.55 (old)    exit=0.80 (new)    Delta
---------       ---------------    ---------------    -----
Win rate        76.4%              78.5%              +2.1pp
Profit factor   1.94               2.43               +25.3%
Max drawdown    3.1%               1.8%               -1.3pp
Sharpe          22.14              32.99              +49.0%
Score           14.26              21.34              +49.6%
Total trades    48                 47                 -1
ML_Exit count   12                 1                  -11

Typical workflow

  1. Save the current config before making changes: cp config.json config_backup.json && cp ml_config.json ml_config_backup.json
  2. Apply the new parameters
  3. Run compare_configs.py to see the impact
  4. Keep or revert based on Score delta