mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-14 20:01:18 +00:00
feat: dry-is-crossed should support stoploss
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user