Haskell Consulting
Philemon

Pythia

demo

Forecasts daily trading volume for a market making desk, so staffing and capacity get sized ahead of demand instead of guessed at.

View source on GitHub

Seasonal naive and ETS baseline, Prophet, and XGBoost on lag and calendar features, validated with walk forward folds and a six month holdout. ETS shipped: XGBoost wins short horizon validation, then drifts on the holdout because it forecasts recursively and compounds its own error.

Prediction intervals come from 1,000 bootstrap simulated paths through the fitted model, not a fixed padding. FastAPI serves /forecast, containerized with Docker, built and run end to end. The demo above is a static render of the shipped model's output, not a live backend call.

pythia.demo/forecast
loading demo…

Results

Four models compared two ways: walk forward validation inside the training window, and a single untouched six month holdout that includes the August 2024 volume spike. The ranking flips between the two, which is the actual finding.

25.9%
Holdout MAPE, ETS, the model that shipped
60.7%
Holdout MAPE, XGBoost, best short horizon, worst at 6 months
1,000
Bootstrap simulations per forecast, for real prediction intervals
752
Trading days of SPY volume, 2022 to 2024
ModelHoldout RMSEHoldout MAEHoldout MAPE
Seasonal naive (baseline)23,298,64517,390,91034.66%
Prophet22,748,81716,866,13133.51%
XGBoost, lag and calendar features31,330,59925,482,66060.71%
ETS (deployed)18,431,84312,789,91925.94%

XGBoost wins every metric on walk forward validation (23.91% MAPE, best of all four), then becomes the worst model on the holdout. It forecasts recursively, feeding each day's prediction back in as the next day's lag feature, so small early errors compound over a six month horizon. ETS and Prophet extrapolate an explicit trend instead of re-deriving the future from their own output, so they hold up better at the horizon a capacity planning tool actually needs.

Actual versus ETS and XGBoost predicted volume over the full six month holdout
Six month holdout: ETS tracks actual volume. XGBoost climbs away from it by autumn as its own predictions feed back into its features.
MSTL decomposition of SPY volume into trend and yearly seasonality
Mean daily volume fell from 94.8M shares in 2022 to 57.4M in 2024, tracking the market's shift from a high volatility regime to a calmer one.
Volume by day of week and options expiration Friday comparison
Monday is the lowest volume day, Friday the highest. Monthly options expiration Fridays run about 19% above regular Fridays, a mechanical, calendar predictable effect.
Zoomed view of November to December 2024 showing XGBoost drift versus ETS tracking actual volume
Zoomed to Nov to Dec 2024: XGBoost's mean absolute error grows from 8.6M shares a day in July to 31.6M by December, isolated here from the rest of the series.