Skip to content

⚠️ This LSTM-based stock prediction app is for educational use only. Do not use it for real investment decisions. I’m not liable for any financial losses. 📉 Note: “Predicted vs Original” plot is only visible when run locally, not on Streamlit Cloud.

Notifications You must be signed in to change notification settings

Avnish1447/Stock-Trend-Prediction

Repository files navigation

📈 Stock Trend Prediction App

Python Streamlit TensorFlow Alpha Vantage Deployed on Streamlit


📌 Overview

🔮 Stock Trend Prediction App is a Streamlit-powered web interface that utilizes a pre-trained LSTM model to forecast stock closing prices. It provides interactive data visualizations, moving average analysis, and future trend predictions based on historical time-series data fetched from Alpha Vantage.

🧠 The model (keras_model.h5) was trained using a Long Short-Term Memory (LSTM) architecture on historical stock data. The training pipeline is not included in this repository.

🎯 Built for ML learners, finance enthusiasts, and academic or personal portfolio projects.


⚙️ Features

  • 📊 Interactive Visualizations: Plot raw closing prices, 100-day and 200-day moving averages
  • 🧠 LSTM Predictions: Make predictions using a trained Long Short-Term Memory model
  • 🔄 Data Pipeline: Download, preprocess, scale, and inverse transform data on-the-fly
  • 🧮 Real-Time Analysis: View predictions and actual stock trends in real-time with visual overlays
  • 💡 Educational Focus: Designed for understanding deep learning in financial applications

🛠️ Tech Stack

Component Library / Tool
Web Interface Streamlit Streamlit
Deep Learning Model TensorFlow / Keras TensorFlow
Financial Data Alpha Vantage API Alpha Vantage
Visualization matplotlib Matplotlib
Data Processing pandas, NumPy Pandas NumPy
Scaling scikit-learn Scikit-learn

🗂️ Project Structure


stock-trend-prediction/
├── keras_model.h5          # Trained LSTM model
├── app.py                  # Streamlit application
├── README.md               # Project overview
├── requirements.txt        # Python dependencies
├── output_graphs/          # Prediction and training result visualizations
│   ├── 100 and 200.png
│   ├── 100.png
│   └── Predicted.png


🧭 Getting Started

To explore and experiment with stock trend forecasting using deep learning, clone this repo and follow the steps below.
Make sure you have Python 3.10+ installed.


🚀 How to Run

  1. Install the required packages

    pip install -r requirements.txt
    
    
  2. Place the trained model

    Ensure keras_model.h5 (trained LSTM model) is present in the root directory.

  3. Run the application

    streamlit run app.py
  4. Interact

    Open your browser and go to http://localhost:8501 to interact with the app.


📷 Output Visualizations


🔒 Disclaimer & Limitations

⚠️ This application is intended strictly for educational and demonstrative purposes.

The predictions made by this application are the result of a deep learning model trained on historical data and should not be used to make actual investment or trading decisions.

❗ Important Notes:

  • This project does not provide financial advice.
  • The developer and contributors are not licensed financial advisors.
  • No liability or responsibility will be accepted for any financial loss or damage incurred due to reliance on the outputs of this app.

⚠️ Limitations:

  • Model performance is limited by:

    • Quantity and quality of historical data
    • Latency or inaccuracies from third-party APIs (e.g., Alpha Vantage)
    • Lack of awareness of company fundamentals, breaking news, or macroeconomic indicators
    • Overfitting or underfitting during training
  • It does not account for:

    • Intraday volatility
    • Real-time data streams
    • Sudden market shifts or geopolitical risks
  • ⚙️ Alpha Vantage API Limitations:

    • Free tier usage is subject to rate limits (typically 5 requests per minute and 500 per day).
    • Repeated rapid queries may lead to temporary blocking of data access.

📘 Use Responsibly:

This project is intended to showcase:

  • Time series forecasting using LSTMs
  • Deployment using Streamlit
  • Real-world integration with APIs and visualizations

It is NOT designed for live trading, algorithmic execution, or portfolio management. Any usage beyond educational or research purposes is strongly discouraged.


🔐 Privacy & Security

If deployed publicly, this app:

  • Does not collect or store personal user data
  • Processes ticker inputs locally
  • Relies on publicly accessible data via the Alpha Vantage API

Always validate external API input sources and sanitize ticker symbols in production.


🤝 Contributing

Contributions are welcome! Please open an issue to discuss changes or improvements before submitting a pull request.

If you'd like to add features, improve model performance, or extend visualizations — feel free to fork and build upon it.


🙋 Author

Developed by @Avnish1447

GitHub  Email  LinkedIn


✨ Happy Learning & Responsible Forecasting 📉📈

About

⚠️ This LSTM-based stock prediction app is for educational use only. Do not use it for real investment decisions. I’m not liable for any financial losses. 📉 Note: “Predicted vs Original” plot is only visible when run locally, not on Streamlit Cloud.

Topics

Resources

Stars

Watchers

Forks