07.4.4.1.5 — Runtime Window Cleanup & Symbol Lifecycle Isolation
This commit is contained in:
@@ -22,6 +22,20 @@ class TrendStrategy:
|
||||
# основной таймфрейм анализа рынка
|
||||
_market_interval = "5m"
|
||||
|
||||
def reset_runtime(self, symbol: str | None = None) -> None:
|
||||
if symbol is None:
|
||||
self._price_window.clear()
|
||||
return
|
||||
|
||||
normalized_symbol = symbol.upper()
|
||||
keys_to_delete = [
|
||||
key for key in self._price_window.keys()
|
||||
if key.upper() == normalized_symbol
|
||||
]
|
||||
|
||||
for key in keys_to_delete:
|
||||
self._price_window.pop(key, None)
|
||||
|
||||
def analyze(self, context: StrategyContext) -> SignalResult:
|
||||
market = MarketAnalysisService().analyze(
|
||||
context.symbol,
|
||||
|
||||
Reference in New Issue
Block a user