diff --git a/services/trading/engine.py b/services/trading/engine.py index 2623535..d0e8282 100644 --- a/services/trading/engine.py +++ b/services/trading/engine.py @@ -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: