|
@@ -14,11 +14,16 @@ from src.utils.token_display_formatter import get_formatter
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class RiskCleanupManager:
|
|
|
- def __init__(self, trading_engine, notification_manager, market_monitor_cache):
|
|
|
+ def __init__(self, trading_engine, notification_manager, market_monitor_cache, shared_state):
|
|
|
self.trading_engine = trading_engine
|
|
|
self.notification_manager = notification_manager
|
|
|
self.market_monitor_cache = market_monitor_cache # To access cached orders/positions
|
|
|
- self.external_stop_losses: Dict[str, Dict[str, Any]] = {} # exchange_order_id -> details
|
|
|
+ self.shared_state = shared_state # Store shared_state
|
|
|
+ # Initialize external_stop_losses within shared_state if it's not already there
|
|
|
+ if 'external_stop_losses' not in self.shared_state:
|
|
|
+ self.shared_state['external_stop_losses'] = {}
|
|
|
+ # For direct access if needed, though primary access should be via shared_state
|
|
|
+ self.external_stop_losses: Dict[str, Dict[str, Any]] = self.shared_state['external_stop_losses']
|
|
|
|
|
|
# Methods like _check_automatic_risk_management, _cleanup_orphaned_stop_losses,
|
|
|
# _check_external_stop_loss_orders, _cleanup_external_stop_loss_tracking,
|