This commit is contained in:
Dobromir Popov
2025-06-24 19:33:13 +03:00
parent 8a51ef8b8c
commit 36d4c543c3
2 changed files with 130 additions and 33 deletions

View File

@ -170,6 +170,9 @@ class EnhancedTradingOrchestrator(TradingOrchestrator):
self.williams_features = {} # Symbol -> Williams features
self.symbol_correlation_matrix = {} # Pre-computed correlations
# Initialize pivot RL trainer (if available)
self.pivot_rl_trainer = None # Will be initialized if enhanced pivot training is needed
# Initialize COB Integration for real-time market microstructure
# PROPERLY INITIALIZED: Create the COB integration instance synchronously
try:
@ -2478,7 +2481,7 @@ class EnhancedTradingOrchestrator(TradingOrchestrator):
threshold_type = "ENTRY"
# For entries, check if CNN predicts favorable pivot
if hasattr(self.pivot_rl_trainer, 'williams') and self.pivot_rl_trainer.williams.cnn_model:
if hasattr(self, 'pivot_rl_trainer') and self.pivot_rl_trainer and hasattr(self.pivot_rl_trainer, 'williams') and self.pivot_rl_trainer.williams.cnn_model:
try:
# Get market data for CNN analysis
current_price = market_state.prices.get(self.timeframes[0], 0)
@ -2524,7 +2527,7 @@ class EnhancedTradingOrchestrator(TradingOrchestrator):
'action_type': threshold_type,
'threshold_used': threshold,
'pivot_enhanced': True,
'cnn_integrated': hasattr(self.pivot_rl_trainer, 'williams') and self.pivot_rl_trainer.williams.cnn_model is not None,
'cnn_integrated': hasattr(self, 'pivot_rl_trainer') and self.pivot_rl_trainer and hasattr(self.pivot_rl_trainer, 'williams') and self.pivot_rl_trainer.williams.cnn_model is not None,
'timeframe_breakdown': [(tf.timeframe, tf.action, tf.confidence)
for tf in best_pred.timeframe_predictions],
'market_regime': market_state.market_regime