07.4.4.1.5 — Runtime Window Cleanup & Symbol Lifecycle Isolation

This commit is contained in:
2026-05-11 12:06:00 +03:00
parent 363719cc8e
commit e17f847603
10 changed files with 323 additions and 14 deletions

View File

@@ -229,15 +229,28 @@ class AutoTradeService:
# установить инструмент
def set_symbol(self, symbol: str) -> AutoTradeState:
state = self.get_state()
previous_symbol = state.symbol
state.symbol = symbol
self._reset_signal_tracking()
StrategyRegistry.reset_runtime(symbol=previous_symbol)
StrategyRegistry.reset_runtime(symbol=symbol)
return state
# установить стратегию
def set_strategy(self, strategy: str) -> AutoTradeState:
state = self.get_state()
state.strategy = strategy.strip().upper()
previous_strategy = state.strategy
normalized_strategy = strategy.strip().upper()
state.strategy = normalized_strategy
self._reset_signal_tracking()
StrategyRegistry.reset_runtime(previous_strategy)
StrategyRegistry.reset_runtime(normalized_strategy)
return state
# установить риск
@@ -297,6 +310,13 @@ class AutoTradeService:
state.is_signal_ready = False
state.execution_block_reason = None
state.signal_started_at = None
state.market_state = None
state.market_trend = None
state.market_volatility = None
state.market_analysis_interval = None
state.market_analysis_reason = None
state.entry_block_reason = None
state.entry_block_message = None
# собрать контекст для стратегии
def _build_strategy_context(self) -> StrategyContext: