fix: only poll recommendations from last 2 hours (not 24h), persist snapshots during market hours for performance tab
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user