Switch to candlestick charts with 30-day daily data

- Replace line charts with candlestick charts for better visualization
- Green candles for up days, red for down days
- Daily resolution (30 days) - free tier compatible
- Auto-detect intraday vs daily data for proper time/date formatting
- Note: 5-min intraday requires paid Polygon tier ($199/month)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Michael Simard
2025-12-26 12:14:15 -06:00
parent f5d05192b9
commit 1325863837
4 changed files with 138 additions and 22 deletions

12
bot.py
View File

@@ -263,12 +263,12 @@ class StockBot(commands.Bot):
await channel.send(f"Unable to retrieve data for ticker: {ticker}")
return
# Generate chart using Polygon.io historical data
# Generate chart using Polygon.io historical data (daily candlesticks)
chart_file = None
if self.chart_api:
candle_data = self.chart_api.get_candles(ticker, days=30)
candle_data = self.chart_api.get_candles(ticker, days=30, resolution='D')
if candle_data:
chart_buffer = ChartGenerator.create_price_chart(
chart_buffer = ChartGenerator.create_candlestick_chart(
ticker,
candle_data,
stock_data.get('company_name')
@@ -559,12 +559,12 @@ async def get_stock_price(ctx, ticker: str = None):
await ctx.send(f"Unable to retrieve data for ticker: {ticker}")
return
# Generate chart using Polygon.io historical data
# Generate chart using Polygon.io historical data (daily candlesticks)
chart_file = None
if bot.chart_api:
candle_data = bot.chart_api.get_candles(ticker, days=30)
candle_data = bot.chart_api.get_candles(ticker, days=30, resolution='D')
if candle_data:
chart_buffer = ChartGenerator.create_price_chart(
chart_buffer = ChartGenerator.create_candlestick_chart(
ticker,
candle_data,
stock_data.get('company_name')