fix: workaround for ccxt bybit stop_order bug

This commit is contained in:
Matthias
2025-05-24 10:23:35 +02:00
parent adce6e4f68
commit 937bd892fd

View File

@@ -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