Initial commit: Discord stock bot with hourly PYPL updates

Functional Discord bot with automated hourly stock price updates during NYSE trading hours. Supports manual queries for any ticker via prefix commands.

🤖 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 22:25:37 -06:00
commit 3b6f0cbe4a
15 changed files with 1321 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