From aee61e2e53c66d018f41864781b67e68c24dab3f Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 1 Oct 2025 10:49:35 +0300 Subject: [PATCH] fixes --- .../multi-exchange-data-aggregation/design.md | 2 +- web/clean_dashboard.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.kiro/specs/multi-exchange-data-aggregation/design.md b/.kiro/specs/multi-exchange-data-aggregation/design.md index 35f7a0a..b93afef 100644 --- a/.kiro/specs/multi-exchange-data-aggregation/design.md +++ b/.kiro/specs/multi-exchange-data-aggregation/design.md @@ -1,7 +1,7 @@ # Design Document ## Overview - + The Multi-Exchange Data Aggregation System is a comprehensive data collection and processing subsystem designed to serve as the foundational data layer for the trading orchestrator. The system will collect real-time order book and OHLCV data from the top 10 cryptocurrency exchanges, aggregate it into standardized formats, store it in a TimescaleDB time-series database, and provide both live data feeds and historical replay capabilities. The system follows a microservices architecture with containerized components, ensuring scalability, maintainability, and seamless integration with the existing trading infrastructure. diff --git a/web/clean_dashboard.py b/web/clean_dashboard.py index eaaca17..7d2f2d6 100644 --- a/web/clean_dashboard.py +++ b/web/clean_dashboard.py @@ -293,7 +293,9 @@ class CleanTradingDashboard: # WebSocket streaming self.ws_price_cache: dict = {} self.is_streaming = False - self.tick_cache: list = [] + # Use bounded deque to avoid unbounded growth + from collections import deque as _deque + self.tick_cache: _deque = _deque(maxlen=3600) # keep last ~1h of 1s ticks # COB data cache - enhanced with price buckets and memory system self.cob_cache: dict = { @@ -301,14 +303,14 @@ class CleanTradingDashboard: 'last_update': 0, 'data': None, 'updates_count': 0, - 'update_times': [], + 'update_times': _deque(maxlen=7200), # cap ~2h of 1s timestamps 'update_rate': 0.0 }, 'BTC/USDT': { 'last_update': 0, 'data': None, 'updates_count': 0, - 'update_times': [], + 'update_times': _deque(maxlen=7200), 'update_rate': 0.0 } } @@ -5795,9 +5797,9 @@ class CleanTradingDashboard: # Add to recent decisions for display self.recent_decisions.append(signal) - # Keep more decisions for longer history - extend to 200 decisions + # Keep decisions bounded to prevent growth if len(self.recent_decisions) > 200: - self.recent_decisions = self.recent_decisions[-200:] + del self.recent_decisions[:-200] # Train ALL models on EVERY prediction result (not just executed ones) # This ensures models learn from all predictions, not just successful trades @@ -8866,7 +8868,7 @@ class CleanTradingDashboard: # Add to recent decisions self.recent_decisions.append(signal) if len(self.recent_decisions) > 200: - self.recent_decisions.pop(0) + del self.recent_decisions[:-200] logger.info(f"COB SIGNAL: {symbol} {signal['action']} signal generated - imbalance: {imbalance:.3f}, confidence: {signal['confidence']:.3f}")