Author: Grafton Cook
Contact: grafton.cook@gmail.com
This repository contains a multi-part time series forecasting project focused on predicting stock prices for a financial institution. You will see both classical and deep learning modeling approaches, as well as a final hybrid model that combines the best of both worlds. Specifically, the project is divided into four sub-projects:
- Decompose and examine the time series (trend, seasonality, stationarity).
- Perform ACF, PACF, and ADF tests.
- Apply classical forecasting models (Moving Average, Exponential Smoothing, AR, ARIMA).
- Compare results using RMSE and data visualizations.
- Prepare data for deep learning.
- Implement RNN/LSTM models for time series forecasting.
- Compare performance against classical methods.
- Combine classical and deep learning approaches.
- Evaluate performance on real-world stock data.
stock-price-prediction/
├── 01-time-series-components/
│ ├── data/
│ ├── notebooks/
│ │ ├── EDA.ipynb
│ │ └── stationarity_tests.ipynb
│ └── scripts/
├── 02-traditional-analysis/
│ ├── data/
│ ├── notebooks/
│ │ ├── traditional_analysis.ipynb
│ └── scripts/
├── 03-deep-learning/ **(TBD)**
│ ├── data/
│ ├── notebooks/
│ └── scripts/
├── 04-hybrid-model/ **(TBD)**
│ ├── data/
│ ├── notebooks/
│ └── scripts/
├── requirements.txt
└── README.md
part-x/
: Each sub-project directory with its own notebooks, data, and scripts.
environment.yml
or requirements.txt
: Conda or pip environment details.
git clone https://github.com/tacotuesday/time-series-stock-forecasting.git
cd time-series-stock-forecasting
Using Conda:
conda create --name stock-forecasting-env --file requirements.txt
conda activate stock-forecasting-env
Or using Pip:
pip install -r requirements.txt
Ensure Jupyter is installed and launch notebooks:
jupyter notebook
Navigate to the relevant sub-project under part-x/notebooks
.
- Data: Sample stock price data is located in each data/ folder (or instructions to download from a public source).
- Model Training: Run the notebooks in chronological order to see how the time series is analyzed and modeled.
- Hyperparameter Tuning: Some notebooks contain sections for adjusting hyperparameters (e.g., ARIMA
p/d/q
, LSTM architecture).
- Comparisons: We compare RMSE, MSE, and/or MAE across different models.
- Visualizations: Time series plots, predicted vs. actual, residual analysis.
- Insights: The best-performing model (in this dataset) is typically the hybrid approach, though performance may vary depending on the data.
- Enhance the hybrid model by experimenting with other neural network architectures (e.g., Transformers).
- Add real-time inference or streaming pipelines for updated price data.
- Extend the code to additional financial instruments (crypto, bonds, etc.).
License: MIT License.
Acknowledgments: This project is part of a Manning LiveProject. Datasets from Alpha Vantage.