ETS integration and UI
This commit is contained in:
@ -2498,7 +2498,7 @@ class TradingOrchestrator:
|
||||
return False
|
||||
|
||||
def get_enhanced_training_stats(self) -> Dict[str, Any]:
|
||||
"""Get enhanced training system statistics"""
|
||||
"""Get enhanced training system statistics with orchestrator integration"""
|
||||
try:
|
||||
if not self.enhanced_training_system:
|
||||
return {
|
||||
@ -2507,10 +2507,82 @@ class TradingOrchestrator:
|
||||
'error': 'Training system not initialized'
|
||||
}
|
||||
|
||||
# Get base stats from enhanced training system
|
||||
stats = self.enhanced_training_system.get_training_statistics()
|
||||
stats['training_enabled'] = self.training_enabled
|
||||
stats['system_available'] = ENHANCED_TRAINING_AVAILABLE
|
||||
|
||||
# Add orchestrator-specific training integration data
|
||||
stats['orchestrator_integration'] = {
|
||||
'models_connected': len([m for m in [self.rl_agent, self.cnn_model, self.cob_rl_agent, self.decision_model] if m is not None]),
|
||||
'cob_integration_active': self.cob_integration is not None,
|
||||
'decision_fusion_enabled': self.decision_fusion_enabled,
|
||||
'symbols_tracking': len(self.symbols),
|
||||
'recent_decisions_count': sum(len(decisions) for decisions in self.recent_decisions.values()),
|
||||
'model_weights': self.model_weights.copy(),
|
||||
'realtime_processing': self.realtime_processing
|
||||
}
|
||||
|
||||
# Add model-specific training status from orchestrator
|
||||
stats['model_training_status'] = {}
|
||||
model_mappings = {
|
||||
'dqn': self.rl_agent,
|
||||
'cnn': self.cnn_model,
|
||||
'cob_rl': self.cob_rl_agent,
|
||||
'decision': self.decision_model
|
||||
}
|
||||
|
||||
for model_name, model in model_mappings.items():
|
||||
if model:
|
||||
model_stats = {
|
||||
'model_loaded': True,
|
||||
'memory_usage': 0,
|
||||
'training_steps': 0,
|
||||
'last_loss': None,
|
||||
'checkpoint_loaded': self.model_states.get(model_name, {}).get('checkpoint_loaded', False)
|
||||
}
|
||||
|
||||
# Get memory usage
|
||||
if hasattr(model, 'memory') and model.memory:
|
||||
model_stats['memory_usage'] = len(model.memory)
|
||||
|
||||
# Get training steps
|
||||
if hasattr(model, 'training_steps'):
|
||||
model_stats['training_steps'] = model.training_steps
|
||||
|
||||
# Get last loss
|
||||
if hasattr(model, 'losses') and model.losses:
|
||||
model_stats['last_loss'] = model.losses[-1]
|
||||
|
||||
stats['model_training_status'][model_name] = model_stats
|
||||
else:
|
||||
stats['model_training_status'][model_name] = {
|
||||
'model_loaded': False,
|
||||
'memory_usage': 0,
|
||||
'training_steps': 0,
|
||||
'last_loss': None,
|
||||
'checkpoint_loaded': False
|
||||
}
|
||||
|
||||
# Add prediction tracking stats
|
||||
stats['prediction_tracking'] = {
|
||||
'dqn_predictions_tracked': sum(len(preds) for preds in self.recent_dqn_predictions.values()),
|
||||
'cnn_predictions_tracked': sum(len(preds) for preds in self.recent_cnn_predictions.values()),
|
||||
'accuracy_history_tracked': sum(len(history) for history in self.prediction_accuracy_history.values()),
|
||||
'symbols_with_predictions': [symbol for symbol in self.symbols if
|
||||
len(self.recent_dqn_predictions.get(symbol, [])) > 0 or
|
||||
len(self.recent_cnn_predictions.get(symbol, [])) > 0]
|
||||
}
|
||||
|
||||
# Add COB integration stats if available
|
||||
if self.cob_integration:
|
||||
stats['cob_integration_stats'] = {
|
||||
'latest_cob_data_symbols': list(self.latest_cob_data.keys()),
|
||||
'cob_features_available': list(self.latest_cob_features.keys()),
|
||||
'cob_state_available': list(self.latest_cob_state.keys()),
|
||||
'feature_history_length': {symbol: len(history) for symbol, history in self.cob_feature_history.items()}
|
||||
}
|
||||
|
||||
return stats
|
||||
|
||||
except Exception as e:
|
||||
|
Reference in New Issue
Block a user