more info at signals

This commit is contained in:
Dobromir Popov
2025-07-29 00:20:07 +03:00
parent e1e453c204
commit ea4db519de
2 changed files with 50 additions and 17 deletions

View File

@ -4581,6 +4581,9 @@ class TradingOrchestrator:
logger.debug(f"Skipping disabled model {pred.model_name} in decision making") logger.debug(f"Skipping disabled model {pred.model_name} in decision making")
continue continue
# DEBUG: Log individual model predictions
logger.debug(f"Model {pred.model_name}: {pred.action} (confidence: {pred.confidence:.3f})")
# Get model weight # Get model weight
model_weight = self.model_weights.get(pred.model_name, 0.1) model_weight = self.model_weights.get(pred.model_name, 0.1)
@ -4598,8 +4601,18 @@ class TradingOrchestrator:
# Choose best action - safe way to handle max with key function # Choose best action - safe way to handle max with key function
if action_scores: if action_scores:
# Add small random component to break ties and prevent pure bias
import random
for action in action_scores:
# Add tiny random noise (±0.001) to break exact ties
action_scores[action] += random.uniform(-0.001, 0.001)
best_action = max(action_scores.keys(), key=lambda k: action_scores[k]) best_action = max(action_scores.keys(), key=lambda k: action_scores[k])
best_confidence = action_scores[best_action] best_confidence = action_scores[best_action]
# DEBUG: Log action scores to understand bias
logger.debug(f"Action scores for {symbol}: BUY={action_scores['BUY']:.3f}, SELL={action_scores['SELL']:.3f}, HOLD={action_scores['HOLD']:.3f}")
logger.debug(f"Selected action: {best_action} (confidence: {best_confidence:.3f})")
else: else:
best_action = "HOLD" best_action = "HOLD"
best_confidence = 0.0 best_confidence = 0.0

View File

@ -2468,12 +2468,24 @@ class CleanTradingDashboard:
if not signal_price or signal_confidence is None or signal_confidence <= 0 or signal_action == 'HOLD': if not signal_price or signal_confidence is None or signal_confidence <= 0 or signal_action == 'HOLD':
continue continue
# Extract source information from signal
signal_source = 'Unknown'
if hasattr(signal, 'reasoning') and signal.reasoning:
models_used = signal.reasoning.get('models_used', [])
if models_used:
signal_source = ', '.join(models_used)
elif isinstance(signal, dict) and 'reasoning' in signal:
models_used = signal['reasoning'].get('models_used', [])
if models_used:
signal_source = ', '.join(models_used)
signal_data = { signal_data = {
'x': signal_time, 'x': signal_time,
'y': signal_price, 'y': signal_price,
'confidence': signal_confidence, 'confidence': signal_confidence,
'executed': is_executed, 'executed': is_executed,
'manual': is_manual 'manual': is_manual,
'source': signal_source
} }
if signal_action == 'BUY': if signal_action == 'BUY':
@ -2507,8 +2519,9 @@ class CleanTradingDashboard:
hovertemplate="<b>BUY EXECUTED</b><br>" + hovertemplate="<b>BUY EXECUTED</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in executed_buys] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'Unknown')] for s in executed_buys]
), ),
row=row, col=1 row=row, col=1
) )
@ -2531,8 +2544,9 @@ class CleanTradingDashboard:
hovertemplate="<b>MANUAL BUY</b><br>" + hovertemplate="<b>MANUAL BUY</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in manual_buys] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'Manual')] for s in manual_buys]
), ),
row=row, col=1 row=row, col=1
) )
@ -2555,8 +2569,9 @@ class CleanTradingDashboard:
hovertemplate="<b>ML BUY</b><br>" + hovertemplate="<b>ML BUY</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in ml_buys] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'ML')] for s in ml_buys]
), ),
row=row, col=1 row=row, col=1
) )
@ -2579,8 +2594,9 @@ class CleanTradingDashboard:
hovertemplate="<b>BUY SIGNAL</b><br>" + hovertemplate="<b>BUY SIGNAL</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in pending_buys] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'Signal')] for s in pending_buys]
), ),
row=row, col=1 row=row, col=1
) )
@ -2611,8 +2627,9 @@ class CleanTradingDashboard:
hovertemplate="<b>SELL EXECUTED</b><br>" + hovertemplate="<b>SELL EXECUTED</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in executed_sells] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'Unknown')] for s in executed_sells]
), ),
row=row, col=1 row=row, col=1
) )
@ -2635,8 +2652,9 @@ class CleanTradingDashboard:
hovertemplate="<b>MANUAL SELL</b><br>" + hovertemplate="<b>MANUAL SELL</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in manual_sells] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'Manual')] for s in manual_sells]
), ),
row=row, col=1 row=row, col=1
) )
@ -2659,8 +2677,9 @@ class CleanTradingDashboard:
hovertemplate="<b>ML SELL</b><br>" + hovertemplate="<b>ML SELL</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in ml_sells] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'ML')] for s in ml_sells]
), ),
row=row, col=1 row=row, col=1
) )
@ -2683,8 +2702,9 @@ class CleanTradingDashboard:
hovertemplate="<b>SELL SIGNAL</b><br>" + hovertemplate="<b>SELL SIGNAL</b><br>" +
"Price: $%{y:.2f}<br>" + "Price: $%{y:.2f}<br>" +
"Time: %{x}<br>" + "Time: %{x}<br>" +
"Confidence: %{customdata:.1%}<extra></extra>", "Confidence: %{customdata[0]:.1%}<br>" +
customdata=[s['confidence'] for s in pending_sells] "Source: %{customdata[1]}<extra></extra>",
customdata=[[s['confidence'], s.get('source', 'Signal')] for s in pending_sells]
), ),
row=row, col=1 row=row, col=1
) )