Skip to main content

Hugging Face Hub

Required for the Python bot. Not used by the Go binary. The Python bot stores all ML model binaries (.pkl and .onnx) on Hugging Face Hub and pulls the latest models at startup. The Go binary embeds all models at compile time and does not connect to Hugging Face Hub at runtime.

Setup

  1. Create a free account at huggingface.co
  2. Create a new model repository (private)
  3. Generate an access token with write permission at Settings → Access Tokens
  4. Add to your .env:

Usage

The push command uploads all .pkl and .onnx files from models/ plus the models/model_compat.json and models/risk_metadata.json metadata files.

What is stored


Supabase

Optional. Supabase stores trade logs, open position snapshots, and bot status. The website dashboard reads from Supabase for trade history display.

Setup

  1. Create a free project at supabase.com
  2. Run the schema migrations from supabase/migrations/
  3. Add to your .env:

Schema

Data integrity rules

For cent accounts, always store raw MT5 values — do not convert USC to USD before writing.
  • Store closing_deal.profit as-is (e.g. 230.0 USC, not 2.30 USD)
  • For price-based profit estimates: use _usd_to_raw(price_diff × lot × contract_size) which multiplies by 100 for cent accounts
  • entry_at timestamps: always strip microseconds → datetime.now(UTC).replace(microsecond=0).isoformat()

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. RoboForex 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

  1. Create a bot with @BotFather and copy the token
  2. Get your chat ID (send a message to your bot, then check https://api.telegram.org/bot<token>/getUpdates)
  3. Add to your .env:

Notification types

Telegram commands

The bot responds to commands sent from your chat:
Commands are handled by trading/telegram_commands.py.

Service dependency summary