DeepStock is a deep learning framework for stock price prediction and forecasting using LSTMs and feature engineering.
It supports training, evaluation, and visualization of model performance with residuals, loss curves, and volatility indicators.
-
Preprocessing with MinMaxScaler and rolling features (MA10, MA20, MA50, returns).
-
Sequence generation for supervised learning on time series.
-
LSTM-based forecasting with:
- Model checkpointing
- Early stopping & learning rate scheduling
-
Evaluation metrics:
- MAE, RMSE, Rยฒ, MAPE
- Directional Accuracy (%)
- Bias correction
-
Visualizations:
- Actual vs. Predicted prices with forecasts
- Residuals (Actual โ Predicted)
- Smoothed training/validation loss curves
- Volatility indicators (rolling std & Bollinger Band width)
deepstock/
โ
โโโ data/ # input stock data (CSV or yfinance)
โ
โโโ checkpoints/ # saved models (.keras)
โ
โโโ results/ # predictions, plots, forecasts
โ โโโ predictions.csv
โ โโโ future_predictions_60d.csv
โ โโโ future_predictions_*_6m.csv
โ โโโ plots/
โ
โโโ images/ # example plots & animations
โ โโโ example1.png
โ โโโ example2.gif
โ
โโโ prediction.py # main training + forecasting loop
โโโ requirements.txt # dependencies
โโโ README.md # project docs
Clone the repo:
git clone https://github.com/blkpvnthr/deepstock.git
cd deepstock
Create a virtual environment:
macOS/Linux
python -m venv .venv
source .venv/bin/activate
Windows
.venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
- Run training + forecasting
python prediction.py
This will:
- Train or load an existing model per ticker.
- Save checkpoints to checkpoints/.
- Generate predictions and forecasts (60-day & 6-month).
- Save plots into results/plots/.
Actual + Predictions + Forecasts Residuals & Loss Curves Volatility Indicators
CGNX Evaluation Metrics:
MAE : 0.0621
RMSE : 0.0717
Rยฒ : -1.1457
MAPE : 48.67%
Directional Accuracy: 46.81%
Bias Correction: +1.235
Python 3.10+ pandas numpy scikit-learn matplotlib tensorflow / keras
Install them with:
pip install -r requirements.txt
Add hyperparameter tuning
Integrate additional technical indicators
Support transformer-based time-series models
MIT License. Feel free to fork and adapt for your own trading experiments ๐
Inspired by real-world quantitative finance research and experimentation with deep learning on market data.