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:
Michael Simard
2025-12-03 18:57:13 -06:00
parent 770701e293
commit 584ad2a4f4
6 changed files with 54 additions and 6 deletions

19
bot.py
View File

@@ -52,8 +52,16 @@ class StockBot(commands.Bot):
name='Hourly Stock Price Update'
)
# Schedule market close update at 4:00 PM ET on weekdays
self.scheduler.add_job(
self.send_market_close_update,
CronTrigger(hour=16, minute=0, day_of_week='mon-fri', timezone=MarketHours.NYSE_TIMEZONE),
id='market_close_update',
name='Market Close Update'
)
self.scheduler.start()
logger.info("Scheduler started for hourly updates")
logger.info("Scheduler started for hourly updates and market close")
async def on_ready(self):
"""Called when bot successfully connects to Discord."""
@@ -77,6 +85,15 @@ class StockBot(commands.Bot):
logger.info(f"Sending hourly update for {self.primary_ticker}")
await self.send_stock_update(self.primary_ticker, self.target_channel_id)
async def send_market_close_update(self):
"""Send stock price update at market close on trading days."""
if not MarketHours.is_trading_day():
logger.info("Not a trading day, skipping market close update")
return
logger.info(f"Sending market close update for {self.primary_ticker}")
await self.send_stock_update(self.primary_ticker, self.target_channel_id)
async def send_stock_update(self, ticker: str, channel_id: int):
"""
Fetch stock data and send formatted embed to specified channel.