feat: dry-is-crossed should support stoploss

This commit is contained in:
Matthias
2025-11-19 19:52:16 +01:00
parent 73b427370b
commit ad256367be

View File

@@ -1254,13 +1254,14 @@ class Exchange:
limit: float, limit: float,
orderbook: OrderBook | None = None, orderbook: OrderBook | None = None,
offset: float = 0.0, offset: float = 0.0,
is_stop: bool = False,
) -> bool: ) -> bool:
if not self.exchange_has("fetchL2OrderBook"): if not self.exchange_has("fetchL2OrderBook"):
return True return True
if not orderbook: if not orderbook:
orderbook = self.fetch_l2_order_book(pair, 1) orderbook = self.fetch_l2_order_book(pair, 1)
try: try:
if side == "buy": if (side == "buy" and not is_stop) or (side == "sell" and is_stop):
price = orderbook["asks"][0][0] price = orderbook["asks"][0][0]
if limit * (1 - offset) >= price: if limit * (1 - offset) >= price:
return True return True