Overview

This project is a stock price prediction application built using LSTM (Long Short-Term Memory) neural networks to predict stock prices based on historical data. It uses Yahoo Finance API to fetch data and displays 7-day forecasts with intuitive graph visualization.

Overview Screenshot

Project Structure


stock-predictor/
├── app/                # Flask app
│   ├── templates/
│   ├── static/
│   ├── main.py         # Flask routes
│   └── model.py        # LSTM logic
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
└── README.md
            

Docker Setup

The application is containerized using Docker to ensure consistent development and deployment. After cloning the repository, use the following commands to build and run the container:


            docker-compose build --no-cache
            docker-compose up
            

Once running, the app is accessible via http://127.0.0.1:5050. Below is an example of the terminal output after successfully running the application:

Docker Compose Output

Flask API Structure

The core backend logic is built using Flask. It defines two main routes:

The prediction results include:

Flask Route Code Example

main.py showing Flask route logic for receiving and returning predictions.

LSTM Prediction Model

The LSTM model is implemented in model.py using TensorFlow. It processes time-series stock price data and predicts the next 7 days.

LSTM Model Code Example

▲ Key portion of LSTM implementation and prediction logic in model.py.

Key Features

Feature Screenshot

How It Works

The application fetches stock data using yfinance and trains a TensorFlow LSTM model. After prediction, it generates a graph and returns results via a Flask API.

Prediction Graph Example

Running with Docker

  1. Clone the repo: git clone https://github.com/pkisung/stock-predictor
  2. Build image: docker-compose build --no-cache
  3. Run: docker-compose up -d
  4. Visit: http://127.0.0.1:5050/

Configuration Files

The following files configure how the environment is built and dependencies are managed:

Dockerfile

Dockerfile Sample

▲ Core Dockerfile commands used to containerize the app

docker-compose.yml

Docker Compose File

▲ Sample docker-compose configuration

requirements.txt

Requirements File

▲ Required packages for the application

More Details & Source Code

Explore the full codebase and documentation on GitHub:

📂 View on GitHub

🔙 Back to Portfolio