From 937bd892fd1583488c5cc5afb038407a6917de37 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 24 May 2025 10:23:35 +0200 Subject: [PATCH] fix: workaround for ccxt bybit stop_order bug --- freqtrade/exchange/bybit.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/freqtrade/exchange/bybit.py b/freqtrade/exchange/bybit.py index e45adf4bb..dfadee4b1 100644 --- a/freqtrade/exchange/bybit.py +++ b/freqtrade/exchange/bybit.py @@ -140,6 +140,21 @@ class Bybit(Exchange): params["position_idx"] = 0 return params + def _get_stop_params(self, side: BuySell, ordertype: str, stop_price: float) -> dict: + params = super()._get_stop_params( + side=side, + ordertype=ordertype, + stop_price=stop_price, + ) + # work around ccxt bug introduced in https://github.com/ccxt/ccxt/pull/25887 + # Where create_order ain't returning an ID any longer. + params.update( + { + "method": "privatePostV5OrderCreate", + } + ) + return params + def _order_needs_price(self, side: BuySell, ordertype: str) -> bool: # Bybit requires price for market orders - but only for classic accounts, # and only in spot mode