Stock Trend Predictor
A PyTorch LSTM model that learns temporal patterns in stock price history and visualises trend predictions against real market data, built to understand how sequence models handle financial time-series, not to trade on.

The Build
LSTMs are theoretically well-suited to time-series prediction but in practice require careful handling of data preprocessing and sequence windowing to produce anything useful. The main learning here was normalisation: raw price data trained poorly. Percentage-change sequences with a rolling normalisation window produced stable, interpretable predictions that align with trend direction more often than a naive baseline, which is a modest but honest result for a first sequence modelling project.
Built using Python, PyTorch, Streamlit, Pandas, NumPy, Plotly, yfinance
Key Decisions & Outcomes
- LSTM built in pure PyTorch with percentage-change normalisation and rolling window sequences, as raw price data produced unstable gradients
- Pulls real-time data via yfinance so any ticker can be evaluated without a separate data pipeline
- Prediction vs. actual price overlaid on an interactive Plotly chart, making model error immediately visible, not hidden
- Built to learn sequence modelling on real data, and the limitations are documented honestly in the README
If you're curious, feel free to explore: