An ensemble Bitcoin price-direction predictor built with XGBoost + PyTorch LSTM, served via a Streamlit dashboard. Uses only free public APIs — no keys required.
cd btc_predictor
pip install -r requirements.txt
streamlit run app.pyApp opens at http://localhost:8501
- Live Signal tab — BUY / HOLD / SELL with confidence gauge, candlestick + EMA chart, RSI subplot
- Backtesting tab — 5-fold walk-forward accuracy table, cumulative PnL vs buy-and-hold
- Feature Explorer tab — Plot any indicator over price, XGBoost importance chart
| Source | Usage |
|---|---|
| Binance public REST | BTC/USDT daily + hourly OHLCV |
| CoinGecko | Market cap context |
| alternative.me | Fear & Greed Index |
final_prob = 0.6 × XGBoost_prob + 0.4 × LSTM_prob
confidence = |final_prob − 0.5| × 200 # 0% = max uncertainty, 100% = max certainty
- XGBoost: 300 trees, binary direction classifier on ~30 tabular features
- LSTM: 2-layer, hidden=128, 30-candle sliding window, early stopping
TimeSeriesSplitfor all train/test splitsMinMaxScalerfit only on training partition, applied to test- Target = next candle direction (shifted by -1 then dropped from latest row)
- Push to GitHub
- Go to share.streamlit.io
- Connect repo → set main file to
btc_predictor/app.py→ Deploy