https://github.com/mostafahima/smart-stock-tracker
An interactive tool using APIs to fetch stock data and prices, display the latest news, and send a detailed report via email using SMTP.
https://github.com/mostafahima/smart-stock-tracker
api requests-library-python smtplib tracker
Last synced: 3 months ago
JSON representation
An interactive tool using APIs to fetch stock data and prices, display the latest news, and send a detailed report via email using SMTP.
- Host: GitHub
- URL: https://github.com/mostafahima/smart-stock-tracker
- Owner: MostafaHima
- Created: 2024-12-15T21:06:11.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-12-15T21:16:32.000Z (5 months ago)
- Last Synced: 2024-12-28T16:50:00.316Z (5 months ago)
- Topics: api, requests-library-python, smtplib, tracker
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Smart Stock Tracker
## Description
An interactive tool using APIs to fetch stock data and prices, display the latest news about the stock, and send a detailed report via email using SMTP.---
## Features
- **Fetch Stock Data**: Retrieves real-time stock data including opening, closing, high, and low prices using the Alpha Vantage API.
- **Get News Articles**: Fetches the latest news articles related to the stock from NewsAPI.
- **Email Reports**: Sends a comprehensive email report with stock data and news insights using SMTP.---
## Requirements
- Python 3.9 or higher
- API keys for:
- [Alpha Vantage](https://www.alphavantage.co/)
- [NewsAPI](https://newsapi.org/)
- SMTP email service credentials---
## Installation
1. Clone this repository:
```bash
git clone https://github.com/MostafaHima/Smart-Stock-Tracker.git
```
2. Navigate to the project directory:
```bash
cd Smart Stock Tracker
```
3. Install the required dependencies:
```bash
pip install -r requirements.txt
```---
## Usage
1. Set up your environment variables for API keys and SMTP credentials:
- `ALPHAVANTAGE_API_KEY`: Your Alpha Vantage API key
- `NEWSAPI_API_KEY`: Your NewsAPI key
- `SMTP_EMAIL`: Your email address
- `SMTP_PASSWORD`: Your email password2. Run the main script:
```bash
python main.py
```
3. Enter the stock name when prompted, and the tool will handle the rest!---
## File Structure
- **get_stock_data.py**: Handles fetching stock data from Alpha Vantage.
- **get_stock_news.py**: Fetches news articles related to the stock from NewsAPI.
- **send_mail.py**: Sends email reports using SMTP.
- **main.py**: Orchestrates the flow of the application.---
## Example Output
### Email Content
- **Subject**: Stock Update: [Stock Symbol] Prices & Insights
- **Body**:
- Date: [Latest Trading Day]
- Open Price: [Price]
- High Price: [Price]
- Low Price: [Price]
- Close Price: [Price]
- News Title: [Article Title]
- Author: [Article Author]
- Content: [Article Summary]
- Read more: [Article URL]