Add market close updates and update deployment path for Compose Manager
Bot enhancements: - Add scheduled update at market close (4:00 PM ET on trading days) - Implement is_trading_day() method to check weekdays/holidays - Market close update sends PYPL price at end of trading day Deployment changes: - Update all scripts to use Docker Compose Manager plugin path - New path: /boot/config/plugins/compose.manager/projects/discord-stock-bot - Container now integrates with Unraid Docker UI Compose section - Update documentation with plugin integration details 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -79,6 +79,34 @@ class MarketHours:
|
||||
logger.debug(f"Market closed: Outside trading hours ({current_time})")
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def is_trading_day(cls, check_time: datetime = None) -> bool:
|
||||
"""
|
||||
Determine if the given date is a trading day (weekday, not a holiday).
|
||||
|
||||
Args:
|
||||
check_time: Datetime to check (defaults to now)
|
||||
|
||||
Returns:
|
||||
True if it's a trading day, False otherwise
|
||||
"""
|
||||
if check_time is None:
|
||||
check_time = datetime.now(cls.NYSE_TIMEZONE)
|
||||
else:
|
||||
check_time = check_time.astimezone(cls.NYSE_TIMEZONE)
|
||||
|
||||
# Check if weekend
|
||||
if check_time.weekday() >= 5: # Saturday = 5, Sunday = 6
|
||||
return False
|
||||
|
||||
# Check if holiday
|
||||
check_date = check_time.date()
|
||||
all_holidays = cls.HOLIDAYS_2024 + cls.HOLIDAYS_2025
|
||||
if any(holiday.date() == check_date for holiday in all_holidays):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def get_next_market_open(cls, from_time: datetime = None) -> datetime:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user