Skip to content

Commit dcc97b2

Browse files
committed
Fix 1w chart - remove limit on data fetch, use MonthLocator for longer timeframes
1 parent abd2ae9 commit dcc97b2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

chart_service.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ def generate_price_chart(
166166
elif hours <= 168:
167167
ax.xaxis.set_major_formatter(mdates.DateFormatter("%b %d %H:%M"))
168168
ax.xaxis.set_major_locator(mdates.DayLocator(interval=1))
169+
ax.xaxis.set_minor_locator(mdates.HourLocator(interval=6))
169170
else:
170171
ax.xaxis.set_major_formatter(mdates.DateFormatter("%b %d"))
171-
ax.xaxis.set_major_locator(mdates.WeekdayLocator(byweekday=0))
172+
ax.xaxis.set_major_locator(mdates.MonthLocator())
172173

173174
price_min = min(prices_arr)
174175
price_max = max(prices_arr)
@@ -215,7 +216,9 @@ async def get_chart_bytes(
215216
) -> Optional[bytes]:
216217
"""Get price history from DB and generate chart."""
217218
max_points = 800 if hours <= 24 else 1200 if hours <= 168 else 1500
218-
history = await db.get_price_history(crypto, hours=hours, descending=True)
219+
history = await db.get_price_history(
220+
crypto, hours=hours, limit=None, descending=True
221+
)
219222

220223
if not history or len(history) < 2:
221224
return None

0 commit comments

Comments
 (0)