fix: initialize adaptive rules for legacy exits

This commit is contained in:
Курнат Андрей
2026-07-15 00:40:45 +03:00
parent 2967cd607c
commit f7a625586e
3 changed files with 39 additions and 1 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
"""Crypto spot trading bot package."""
__version__ = "1.0.2"
__version__ = "1.0.3"
+2
View File
@@ -371,6 +371,7 @@ class SpotStrategy:
latest = candles[-1]
previous = candles[-2] if len(candles) >= 2 else latest
price = ticker.last_price
adaptive = _adaptive_rules(learning or {})
trailing = position.trailing_stop(self.settings.trailing_stop_percent)
diagnostics = {
"price": price,
@@ -383,6 +384,7 @@ class SpotStrategy:
"rsi_14": latest.rsi_14,
"ema_20": latest.ema_20,
"ema_50": latest.ema_50,
"adaptive_rules": adaptive,
}
if self.settings.stop_loss_exit_enabled and price <= position.stop_loss:
return Signal(position.symbol, "SELL", 1.0, "сработал стоп-лосс", diagnostics)