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 "
|
"SELECT * FROM recommendations "
|
||||||
"WHERE action IN ('buy','sell') "
|
"WHERE action IN ('buy','sell') "
|
||||||
"AND mode IN ('paper_eligible','live_eligible') "
|
"AND mode IN ('paper_eligible','live_eligible') "
|
||||||
|
"AND generated_at > NOW() - INTERVAL '2 hours' "
|
||||||
"AND generated_at > $1 "
|
"AND generated_at > $1 "
|
||||||
"ORDER BY confidence DESC "
|
"ORDER BY confidence DESC "
|
||||||
"LIMIT 50",
|
"LIMIT 50",
|
||||||
@@ -994,6 +995,12 @@ class TradingEngine:
|
|||||||
except Exception:
|
except Exception:
|
||||||
logger.debug("Could not run circuit breaker daily loss check")
|
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:
|
except asyncio.CancelledError:
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user