ui edits
This commit is contained in:
@ -171,19 +171,23 @@ class EnhancedTradingOrchestrator(TradingOrchestrator):
|
||||
self.symbol_correlation_matrix = {} # Pre-computed correlations
|
||||
|
||||
# Initialize COB Integration for real-time market microstructure
|
||||
# COMMENTED OUT: Causes async runtime error during sync initialization
|
||||
# self.cob_integration = COBIntegration(
|
||||
# data_provider=self.data_provider,
|
||||
# symbols=self.symbols
|
||||
# )
|
||||
# # Register COB callbacks for CNN and RL models
|
||||
# self.cob_integration.add_cnn_callback(self._on_cob_cnn_features)
|
||||
# self.cob_integration.add_dqn_callback(self._on_cob_dqn_state)
|
||||
|
||||
# FIXED: Defer COB integration until async context is available
|
||||
self.cob_integration = None
|
||||
self.cob_integration_active = False
|
||||
self._cob_integration_failed = False
|
||||
# PROPERLY INITIALIZED: Create the COB integration instance synchronously
|
||||
try:
|
||||
self.cob_integration = COBIntegration(
|
||||
data_provider=self.data_provider,
|
||||
symbols=self.symbols
|
||||
)
|
||||
# Register COB callbacks for CNN and RL models
|
||||
self.cob_integration.add_cnn_callback(self._on_cob_cnn_features)
|
||||
self.cob_integration.add_dqn_callback(self._on_cob_dqn_state)
|
||||
self.cob_integration_active = False # Will be set to True when started
|
||||
self._cob_integration_failed = False
|
||||
logger.info("COB Integration: Successfully initialized")
|
||||
except Exception as e:
|
||||
logger.warning(f"COB Integration: Failed to initialize - {e}")
|
||||
self.cob_integration = None
|
||||
self.cob_integration_active = False
|
||||
self._cob_integration_failed = True
|
||||
|
||||
# COB feature storage for model integration
|
||||
self.latest_cob_features: Dict[str, np.ndarray] = {}
|
||||
@ -2897,9 +2901,11 @@ class EnhancedTradingOrchestrator(TradingOrchestrator):
|
||||
|
||||
logger.info("Starting COB integration for real-time market microstructure...")
|
||||
await self.cob_integration.start()
|
||||
self.cob_integration_active = True
|
||||
logger.info("COB integration started successfully")
|
||||
except Exception as e:
|
||||
logger.error(f"Error starting COB integration: {e}")
|
||||
self.cob_integration_active = False
|
||||
|
||||
async def stop_cob_integration(self):
|
||||
"""Stop COB integration"""
|
||||
|
Reference in New Issue
Block a user