Initial commit: Discord stock price bot with hourly PYPL updates

Implemented Discord bot for automated stock price tracking and reporting with the following features:

- Hourly PayPal (PYPL) stock price updates during NYSE market hours
- Custom branding for PYPL as "Steaks Stablecoin Value"
- Manual stock price queries via !stock and !price commands
- Multi-provider stock API support (Yahoo Finance and Finnhub)
- NYSE market hours detection with holiday awareness
- Discord embed formatting with color-coded price changes
- Docker containerization for consistent deployment
- Comprehensive documentation and deployment guides

Technical stack:
- Python 3.9+ with discord.py
- Finnhub API for stock price data
- APScheduler for hourly automated updates
- Docker support for local and Unraid deployment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Michael Simard
2025-12-02 21:54:11 -06:00
commit 5964cadf94
14 changed files with 946 additions and 0 deletions

39
stock_api/base.py Normal file
View File

@@ -0,0 +1,39 @@
from abc import ABC, abstractmethod
from typing import Optional, Dict, Any
class StockAPIBase(ABC):
"""
Abstract base class for stock price data providers.
This design allows seamless switching between different stock APIs.
"""
@abstractmethod
def get_stock_price(self, ticker: str) -> Optional[Dict[str, Any]]:
"""
Retrieve current stock price and related data for a given ticker.
Args:
ticker: Stock ticker symbol (e.g., 'PYPL', 'AAPL')
Returns:
Dictionary containing:
- ticker: str
- current_price: float
- previous_close: float
- change_dollar: float
- change_percent: float
- market_open: bool
Returns None if ticker is invalid or data unavailable.
"""
pass
@abstractmethod
def is_available(self) -> bool:
"""
Check if the API service is currently available.
Returns:
True if API is accessible, False otherwise.
"""
pass