This commit is contained in:
Dobromir Popov
2025-11-22 22:17:28 +02:00
parent 9a06288911
commit f38a924b0f
3 changed files with 254 additions and 7 deletions

View File

@@ -3264,18 +3264,25 @@ class RealTrainingAdapter:
else:
logger.info(f"Live Signal (NOT executed): {signal['action']} @ {signal['price']:.2f} (conf: {signal['confidence']:.2f}) - {self._get_rejection_reason(session, signal)}")
# Store prediction for visualization
# Store prediction for visualization WITH predicted_candle data for ghost candles
if self.orchestrator and hasattr(self.orchestrator, 'store_transformer_prediction'):
self.orchestrator.store_transformer_prediction(symbol, {
stored_prediction = {
'timestamp': datetime.now(timezone.utc).isoformat(),
'current_price': current_price,
'predicted_price': current_price * (1.01 if prediction['action'] == 'BUY' else 0.99),
'predicted_price': prediction.get('predicted_price', current_price * (1.01 if prediction['action'] == 'BUY' else 0.99)),
'price_change': 1.0 if prediction['action'] == 'BUY' else -1.0,
'confidence': prediction['confidence'],
'action': prediction['action'],
'horizon_minutes': 10,
'source': 'live_inference'
})
}
# Include predicted_candle for ghost candle visualization
if 'predicted_candle' in prediction and prediction['predicted_candle']:
stored_prediction['predicted_candle'] = prediction['predicted_candle']
stored_prediction['next_candles'] = prediction['predicted_candle'] # Alias for compatibility
logger.debug(f"Stored prediction with {len(prediction['predicted_candle'])} timeframe candles")
self.orchestrator.store_transformer_prediction(symbol, stored_prediction)
# Per-candle training mode
if train_every_candle: