Trading volume drives liquidity, execution quality, and volatility. If you're placing a large order, you need to know whether tomorrow will have 30 million shares traded or 80 million. The difference determines whether your order moves the market or not. Volume forecasting is a real problem in quantitative finance, and unlike price prediction, it's actually solvable.
A fully automated ML pipeline that predicts 30-day trading volume for 102 stocks in the S&P 100. Trains 4 models per ticker, picks the best one, and serves predictions through an interactive dashboard. The whole thing retrains daily after market close with zero manual intervention.
Daily stock prices are essentially a random walk and no model consistently outperforms simple baselines. Volume is different: it has strong weekly patterns (Mondays higher, Fridays lighter), mean-reverts after spikes, and correlates with observable signals like price moves and calendar events. XGBoost hits 3-7% MAPE on most tickers. You'd never get that on price.
31 features per ticker, all engineered from raw OHLCV data:
| Group | Features | Rationale |
|---|---|---|
| Volume trend | 5/10/20/50-day moving averages | Smooths noise, shows if volume is trending up or down |
| Autoregressive | Lag 1, 2, 3, 5, 10 days | Yesterday's volume is the single best predictor of today's |
| Normalized | Volume / 20-day MA, percent change | Lets the model compare across different volume scales |
| Price signals | Return, abs return, range, gap, volatility | Big price moves cause volume spikes |
| Calendar | Day-of-week (one-hot), month, month-end | Mondays spike, month-end sees rebalancing flows |
All models trained on 85% of data (~630 days), evaluated on the final 15% (~112 days). Strictly chronological split with no future data leaking into training.
| Model | Avg MAPE | Wins | Notes |
|---|---|---|---|
| XGBoost | 5.49% | 91/102 | Handles tabular features and nonlinear interactions |
| Linear Regression | 8.07% | 11/102 | Surprisingly strong. Good features beat fancy models |
| ARIMA | 28.90% | 0 | Only sees volume history, can't use price/calendar features |
| LSTM | 30.61% | 0 | Not enough data. Deep learning needs thousands of samples, not hundreds |
XGBoost with good feature engineering beats a neural network with the same features. This isn't surprising. At 700 rows of data, gradient boosting has enough signal and LSTM doesn't. The linear model winning 11 tickers proves the features themselves carry most of the predictive power.
Yahoo Finance → data pull → feature engineering (31 features)
→ train 4 models × 102 tickers → evaluate → pick best per ticker
→ generate 30-day predictions → serve via Dash dashboard
Runs daily via cron at 5:30pm ET. Dashboard reads pre-computed JSON files for instant page loads.