sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.96k stars 2.19k forks source link

Unable to cancel an OCO order #1221

Closed Karlheinzniebuhr closed 2 years ago

Karlheinzniebuhr commented 2 years ago

I'm trying to cancel an OCO order

client.cancel_margin_oco_order(
                    symbol=symbol,
                    clientOrderId=clientOrderId,
                    listClientOrderId=listClientOrderId)

but it gives me this error APIError(code=-2011): Unknown order list sent. Also tried

client.cancel_margin_oco_order(
                    symbol=symbol,
                    clientOrderId=clientOrderId)

Which gives APIError(code=-11016): Either orderListId or listClientOrderId must be provided. And

client.cancel_margin_oco_order(
                    symbol=symbol,
                    listClientOrderId=listClientOrderId)

Which also gives APIError(code=-2011): Unknown order list sent.

Is there any way to cancel an OCO order?

Karlheinzniebuhr commented 2 years ago

fixed by calling it like this

client.cancel_margin_oco_order(
                    symbol=symbol,
                    orderId=orderId,
                    listClientOrderId=listClientOrderId,
                    isIsolated=isIsolated)