added coin API WS implementation
This commit is contained in:
@ -1379,19 +1379,38 @@ class CleanTradingDashboard:
|
||||
eth_recent = _recent_ticks('ETH/USDT')
|
||||
btc_recent = _recent_ticks('BTC/USDT')
|
||||
|
||||
# Include per-exchange stats when available
|
||||
exchange_stats_eth = None
|
||||
exchange_stats_btc = None
|
||||
if hasattr(self.data_provider, 'cob_integration') and self.data_provider.cob_integration:
|
||||
try:
|
||||
snaps = self.data_provider.cob_integration.exchange_order_books
|
||||
if 'ETH/USDT' in snaps:
|
||||
exchange_stats_eth = {ex: {
|
||||
'bids': len(data.get('bids', {})),
|
||||
'asks': len(data.get('asks', {}))
|
||||
} for ex, data in snaps['ETH/USDT'].items() if isinstance(data, dict)}
|
||||
if 'BTC/USDT' in snaps:
|
||||
exchange_stats_btc = {ex: {
|
||||
'bids': len(data.get('bids', {})),
|
||||
'asks': len(data.get('asks', {}))
|
||||
} for ex, data in snaps['BTC/USDT'].items() if isinstance(data, dict)}
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
eth_components = self.component_manager.format_cob_data(
|
||||
eth_snapshot,
|
||||
'ETH/USDT',
|
||||
eth_imbalance_stats,
|
||||
cob_mode,
|
||||
update_info={'update_rate': eth_rate, 'aggregated_1s': eth_agg_1s[-5:], 'recent_ticks': eth_recent}
|
||||
update_info={'update_rate': eth_rate, 'aggregated_1s': eth_agg_1s[-5:], 'recent_ticks': eth_recent, 'exchanges': exchange_stats_eth}
|
||||
)
|
||||
btc_components = self.component_manager.format_cob_data(
|
||||
btc_snapshot,
|
||||
'BTC/USDT',
|
||||
btc_imbalance_stats,
|
||||
cob_mode,
|
||||
update_info={'update_rate': btc_rate, 'aggregated_1s': btc_agg_1s[-5:], 'recent_ticks': btc_recent}
|
||||
update_info={'update_rate': btc_rate, 'aggregated_1s': btc_agg_1s[-5:], 'recent_ticks': btc_recent, 'exchanges': exchange_stats_btc}
|
||||
)
|
||||
|
||||
return eth_components, btc_components
|
||||
@ -7089,7 +7108,7 @@ class CleanTradingDashboard:
|
||||
"""Initialize enhanced training system for model predictions"""
|
||||
try:
|
||||
# Try to import and initialize enhanced training system
|
||||
from enhanced_realtime_training import EnhancedRealtimeTrainingSystem
|
||||
from enhanced_realtime_training import EnhancedRealtimeTrainingSystem # Optional
|
||||
|
||||
self.training_system = EnhancedRealtimeTrainingSystem(
|
||||
orchestrator=self.orchestrator,
|
||||
@ -7106,7 +7125,7 @@ class CleanTradingDashboard:
|
||||
logger.debug("Enhanced training system initialized for model predictions")
|
||||
|
||||
except ImportError:
|
||||
logger.warning("Enhanced training system not available - using mock predictions")
|
||||
logger.warning("Enhanced training system not available - predictions disabled for this module")
|
||||
self.training_system = None
|
||||
except Exception as e:
|
||||
logger.error(f"Error initializing enhanced training system: {e}")
|
||||
|
Reference in New Issue
Block a user