fix: only poll recommendations from last 2 hours (not 24h), persist snapshots during market hours for performance tab

This commit is contained in:
Celes Renata
2026-04-16 23:53:54 +00:00
parent 18eb150c75
commit f57167ce4d
+7
View File
@@ -621,6 +621,7 @@ class TradingEngine:
"SELECT * FROM recommendations "
"WHERE action IN ('buy','sell') "
"AND mode IN ('paper_eligible','live_eligible') "
"AND generated_at > NOW() - INTERVAL '2 hours' "
"AND generated_at > $1 "
"ORDER BY confidence DESC "
"LIMIT 50",
@@ -994,6 +995,12 @@ class TradingEngine:
except Exception:
logger.debug("Could not run circuit breaker daily loss check")
# Persist a snapshot every cycle (during market hours) for the performance tab
try:
await self._persist_daily_snapshot(now)
except Exception:
logger.debug("Could not persist snapshot")
except asyncio.CancelledError:
break
except Exception: