Entry points
These are the top-level entry points (not in scripts/):
| Script | Purpose |
|---|
trading.py | Start the live trading bot |
backtest.py | Run a backtest |
train_ml_model.py | Train one or more models |
# trading.py
python trading.py # live
python trading.py --dry # dry run β no real orders
# backtest.py
python backtest.py --balance 500 --no-swap --leverage 500 --spread 16.95 --oos-only --no-chart
# train_ml_model.py
python train_ml_model.py --ensemble --position --sltp --risk
python train_ml_model.py --ensemble --shap --refresh
python train_ml_model.py --risk # retrain risk only
scripts/
onboarding.py
First-time setup wizard. Run once.
python scripts/onboarding.py --balance 500
- Prompts for
.env credentials
- Pulls latest models from HF Hub
- Runs risk questionnaire (6 questions β profile 1β5)
- Runs first weekly optimize
weekly_optimize.py
Autonomous 13-phase weekly pipeline.
python scripts/weekly_optimize.py # full + questionnaire
python scripts/weekly_optimize.py --profile balanced # skip questionnaire
python scripts/weekly_optimize.py --profile 3 # by profile number
python scripts/weekly_optimize.py --skip-retrain # sweep only (~45 min)
python scripts/weekly_optimize.py --from-phase 5 # resume after crash
python scripts/weekly_optimize.py --dry-run # show plan, don't run
Profiles: steady_income (1), conservative (2), balanced (3), growth (4), aggressive (5).
retrain.py
Standalone retrain with optional steps.
python scripts/retrain.py --all # all 4 models
python scripts/retrain.py --signal # signal ensemble only
python scripts/retrain.py --signal --shap # with SHAP analysis
python scripts/retrain.py --refresh # refresh dataset first
sweep.py
Config parameter sweep scoped to a risk profile.
python scripts/sweep.py --profile 3 # balanced
python scripts/sweep.py --profile 4 --oos-only # OOS sweep
python scripts/sweep.py --profile 3 --dry-run # show grid
python scripts/sweep.py --profile 3 --output results/ # save CSV
The sweep tests combinations of confidence_threshold, risk_percent, sl_multiplier, tp_multiplier. Results are ranked by the composite score.
sweep_signal.py
Signal-focused sweep β tests confidence thresholds and session filters.
python scripts/sweep_signal.py
python scripts/sweep_signal.py --oos-only --save
sweep_pos_model.py
Position model parameter sweep.
python scripts/sweep_pos_model.py
python scripts/sweep_pos_model.py --threshold 0.6
optimize_loop.py
Continuous optimization loop β runs SHAP β tune β retrain β OOS in a loop until a target score is reached or max iterations is hit.
python scripts/optimize_loop.py --target 20 --max-iter 5
python scripts/optimize_loop.py --profile 3 --target 15
_PKL_FILES in optimize_loop.py must include .onnx files alongside .pkl files. If only .pkl is listed, the revert step restores wrong inference files (the ONNX models keep the old version).
Detects performance regression against a baseline.
python scripts/performance_monitor.py # compare vs stored baseline
python scripts/performance_monitor.py --baseline 20.0 # custom baseline score
python scripts/performance_monitor.py --alert-telegram # send alert if regression
dashboard.py
Live terminal dashboard showing current position, equity, todayβs P&L, and recent trade log.
python scripts/dashboard.py
python scripts/dashboard.py --refresh 10 # refresh every 10 seconds
compare_configs.py
Diff two config.json files and show what changed.
python scripts/compare_configs.py config.json results/config_best.json
config_sync.py
Sync the current config.json to another machine over SSH.
python scripts/config_sync.py --host trading-vm --user ubuntu
notify.py
Send a manual Telegram notification.
python scripts/notify.py "deploy complete β bot restarted"
python scripts/notify.py --level error "MT5 connection failed"
run_agent.sh
Launch a Claude Code agent for multi-step tasks.
TASK="run backtest and report OOS score" ./scripts/run_agent.sh
TASK="sweep confidence threshold 0.55-0.70 and apply best" ./scripts/run_agent.sh
Use the TASK= variable form. Avoid multiline shell continuations for the TASK assignment.
ml/hf_hub.py
Hugging Face Hub model management.
python ml/hf_hub.py --pull # download latest
python ml/hf_hub.py --push # upload after retrain
python ml/hf_hub.py --push --tag phase-16 # push with version tag
python ml/hf_hub.py --list # show available revisions