Entry points
These are the top-level entry points (not inscripts/):
scripts/
onboarding.py
First-time setup wizard. Run once.- Prompts for
.envcredentials - 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.steady_income (1), conservative (2), balanced (3), growth (4), aggressive (5).
retrain.py
Standalone retrain — always trains all 4 models together to prevent feature/risk mismatches.sweep.py
Unified config parameter sweep. Replaces the oldsweep_signal.py and sweep_pos_model.py.
--spread / --leverage.
optimize_loop.py
Iterative optimization loop — runs SHAP → tune → retrain → OOS in a loop, committing only when score improves by ≥ 2%.Feature dropping (
--drop-threshold) is disabled by default (0.0). Near-zero SHAP at train time does not mean a feature is useless — news and session features score near-zero during training but carry live signal at inference time. Do not enable dropping without careful review._PKL_FILES must include .onnx files alongside their .pkl counterparts. If ONNX files are omitted from the snapshot, rollback restores the pkl scaler but leaves a stale ONNX — the predictor then uses mismatched models silently.config_sync.py
Shared config authority helpers (imported by other scripts — not a standalone CLI). Validatesconfig.json and ml_config.json on startup and exposes sync_generated_configs().
notify.py
Send a manual Telegram notification.ml/hf_hub.py
Hugging Face Hub model management.Go binary scripts
These scripts are used when building the compiled Go binary. They are not needed for the Python bot.scripts/export_scalers.py
Exports fitted scikit-learnStandardScaler objects from .pkl to JSON for Go inference.
models/):
ensemble_scaler.jsonposition_scaler.jsonrisk_scaler.jsonsltp_scaler.json
scripts/export_onnx_regression.py
Converts LightGBM regression models (risk and SLTP) from their native.txt format to ONNX using onnxmltools.
models/):
risk_lgb.onnx— 7 featuressltp_sl_lgb.onnx— market features +signal_directionsltp_tp_lgb.onnx— same
onnxruntime after each export.
Ensemble and position ONNX files are exported automatically by the Python trainer. Only risk and SLTP need this script.
scripts/pack_embedded.sh
Copies model files and configs intointernal/embedded/ for Go’s //go:embed. Must be run before every go build.
models/*.onnx→internal/embedded/models/models/*_scaler.json,models/*_metadata.json→internal/embedded/models/ml_config.json,strategy_params.json→internal/embedded/license.json(if--license) →internal/embedded/license.json
cmd/licgen — license generator
A separate binary the owner builds to generate signedlicense.json files. Never ship licgen to customers.
Go binary — full build sequence
Aftermake train or python scripts/retrain.py: