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.
- 📊 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
- Python
- Requests Library
- SMTP (smtplib)
- Alpha Vantage API
- NewsAPI
Stock_Trading_Alert_System/
│
├── main.py
├── README.md
└── requirements.txt-
Fetches daily stock market data from Alpha Vantage API
-
Compares yesterday’s closing price with the previous day
-
Calculates percentage change in stock price
-
If the price movement exceeds the threshold:
- Fetches latest related news articles
- Formats the news headlines and descriptions
- Sends email alerts automatically
Stock API → Price Analysis → News Fetching → Email Alert
Used for fetching stock market data.
Website: https://www.alphavantage.co/
Used for retrieving latest news articles related to the company.
Website: https://newsapi.org/
git clone https://github.com/Umer-Fareed/Stock_Trading_Alert_System.gitcd Stock_Trading_Alert_Systempip install requestsRun the Python script:
python main.pyUpdate 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"TSLA: 🔺5%
Headline: Tesla shares surge after strong quarterly results.
Brief: Tesla stock rose significantly following earnings report...
It is recommended to use:
- Environment Variables
.envfiles- App Passwords instead of your actual Gmail password
- 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
This project demonstrates:
- API Integration
- Data Processing
- Automation using Python
- Email Handling
- Real-world financial application development
Developed by Umer Fareed
GitHub: https://github.com/Umer-Fareed
This project is open-source and available under the MIT License.