Skip to content

Umer-Fareed/Stock_Trading_Alert_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

📈 Stock Trading Alert System

A Python-based automated stock monitoring and news alert system that tracks stock price changes in real-time and sends email alerts with the latest related news articles whenever significant market movement occurs.


🚀 Features

  • 📊 Tracks daily stock prices using the Alpha Vantage API
  • 📉 Detects stock price increase/decrease percentage
  • 📰 Fetches latest company-related news using NewsAPI
  • 📧 Sends automated email alerts
  • 🔺🔻 Indicates stock movement direction with emojis
  • ⚡ Real-time monitoring workflow
  • 🐍 Built completely in Python

🛠️ Technologies Used

  • Python
  • Requests Library
  • SMTP (smtplib)
  • Alpha Vantage API
  • NewsAPI

📂 Project Structure

Stock_Trading_Alert_System/
│
├── main.py
├── README.md
└── requirements.txt

⚙️ How It Works

  1. Fetches daily stock market data from Alpha Vantage API

  2. Compares yesterday’s closing price with the previous day

  3. Calculates percentage change in stock price

  4. If the price movement exceeds the threshold:

    • Fetches latest related news articles
    • Formats the news headlines and descriptions
    • Sends email alerts automatically

📸 Workflow Overview

Stock API → Price Analysis → News Fetching → Email Alert

🔑 APIs Used

Alpha Vantage API

Used for fetching stock market data.

Website: https://www.alphavantage.co/


NewsAPI

Used for retrieving latest news articles related to the company.

Website: https://newsapi.org/


📦 Installation

Clone the Repository

git clone https://github.com/Umer-Fareed/Stock_Trading_Alert_System.git

Navigate to Project Folder

cd Stock_Trading_Alert_System

Install Dependencies

pip install requests

▶️ Usage

Run the Python script:

python main.py

🔧 Configuration

Update the following variables in the script:

STOCK_NAME = "TSLA"
COMPANY_NAME = "Tesla Inc"

STOCK_API_KEY = "YOUR_API_KEY"
NEWS_API_KEY = "YOUR_API_KEY"

my_email = "YOUR_EMAIL"
password = "YOUR_APP_PASSWORD"
send_mail = "RECEIVER_EMAIL"

📊 Example Alert

TSLA: 🔺5%

Headline: Tesla shares surge after strong quarterly results.

Brief: Tesla stock rose significantly following earnings report...

🔒 Security Note

⚠️ Do NOT expose your API keys or email credentials publicly.

It is recommended to use:

  • Environment Variables
  • .env files
  • App Passwords instead of your actual Gmail password

🌟 Future Improvements

  • SMS alerts using Twilio
  • Telegram/Discord notifications
  • Real-time stock dashboard
  • Multiple stock tracking
  • Database integration
  • Machine learning-based prediction
  • Web deployment using Flask or Django

🧠 Learning Outcomes

This project demonstrates:

  • API Integration
  • Data Processing
  • Automation using Python
  • Email Handling
  • Real-world financial application development

👨‍💻 Author

Developed by Umer Fareed

GitHub: https://github.com/Umer-Fareed


📄 License

This project is open-source and available under the MIT License.

About

# GitHub Repository Description A Python-based stock trading alert system that monitors stock price movements, fetches real-time financial news using APIs, and automatically sends email alerts when significant market changes occur.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages