Hugging Face Hub
Required. All ML model binaries (.pkl and .onnx) are stored on Hugging Face Hub. The trading bot pulls the latest models at startup.
Setup
- Create a free account at huggingface.co
- Create a new model repository (private)
- Generate an access token with
writepermission at Settings → Access Tokens - Add to your
.env:
Usage
.pkl and .onnx files from models/ plus the models/model_compat.json and models/risk_metadata.json metadata files.
What is stored
| File | Description |
|---|---|
rf_signal.pkl | Random Forest signal model (raw) |
rf_signal_calibrated.pkl | Calibrated RF signal model |
rf_signal.onnx | ONNX export of RF signal model |
xgb_signal.pkl, _calibrated.pkl, .onnx | XGBoost equivalents |
lgb_signal.pkl, _calibrated.pkl, .onnx | LightGBM signal equivalents |
position_*.pkl | Position model files |
sltp_*.pkl | SL/TP model files |
risk_*.pkl | Risk multiplier model files |
model_compat.json | Feature list hash + model paths — compatibility check |
risk_metadata.json | Risk model metadata: trained_at, val_mae, features |
Supabase
Optional. Supabase stores trade logs, open position snapshots, and bot status. The website dashboard reads from Supabase for trade history display.Setup
- Create a free project at supabase.com
- Run the schema migrations from
supabase/migrations/ - Add to your
.env:
Schema
Data integrity rules
Trade reconciliation
After every sync_fallback or estimation path,_reconcile_trade_bg(ticket, ...) fires in the background. It retries _get_deals_for_position() every 60 seconds for up to 4 hours, then overwrites Supabase with real broker deal data.
VT Markets can delay closing deal history by hours for manual (mobile) closes. The reconciliation loop handles this automatically.
Telegram
Optional but strongly recommended. Telegram sends trade alerts, weekly optimize reports, and error notifications.Setup
- Create a bot with @BotFather and copy the token
- Get your chat ID (send a message to your bot, then check
https://api.telegram.org/bot<token>/getUpdates) - Add to your
.env:
Notification types
| Event | Message type |
|---|---|
| Trade opened | BUY/SELL signal, lot, entry price, SL/TP, confidence |
| Trade closed | P&L, duration, exit reason (TP/SL/EXIT signal) |
| Weekly optimize — success | New score, improvement %, key config, pushed to HF |
| Weekly optimize — rollback | Old score retained, reason |
| Hard halt | Equity drawdown % that triggered halt |
| MT5 connection error | API URL, error code |
Telegram commands
The bot responds to commands sent from your chat:trading/telegram_commands.py.
Service dependency summary
| Service | Required | Without it |
|---|---|---|
| MT5 REST API | Yes | Bot cannot trade |
| Hugging Face Hub | Yes | Cannot load models |
| Supabase | No | No trade log, no website dashboard |
| Telegram | No | No alerts or reports |