limit max positions
This commit is contained in:
@ -927,11 +927,9 @@ class TradingOrchestrator:
|
||||
try:
|
||||
current_time = datetime.now()
|
||||
|
||||
# Check if enough time has passed since last decision
|
||||
if symbol in self.last_decision_time:
|
||||
time_since_last = (current_time - self.last_decision_time[symbol]).total_seconds()
|
||||
if time_since_last < self.decision_frequency:
|
||||
return None
|
||||
# EXECUTE EVERY SIGNAL: Remove decision frequency limit
|
||||
# Allow immediate execution of every signal from the decision model
|
||||
logger.debug(f"Processing signal for {symbol} - no frequency limit applied")
|
||||
|
||||
# Get current market data
|
||||
current_price = self.data_provider.get_current_price(symbol)
|
||||
@ -1333,43 +1331,15 @@ class TradingOrchestrator:
|
||||
current_position_pnl, symbol
|
||||
)
|
||||
|
||||
# Apply aggressiveness-based confidence thresholds
|
||||
if best_action in ['BUY', 'SELL']:
|
||||
# For entry signals, use entry aggressiveness
|
||||
if not self._has_open_position(symbol):
|
||||
if best_confidence < entry_threshold:
|
||||
best_action = 'HOLD'
|
||||
reasoning['entry_threshold_applied'] = True
|
||||
reasoning['entry_threshold'] = entry_threshold
|
||||
# For exit signals, use exit aggressiveness
|
||||
else:
|
||||
if best_confidence < exit_threshold:
|
||||
best_action = 'HOLD'
|
||||
reasoning['exit_threshold_applied'] = True
|
||||
reasoning['exit_threshold'] = exit_threshold
|
||||
else:
|
||||
# Standard threshold for HOLD
|
||||
if best_confidence < self.confidence_threshold:
|
||||
best_action = 'HOLD'
|
||||
reasoning['threshold_applied'] = True
|
||||
# EXECUTE EVERY SIGNAL: Remove confidence thresholds and signal accumulation
|
||||
# The decision model has already aggregated all model outputs (CNN, DQN, transformer, etc.)
|
||||
# So we trust its decision and execute every signal
|
||||
reasoning['execute_every_signal'] = True
|
||||
reasoning['models_aggregated'] = [pred.model_name for pred in predictions]
|
||||
reasoning['aggregated_confidence'] = best_confidence
|
||||
|
||||
# Signal accumulation check - require multiple confident signals
|
||||
if best_action in ['BUY', 'SELL']:
|
||||
required_signals = 3 # Require 3 confident signals
|
||||
recent_decisions = self.get_recent_decisions(symbol, limit=5)
|
||||
|
||||
# Count recent signals in the same direction
|
||||
same_direction_count = sum(1 for d in recent_decisions
|
||||
if d.action == best_action and d.confidence > entry_threshold)
|
||||
|
||||
if same_direction_count < required_signals:
|
||||
best_action = 'HOLD'
|
||||
reasoning['signal_accumulation'] = True
|
||||
reasoning['required_signals'] = required_signals
|
||||
reasoning['current_signals'] = same_direction_count
|
||||
logger.info(f"Signal accumulation: {same_direction_count}/{required_signals} signals for {best_action}")
|
||||
else:
|
||||
logger.info(f"Signal accumulation satisfied: {same_direction_count}/{required_signals} signals for {best_action}")
|
||||
logger.info(f"EXECUTING EVERY SIGNAL: {best_action} (confidence: {best_confidence:.3f}) "
|
||||
f"from aggregated models: {reasoning['models_aggregated']}")
|
||||
|
||||
# Add P&L-based decision adjustment
|
||||
best_action, best_confidence = self._apply_pnl_feedback(
|
||||
|
Reference in New Issue
Block a user