more cobfixes

This commit is contained in:
Dobromir Popov
2025-08-08 19:15:16 +03:00
parent be1753c96a
commit 71ba37ccc2
4 changed files with 101 additions and 13 deletions

View File

@ -4386,11 +4386,11 @@ class DataProvider:
# Ensure symbol keys exist in the dictionary with proper deque initialization
for sym in ['ETH/USDT', 'BTC/USDT']:
if sym not in self.cob_raw_ticks:
# Use deque with maxlen for automatic size management (15 min at ~100 ticks/sec)
self.cob_raw_ticks[sym] = deque(maxlen=90000)
# Use deque with maxlen for automatic size management (30 min at ~100 ticks/sec)
self.cob_raw_ticks[sym] = deque(maxlen=180000)
if sym not in self.cob_1s_aggregated:
# 1s aggregated: 15 minutes = 900 seconds
self.cob_1s_aggregated[sym] = deque(maxlen=900)
# 1s aggregated: 30 minutes = 1800 seconds
self.cob_1s_aggregated[sym] = deque(maxlen=1800)
# Add to raw ticks - deque automatically handles size limit with maxlen
self.cob_raw_ticks[symbol].append(cob_data)
@ -4452,7 +4452,7 @@ class DataProvider:
elif not isinstance(self.cob_data_cache[symbol], (list, deque)):
self.cob_data_cache[symbol] = []
self.cob_data_cache[symbol].append(standard_cob_data)
if len(self.cob_data_cache[symbol]) > 300: # Keep 5 minutes
if len(self.cob_data_cache[symbol]) > 1800: # Keep 30 minutes
self.cob_data_cache[symbol].pop(0)
# Notify subscribers