From experiments to one system
It started as four separate scripts: an XGBoost trend classifier, an LSTM, a test bot and a backtester. I consolidated them into one codebase with a model registry, so the live runner always loads a model together with the features and scaler it was trained with.
Strategy
- Core sleeve (70%): weekly scores for 10 ETFs from momentum, macro alignment and trend, holding the top 4, with a risk-off switch to bonds.
- Sentiment sleeve (20%): long positions on strong bullish news spikes from the Alpha Vantage sentiment API, with a time exit and a stop.
- Tactical models: technical indicators as features, XGBoost (class weights or SMOTE) and a 2-layer LSTM, fused 70/30 with sentiment and sized by volatility targeting.
Safety first
The bot refuses to start unless it is pointed at a paper account, runs as a dry run by default, and keeps every decision and order in SQLite for the FastAPI and HTMX dashboard.