feat: immediately triggering stoploss orders should cause emergency exits

closes #12824
This commit is contained in:
Matthias
2026-02-15 16:12:13 +01:00
parent a42c8faeca
commit c999de6291

View File

@@ -1301,6 +1301,7 @@ class Exchange:
Check dry-run limit order fill and update fee (if it filled).
"""
if order["status"] != "closed" and order.get("ft_order_type") == "stoploss":
# Stoploss branch
pair = order["symbol"]
if not orderbook and self.exchange_has("fetchL2OrderBook"):
orderbook = self.fetch_l2_order_book(pair, 20)
@@ -1308,6 +1309,11 @@ class Exchange:
crossed = self._dry_is_price_crossed(
pair, order["side"], price, orderbook, is_stop=True
)
if crossed and immediate:
raise InvalidOrderException(
"Could not create dry stoploss order. Stoploss would trigger immediately."
)
if crossed:
average = self.get_dry_market_fill_price(
pair,