AI-powered stock forecasting with walk-forward backtesting and Claude-generated plain-English explanations.
- Candlestick charts, fundamentals, and live news per ticker
- LightGBM regressor predicting next-day log returns (no target leakage)
- Walk-forward time-series cross-validation — real out-of-sample metrics
- Multi-step iterative forecast with proper lag-window shifting
- Confidence bands on forecast chart (±1σ from CV RMSE)
- Claude Sonnet explains the forecast in plain English: which signals support it, which work against it
- Long/flat strategy backtested vs buy-and-hold with transaction costs
- Full metrics: Sharpe, max drawdown, win rate, annualized return
- Dark AIBC theme — monospace, teal accent
Data (Tiingo primary / yfinance fallback)
└─► Feature engineering
RSI · SMA ratios · lag log-returns · cross-asset (SPY ratio, VXX ratio, log-spreads)
└─► LightGBM Regressor
Target: next-day log return ← no target leakage
Training: walk-forward TimeSeriesSplit (5 folds)
└─► Multi-step forecast (n days)
Iterative — lag window shifts each step
└─► Price reconstruction
last_price × exp(cumsum(predicted_log_returns))
└─► Claude Sonnet explanation
Reads features snapshot + forecast → 3-4 sentence plain-English summary
└─► Strategy backtest
Long when predicted_return > threshold · costs in bps per trade
Equity curve + metrics vs buy-and-hold
| Layer | Tech |
|---|---|
| UI | Streamlit |
| Model | LightGBM |
| Features | pandas, numpy |
| Data | Tiingo API / yfinance |
| Explanation | Claude Sonnet (Anthropic API) |
| Viz | Plotly |
| Tests | pytest |
git clone https://github.com/HeTron/market-edge.git
cd market-edge
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env — add ANTHROPIC_API_KEY and optionally TIINGO_API_KEY
streamlit run streamlit_app.pyOpen http://localhost:8501.
Tests:
pytest tests/| Variable | Required | Notes |
|---|---|---|
ANTHROPIC_API_KEY |
Yes (for Claude explanations) | Predict page degrades gracefully without it |
TIINGO_API_KEY |
No | Falls back to yfinance automatically |
This tool is for educational and research purposes only. It is not financial advice. Past model performance does not guarantee future results. Do not make investment decisions based on this output.