Skip to content

Stock Price Prediction Using LSTM is an AI-powered tool built with Python, TensorFlow, and Streamlit. It lets users train LSTM models on real-time stock data and visualize predictions interactively.

License

Notifications You must be signed in to change notification settings

VisionExpo/Stock_price_prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

48 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ˆ Stock Price Prediction Using LSTM

Python TensorFlow Streamlit yfinance License Render GitHub

A powerful stock price prediction system built with LSTM neural networks, featuring real-time data from yfinance, interactive model training, and comprehensive performance metrics through a user-friendly Streamlit interface.

Stock Price Prediction Demo

โœจ Features

  • ๐Ÿ” Real-time Data: Fetches real-time stock data using yfinance
  • ๐Ÿ“ˆ Interactive Training: Fine-tune model parameters through an intuitive interface
  • ๐Ÿค– Advanced LSTM Architecture: Multi-layer LSTM with dropout for robust predictions
  • ๐Ÿ“Š Comprehensive Metrics: Track MSE, RMSE, MAE, and Rยฒ scores
  • ๐ŸŽฏ Future Predictions: Generate price predictions with confidence intervals
  • ๐Ÿ“‰ Performance Tracking: Monitor model performance over time
  • ๐Ÿ“ฑ Responsive UI: User-friendly interface built with Streamlit

๐Ÿš€ Tech Stack

Technology Purpose
Python Core language
TensorFlow Deep learning framework
Streamlit Web interface
yfinance Stock data source
Pandas Data manipulation
Matplotlib Data visualization
Scikit-learn Model evaluation
Docker Containerization
Render Cloud hosting

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 โ”‚     โ”‚                 โ”‚     โ”‚                 โ”‚
โ”‚  Web Interface  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Data Fetching  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Preprocessing  โ”‚
โ”‚   (Streamlit)   โ”‚     โ”‚   (yfinance)    โ”‚     โ”‚                 โ”‚
โ”‚                 โ”‚     โ”‚                 โ”‚     โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                        โ”‚
                                โ”‚                        โ–ผ
                                โ”‚             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                โ”‚             โ”‚                     โ”‚
                                โ”‚             โ”‚   LSTM Training     โ”‚
                                โ”‚             โ”‚                     โ”‚
                                โ”‚             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                        โ”‚
                                โ”‚                        โ–ผ
                                โ”‚             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                โ”‚             โ”‚                     โ”‚
                                โ”‚             โ”‚  Model Evaluation   โ”‚
                                โ”‚             โ”‚                     โ”‚
                                โ”‚             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ–ผ                        โ–ผ
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚                                             โ”‚
                      โ”‚              Price Prediction               โ”‚
                      โ”‚                                             โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง Installation

Prerequisites

  • Python 3.8 or higher
  • No API key required (yfinance is used)

Option 1: Using Setup Scripts (Recommended) ๐Ÿš€

  1. Clone the repository:
git clone https://github.com/VisionExpo/Stock_price_prediction.git
cd Stock_price_prediction
  1. Run the setup script:

For Windows:

setup_env.bat

For macOS/Linux:

chmod +x setup_env.sh
./setup_env.sh

This script will:

  • ๐Ÿ”จ Create a virtual environment
  • โšก Activate the virtual environment
  • ๐Ÿ“ฆ Install dependencies
  • ๐Ÿ”‘ Create a .env file from the example if it doesn't exist
  1. No API keys are required for this project

Option 2: Manual Setup ๐Ÿ› ๏ธ

  1. Clone the repository:
git clone https://github.com/VisionExpo/Stock_price_prediction.git
cd Stock_price_prediction
  1. Create and activate a virtual environment:

For Windows:

python -m venv venv
venv\Scripts\activate

For macOS/Linux:

python -m venv venv
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up your environment variables:
cp .env.example .env

No API keys are required for this project.

๐Ÿš€ Usage

Running the Application

streamlit run app.py

Then open http://localhost:8501 in your web browser.

๐Ÿ“Š Data Visualization Mode

View historical stock data with interactive charts:

  • Price trends
  • Volume analysis
  • Moving averages
  • Technical indicators

๐Ÿง  Model Training Mode

Train custom LSTM models with:

  • Adjustable look-back periods
  • Customizable layer architecture
  • Hyperparameter tuning
  • Early stopping options

๐Ÿ”ฎ Prediction Mode

Generate and visualize predictions:

  • Short-term forecasts
  • Long-term trends
  • Confidence intervals
  • Downloadable prediction data

๐Ÿ“ˆ Performance Analysis

Evaluate model performance with:

  • Error metrics (MSE, RMSE, MAE)
  • Rยฒ scores
  • Prediction vs. actual comparisons
  • Model version tracking

๐ŸŒ Deployment

This application can be deployed on Render. You can access it at: https://stock-price-prediction.onrender.com/

For detailed deployment instructions, see DEPLOYMENT.md.

๐Ÿงช Testing

To run tests:

python -m pytest tests/

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgements

  • TensorFlow team for the deep learning framework
  • Streamlit team for the web app framework
  • yfinance for providing stock data access
  • The open-source community for various libraries used in this project

๐Ÿ“ž Contact

For questions or feedback, please open an issue on GitHub or contact the maintainer at [email protected].

Made with โค๏ธ by Vishal Gorule

About

Stock Price Prediction Using LSTM is an AI-powered tool built with Python, TensorFlow, and Streamlit. It lets users train LSTM models on real-time stock data and visualize predictions interactively.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published