Skip to main content

A Python package to track stock prices and send email alerts when price conditions are met.

Project description

Stock Price Tracker

The Stock Price Tracker is a Python package that allows you to monitor stock prices and receive email alerts when a stock's price meets a specified target. This package uses yfinance to fetch real-time stock data, apscheduler for scheduling periodic checks, and smtplib to send email notifications.


Features

  • Add multiple stocks to monitor with desired price thresholds.
  • Send email notifications when a stock's price falls below the specified target.
  • Schedule stock price checks with a default interval of 15 hours.
  • Flexible and customizable scheduling.

Installation

To install the package, run:

pip install stock_price_tracker

Usage

1. Import the package and initialize the tracker

from stock_price_tracker import StockPriceTracker

tracker = StockPriceTracker(
    smtp_server="appropriate_server",
    smtp_port=(port_number),
    email="your_email@gmail.com",
    password="your_email_password",
    recipient_email="recipient_email@gmail.com"
)

2. Add stocks to monitor

tracker.add_stock("AAPL", 150)  # Apple stock, target price: $150
tracker.add_stock("GOOGL", 2500)  # Alphabet stock, target price: $2500

3. Start the scheduler

tracker.start_scheduler()

The scheduler will run checks every 15 hours by default.


Example

from stock_price_tracker import StockPriceTracker

# Initialize the tracker
tracker = StockPriceTracker(
    smtp_server="smtp.gmail.com",  # Use the appropriate SMTP server
    smtp_port=587,  # Port for Gmail
    email="your_email@gmail.com",  # Your email address
    password="your_email_password",  # Your email app-specific password
    recipient_email="recipient_email@gmail.com"  # Email to receive alerts
)

# Add stocks
tracker.add_stock("AAPL", 150)
tracker.add_stock("MSFT", 280)

# Check prices immediately
tracker.check_prices()

# Start monitoring
tracker.start_scheduler()

Requirements

  • Python >= 3.6
  • Dependencies:
    • yfinance
    • apscheduler

License

This project is licensed under the MIT License. See the LICENSE file for details.


Contributing

Contributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request.


Contact

For questions or feedback, you can reach me at GitHub Profile.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stock_price_tracker-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stock_price_tracker-1.0.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file stock_price_tracker-1.0.0.tar.gz.

File metadata

  • Download URL: stock_price_tracker-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for stock_price_tracker-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7bc2d0f91d4b2ae41b391f8f8932103259dcd0f9cffd545eda650863281eb902
MD5 eff2895e7841f05f9e543af89f1ca50a
BLAKE2b-256 b27f92757478f5eaec1bcc7f96534b89afee1923715b365a47c0297678e8ea0b

See more details on using hashes here.

File details

Details for the file stock_price_tracker-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stock_price_tracker-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2c70e5e5059631b5ba9884e8a7c09e355f18dc08fab412d46d1781d6f607c70
MD5 e1bff5f6c73b205b807ed8617ae9f7b3
BLAKE2b-256 92138d0c9e8544650ae5f96abede01ff887e2966d7cacf6188cf0f48ca9f8257

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page