Algorithmic Trading Bot
Trend-following system for US equities. Paper trading only.
EMA(12/26) crossovers behind a 200-SMA filter, with ATR trailing stops. A risk manager sizes each position by the equity it puts at risk, halts on a daily-loss or drawdown limit, and persists the halt state so a restart does not clear it. A backtester runs the same strategy code the bot runs live over 5 years of daily bars and reports return, drawdown, Sharpe, and win rate.
Positions were being sized wrong across CAD and USD; async caching of FX rates from IBKR forex data fixed it. Signals are only evaluated between 3:50 and 4:00pm ET, so the bot never trades on an unfinished daily bar. IB Gateway runs headless (IBC, Xvfb) beside the bot in Docker Compose on DigitalOcean for 24/7 paper trading, and Telegram commands pause it, report P&L, and close positions. Tested with pytest.