TradeBot Companion
LiveTrading platform combining automation, market data, and AI-assisted decision support.
- Role
- Solo build (backend, ML, dashboard, AI companion)
- Timeframe
- May 2026 to present
Objective
Paper-trade crypto on Luno (ZAR) with two cooperating strategies: a volatility bot and an ML trader. Give myself a single real-time cockpit to monitor, journal, and coach every decision the system makes.
Outcome
A live, auto-refreshing cockpit running both strategies against a R10,000 paper account, with an ML model trained on engineered features, hard risk/budget guards, a glass-box ML tab that exposes every step from raw candles to the final vote, and an AI companion that answers plain-English questions over live trade data. Proves end-to-end ownership: data pipeline → ML → execution logic → real-time UI → conversational layer.
A look inside
How it works
Real-time multi-bot cockpit
Auto-refreshing dashboard with a heartbeat monitor, combined order/fill activity feed, live log console, and a human-readable decision journal. Built to spot stalls early and explain why the bot did (or did not) act.
ML trader on engineered features
A RandomForestClassifier (currently 300 trees, trained on 3,444 bars of 15 engineered features — ATR, MACD, Bollinger width, RSI, multi-window returns) predicts direction per candle. Accuracy / precision / recall are tracked across training runs, straight from the live pickle.
Glass-box ML — a tab that explains the model
A dedicated ML Model tab walks the whole decision pipeline: a live confidence gauge against the 60% vote threshold, all 300 tree votes drawn as squares, an interactive tree explorer that highlights the exact path the current candle takes to a leaf, plain-English feature explainers, and a confusion matrix + ROC curve on held-out data — the modest edge reported honestly.
One-click retrain pipeline
A single button chains dataset build → training → hot-reload, streaming script output into the live log console. Tree count, depth, and test split are tunable from the operator-gated Control Room, and every panel re-reads the new pickle when it lands.
Volatility strategy with hard guards
TP/SL brackets per position, a risk guard enforcing daily budget and exposure limits, and live open-position tracking with unrealized PnL.
AI companion chat
A conversational layer that answers natural-language questions over live trade data ("how are we doing?", "is the model okay?", "what are we holding?") plus a coach mode that summarises the session.
Live exchange + paper account
Pulls live balances and the order/fill timeline from the Luno API, tracks the paper account's journey from a R10,000 start, and renders OHLCV price charts and cumulative PnL history.
What it is
TradeBot Companion is a local trading cockpit I built to run two cooperating crypto strategies against a paper account and watch them in real time. The point wasn’t a single clever model. It was owning the whole loop: pulling market data, engineering features, training and serving an ML classifier, executing against risk/budget guards, and surfacing all of it in a dashboard I can actually reason about (and talk to).
How it works
- Data + features. Market candles (OHLCV) are stored locally in SQLite per symbol/timeframe and turned into 15 engineered features — moving averages and their crossover, volatility, ATR, MACD histogram, RSI, Bollinger width, multi-window returns, and even API-latency signals as a data-quality guard.
- ML trader. A
RandomForestClassifier(currently 300 trees trained on 3,444 bars) predicts trade direction per candle; a long is only taken when the forest’s vote share clears a 60% confidence threshold. The dashboard tracks accuracy, precision/recall, and feature importance from the live pickle, with per-symbol realized PnL. - Volatility bot. A rules strategy that opens positions with explicit TP/SL brackets, gated by a risk guard that enforces a daily budget and exposure caps.
- Execution. Orders/fills run through the Luno exchange API in a paper account that starts at R10,000; the cockpit tracks the account’s journey, spend, and realized/unrealized PnL.
- Companion. A conversational layer answers plain-English questions over the live data and produces a coach-style session summary.
Inside the model
The newest part of the cockpit is a dedicated ML Model tab that turns the classifier from a black box into something you can actually inspect:
- The decision pipeline, drawn. A schematic walks the exact route a signal takes: OHLCV candles → 15 features → 300 trees → majority vote → confidence threshold → go long / skip. Everything on the page is read live from the trained model file, not hard-coded.
- Live decision. The latest candle runs through the forest on demand: a confidence gauge against the 60% threshold, every tree’s vote rendered as a square (e.g. 14 long / 286 short → SKIP), matching what the trader logged for the same bar.
- Tree explorer. Pick any of the 300 trees, expand its depth, and the SVG
highlights the path the current candle takes to a leaf — with each split
(
bb_width ≤ 0.0083 → LEFT, …) logged step by step underneath. - Plain-English features. Each of the 15 features gets a one-line
explanation and an importance bar from the live pickle, so
atr_pctat 12.3% means something to a reader who has never opened the code. - Honest evaluation. A confusion matrix and ROC curve (AUC 0.572) on the held-out test split, captioned for what it is: a modest edge, reported honestly on unseen data.
- One-click retrain. A single button chains dataset build → training → refresh, streaming script output into the live log console; forest size, depth, and test split are tunable from the operator-gated Control Room.
Why it matters
It’s a compact demonstration of the full data-to-decision pipeline I care about: applied ML on engineered time-series features, model interpretability that holds up to scrutiny (tree paths, confusion matrices, honest AUC — not just an accuracy number), real-time systems design, robust guardrails around automated money decisions, and an interface (visual and conversational) that makes the system legible.
Next: a self-contained replay demo of the cockpit (canned data, no live infra) so this case study becomes interactive right here on the site.