dash fixes
This commit is contained in:
@ -551,12 +551,29 @@ class CleanTradingDashboard:
|
||||
if self.update_batch_counter % self.update_batch_interval != 0:
|
||||
raise PreventUpdate
|
||||
|
||||
# Filter out HOLD signals before displaying
|
||||
# Filter out HOLD signals and duplicate signals before displaying
|
||||
filtered_decisions = []
|
||||
seen_signals = set() # Track recent signals to avoid duplicates
|
||||
|
||||
for decision in self.recent_decisions:
|
||||
action = self._get_signal_attribute(decision, 'action', 'UNKNOWN')
|
||||
if action != 'HOLD':
|
||||
filtered_decisions.append(decision)
|
||||
# Create a unique key for this signal to avoid duplicates
|
||||
timestamp = decision.get('timestamp', datetime.now())
|
||||
price = decision.get('price', 0)
|
||||
confidence = decision.get('confidence', 0)
|
||||
|
||||
# Only show signals that are significantly different or from different time periods
|
||||
signal_key = f"{action}_{int(price)}_{int(confidence*100)}"
|
||||
time_key = int(timestamp.timestamp() // 30) # Group by 30-second intervals
|
||||
full_key = f"{signal_key}_{time_key}"
|
||||
|
||||
if full_key not in seen_signals:
|
||||
seen_signals.add(full_key)
|
||||
filtered_decisions.append(decision)
|
||||
|
||||
# Limit to last 10 signals to prevent UI clutter
|
||||
filtered_decisions = filtered_decisions[-10:]
|
||||
|
||||
# Log COB signal activity
|
||||
cob_signals = [d for d in filtered_decisions if d.get('type') == 'cob_liquidity_imbalance']
|
||||
@ -634,7 +651,7 @@ class CleanTradingDashboard:
|
||||
btc_snapshot = self._get_cob_snapshot('BTC/USDT')
|
||||
|
||||
# Debug: Log COB data availability - OPTIMIZED: Less frequent logging
|
||||
if n % 20 == 0: # Log every 20 seconds to reduce spam and improve performance
|
||||
if n % 30 == 0: # Log every 30 seconds to reduce spam and improve performance
|
||||
logger.info(f"COB Update #{n % 100}: ETH snapshot: {eth_snapshot is not None}, BTC snapshot: {btc_snapshot is not None}")
|
||||
if hasattr(self, 'latest_cob_data'):
|
||||
eth_data_time = self.cob_last_update.get('ETH/USDT', 0) if hasattr(self, 'cob_last_update') else 0
|
||||
|
Reference in New Issue
Block a user