Honest Model Comparison
Walk-forward backtested a PyTorch LSTM against naive, linear, EWMA and HAR baselines across six stocks, with no look-ahead bias.
Time Series Forecasting · Full-Stack Development
A volatility forecasting app that predicts how far 15 major stocks and ETFs are likely to move over the next week. A walk-forward backtest compared a PyTorch LSTM with classical models, and the winning model updates daily through an automated pipeline.

The Project
Financial markets produce large amounts of time-series data, making historical stock prices a useful setting for exploring sequence-based machine learning models.
I originally built an application that used a Long Short-Term Memory (LSTM) neural network to predict the next day's stock price. To test whether it actually worked, I built a walk-forward backtest comparing it against simple baselines across six stocks.
The backtest showed the LSTM had no real edge on price direction, but that volatility, how much a stock moves rather than which way, was genuinely forecastable. A classical HAR model beat the LSTM at it on every stock, so I rebuilt the app around weekly volatility forecasts using that model.
The final app shows each stock's likely price range for the next five trading days and reports how often past forecast ranges actually held. It updates automatically every weekday after the market closes.
Key Contributions
Walk-forward backtested a PyTorch LSTM against naive, linear, EWMA and HAR baselines across six stocks, with no look-ahead bias.
A scheduled GitHub Actions workflow downloads prices, refits the model and publishes fresh forecasts every weekday.
Visualizes each stock's expected weekly range and checks how often real moves landed inside it.
Behind the Build
Time-series forecasting involves predicting future observations using information from earlier points in a sequence.
This project first explored whether a recurrent neural network could learn patterns from historical stock-price data and predict the next day's price, then tested that claim rigorously.
The goal was to build an end-to-end machine learning application rather than a production trading system, and to measure honestly what the model could and couldn't do.
The application uses historical stock-price data retrieved through the yfinance Python library.
Prices are converted to daily log returns, and each training example uses a window of the previous 60 trading days.
For volatility, the target is the realized volatility of the following five trading days, and the inputs summarize how much the stock moved over the past day, week and month.
All feature scaling uses statistics from the training period only, so no information from the future leaks into the model.
The original model is an LSTM implemented in PyTorch, which processes a sequence of past returns and outputs a forecast.
To evaluate it, I built a walk-forward backtest: each model is trained on all data up to a point, predicts the following year, then rolls forward and retrains. Results cover six stocks from 2015 onward.
For next-day price, nothing meaningfully beat the naive forecast that tomorrow's price equals today's. The LSTM called the direction correctly 52.6% of the time, while the stocks rose on 53.0% of days.
For next-week volatility, every model beat the naive forecast. The HAR model reduced error by 14–19% and outperformed the LSTM on all six stocks, so it powers the live app.
Instead of serving predictions from a live API, forecasts are precomputed once a day.
A GitHub Actions workflow runs every weekday after the US market close. It downloads fresh prices, refits the HAR model for 15 tickers, and recalculates forecast accuracy.
The results are written to a JSON file and committed to the repository, which triggers Vercel to redeploy the site.
This design keeps the site fast and free to host, and avoids the market-data rate limits that affect requests from cloud servers.
The frontend is built with Next.js and TypeScript.
For each ticker, it shows the expected price range for the next week and whether volatility is higher or lower than usual for that stock.
A chart compares past forecasts with the volatility that actually followed, allowing users to see how the model performed over the past year.
An accuracy section reports how often real weekly moves landed inside the forecast ranges. Across 15 tickers, the 68% range held 64–69% of the time.
The model forecasts how much a stock is likely to move, not which direction, and it doesn't account for scheduled events such as earnings announcements.
The 90% range holds slightly less often than it claims (85–91% of weeks) because real returns have more extreme days than a normal distribution assumes.
Potential future improvements include sizing ranges from historical forecast errors, adding implied volatility from options markets as an input, and covering more tickers.
This project is a machine learning demonstration and is not intended to provide investment advice or reliable trading signals.