DRIFT is two services that talk over REST and WebSockets. The engine is Python (FastAPI, port 8099). The cockpit is Next.js 15 with Tailwind. There is no database, no blockchain, no message queue. Every design decision traded sophistication for verifiability.
The engine (apps/trader)
bybit_client.py
A thin pybit V5 wrapper. Two modes: public (unauthenticated, always mainnet, used for klines and tickers) and authenticated (user keys, testnet or live, used for wallet balance, position size, and market orders). Keys are passed in and held in memory — never written to disk.
strategies/
A Strategy ABC with one abstract method: positions(df) returning a pd.Series of {-1, 0, 1}. Each concrete class is a pure function of historical OHLCV bars. No internal state, no lookahead. Four implementations ship today: MACD, RSI, Bollinger, DualThrust.
backtester.py
Vectorised. The signal on bar t is shifted +1 bar before multiplying by returns, so execution is always one bar later than the signal. This is the point-in-time constraint. Metrics computed: total return, annualised Sharpe (bars-per-year from a TIMEFRAMES map), win rate, max drawdown, trade count.
# The only line that matters in the backtester positions = strat.positions(df).shift(1).fillna(0)
optimize.py
Sweeps a configurable param grid across all strategies (max 240 combinations to stay under one second). Splits data 70/30. Selects the best config by in-sample Sharpe among configs with at least 2 trades — the guard prevents a no-trade config from winning by default. Reports out-of-sample metrics. Verdict: robust (both IS and OOS Sharpe >= 0.5), overfit (IS good, OOS < 40% of IS), or weak.
live.py
Connection holds one authenticated BybitClient in memory. BotManager creates one asyncio Task per bot. The loop: every 15 seconds, fetch 200 bars of klines, compute signal, compare to current position, place a market order if delta is not zero, read account equity, check drawdown stop. If breached, flatten the position and halt.
The cockpit (apps/web)
Five routes under /dashboard: Markets (live ticker list + candlestick, deploy-bot inline), Bots (per-bot candlestick with fill markers, WS-driven equity/PnL/drawdown, kill switch), Portfolio (account equity, positions table), Research (AutoResearch optimizer leaderboard), Connection (API key entry, read or trade scope).
The landing and dashboard share a dark theme ported from the neurus codebase: bg-black for the landing, bg-[#0b0c0f] for the dashboard, periwinkle #9aa8f0 accent throughout. No wallet, no blockchain — the cockpit is purely a REST and WebSocket client over the engine.