use enhanced orchestrator
This commit is contained in:
@ -31,7 +31,7 @@ logger = logging.getLogger(__name__)
|
||||
# Import core components
|
||||
from core.config import get_config
|
||||
from core.data_provider import DataProvider
|
||||
from core.orchestrator import TradingOrchestrator
|
||||
from core.enhanced_orchestrator import EnhancedTradingOrchestrator
|
||||
from core.trading_executor import TradingExecutor
|
||||
|
||||
# Import layout and component managers
|
||||
@ -60,13 +60,22 @@ from core.realtime_rl_cob_trader import RealtimeRLCOBTrader, PredictionResult
|
||||
class CleanTradingDashboard:
|
||||
"""Clean, modular trading dashboard implementation"""
|
||||
|
||||
def __init__(self, data_provider: DataProvider = None, orchestrator: TradingOrchestrator = None, trading_executor: TradingExecutor = None):
|
||||
def __init__(self, data_provider: DataProvider = None, orchestrator: EnhancedTradingOrchestrator = None, trading_executor: TradingExecutor = None):
|
||||
self.config = get_config()
|
||||
|
||||
# Initialize components
|
||||
self.data_provider = data_provider or DataProvider()
|
||||
self.orchestrator = orchestrator
|
||||
self.trading_executor = trading_executor
|
||||
self.trading_executor = trading_executor or TradingExecutor()
|
||||
|
||||
# Initialize orchestrator with enhanced capabilities
|
||||
if orchestrator is None:
|
||||
self.orchestrator = EnhancedTradingOrchestrator(
|
||||
data_provider=self.data_provider,
|
||||
symbols=['ETH/USDT', 'BTC/USDT'],
|
||||
enhanced_rl_training=True
|
||||
)
|
||||
else:
|
||||
self.orchestrator = orchestrator
|
||||
|
||||
# Initialize layout and component managers
|
||||
self.layout_manager = DashboardLayoutManager(
|
||||
@ -126,6 +135,42 @@ class CleanTradingDashboard:
|
||||
|
||||
logger.info("Clean Trading Dashboard initialized with COB RL integration")
|
||||
|
||||
def load_model_dynamically(self, model_name: str, model_type: str, model_path: str = None) -> bool:
|
||||
"""Dynamically load a model at runtime"""
|
||||
try:
|
||||
if hasattr(self.orchestrator, 'load_model'):
|
||||
success = self.orchestrator.load_model(model_name, model_type, model_path)
|
||||
if success:
|
||||
logger.info(f"Successfully loaded model: {model_name}")
|
||||
return True
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.error(f"Error loading model {model_name}: {e}")
|
||||
return False
|
||||
|
||||
def unload_model_dynamically(self, model_name: str) -> bool:
|
||||
"""Dynamically unload a model at runtime"""
|
||||
try:
|
||||
if hasattr(self.orchestrator, 'unload_model'):
|
||||
success = self.orchestrator.unload_model(model_name)
|
||||
if success:
|
||||
logger.info(f"Successfully unloaded model: {model_name}")
|
||||
return True
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.error(f"Error unloading model {model_name}: {e}")
|
||||
return False
|
||||
|
||||
def get_loaded_models_status(self) -> Dict[str, Any]:
|
||||
"""Get status of all loaded models"""
|
||||
try:
|
||||
if hasattr(self.orchestrator, 'list_loaded_models'):
|
||||
return self.orchestrator.list_loaded_models()
|
||||
return {'loaded_models': {}, 'total_models': 0, 'system_status': 'NO_ORCHESTRATOR'}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting model status: {e}")
|
||||
return {'loaded_models': {}, 'total_models': 0, 'system_status': 'ERROR'}
|
||||
|
||||
def _get_initial_balance(self) -> float:
|
||||
"""Get initial balance from trading executor or default"""
|
||||
try:
|
||||
|
Reference in New Issue
Block a user