trading works!
This commit is contained in:
@ -106,8 +106,8 @@ class TradingOrchestrator:
|
||||
# Configuration - AGGRESSIVE for more training data
|
||||
self.confidence_threshold = self.config.orchestrator.get('confidence_threshold', 0.15) # Lowered from 0.20
|
||||
self.confidence_threshold_close = self.config.orchestrator.get('confidence_threshold_close', 0.08) # Lowered from 0.10
|
||||
# we do not cap the decision frequency in time - only in confidence
|
||||
# self.decision_frequency = self.config.orchestrator.get('decision_frequency', 30)
|
||||
# Decision frequency limit to prevent excessive trading
|
||||
self.decision_frequency = self.config.orchestrator.get('decision_frequency', 30)
|
||||
self.symbols = self.config.get('symbols', ['ETH/USDT', 'BTC/USDT']) # Enhanced to support multiple symbols
|
||||
|
||||
# NEW: Aggressiveness parameters
|
||||
@ -612,7 +612,7 @@ class TradingOrchestrator:
|
||||
await self.make_trading_decision(symbol)
|
||||
await asyncio.sleep(1) # Small delay between symbols
|
||||
|
||||
# await asyncio.sleep(self.decision_frequency)
|
||||
await asyncio.sleep(self.decision_frequency)
|
||||
except Exception as e:
|
||||
logger.error(f"Error in trading decision loop: {e}")
|
||||
await asyncio.sleep(5) # Wait before retrying
|
||||
@ -930,8 +930,8 @@ class TradingOrchestrator:
|
||||
# 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
|
||||
if time_since_last < self.decision_frequency:
|
||||
return None
|
||||
|
||||
# Get current market data
|
||||
current_price = self.data_provider.get_current_price(symbol)
|
||||
@ -1353,6 +1353,24 @@ class TradingOrchestrator:
|
||||
best_action = 'HOLD'
|
||||
reasoning['threshold_applied'] = True
|
||||
|
||||
# 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}")
|
||||
|
||||
# Add P&L-based decision adjustment
|
||||
best_action, best_confidence = self._apply_pnl_feedback(
|
||||
best_action, best_confidence, current_position_pnl, symbol, reasoning
|
||||
|
Reference in New Issue
Block a user