python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

how to cancel OCO order with orderListId

Open adnan-ulhaque opened this issue 2 years ago • 2 comments

Describe the bug --Trying to CACCEL OCO order with following commands result = client.cancel_order(symbol=TRADE_SYMBOL,orderListId=10035) --it seems issue with orderListId argument. logs for OCO order (pasted in the last) showing orderListId=10035. --following error received. error from callback <function on_message at 0x0000023B2820C700>: APIError(code=-1104): Not all sent parameters were read; read '3' parameter(s) but was sent '4'.

To Reproduce result = client.cancel_order(symbol=TRADE_SYMBOL,orderListId=a)

Expected behavior cancel the OCO order. it seems issue is how to pass orderListId

Environment (please complete the following information):

  • Python version: $ python -V Python 3.9.5
  • OS: Windows 10, gitbash

Logs or Additional context { "symbol": "BTCUSDT", "orderId": 5676213, "orderListId": 10035, "clientOrderId": "wH0PkOkJ83mxRnKDVCPGxk", "price": "41845.69000000", "origQty": "0.00035100", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "NEW", "timeInForce": "GTC", "type": "STOP_LOSS_LIMIT", "side": "SELL", "stopPrice": "41845.69000000", "icebergQty": "0.00000000", "time": 1632553383102, "updateTime": 1632553383102, "isWorking": false, "origQuoteOrderQty": "0.00000000" }, { "symbol": "BTCUSDT", "orderId": 5676214, "orderListId": 10035, "clientOrderId": "UaLXJE6SXJq50b9aR7TXZK", "price": "42828.10000000", "origQty": "0.00035100", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT_MAKER", "side": "SELL", "stopPrice": "0.00000000", "icebergQty": "0.00000000", "time": 1632553383102, "updateTime": 1632553383102, "isWorking": true, "origQuoteOrderQty": "0.00000000" }

adnan-ulhaque avatar Sep 25 '21 08:09 adnan-ulhaque

you have to occupy orderId I cancel "type": "STOP_LOSS_LIMIT" and both are canceled

order = client.cancel_order(symbol=Symbol, orderId=Orden_ID)

ddroguett avatar Oct 02 '21 06:10 ddroguett

Describe the bug --Trying to CACCEL OCO order with following commands result = client.cancel_order(symbol=TRADE_SYMBOL,orderListId=10035) --it seems issue with orderListId argument. logs for OCO order (pasted in the last) showing orderListId=10035. --following error received. error from callback <function on_message at 0x0000023B2820C700>: APIError(code=-1104): Not all sent parameters were read; read '3' parameter(s) but was sent '4'.

To Reproduce result = client.cancel_order(symbol=TRADE_SYMBOL,orderListId=a)

Expected behavior cancel the OCO order. it seems issue is how to pass orderListId

Environment (please complete the following information):

* Python version:
  $ python -V
  Python 3.9.5

* OS: Windows 10, gitbash

Logs or Additional context { "symbol": "BTCUSDT", "orderId": 5676213, "orderListId": 10035, "clientOrderId": "wH0PkOkJ83mxRnKDVCPGxk", "price": "41845.69000000", "origQty": "0.00035100", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "NEW", "timeInForce": "GTC", "type": "STOP_LOSS_LIMIT", "side": "SELL", "stopPrice": "41845.69000000", "icebergQty": "0.00000000", "time": 1632553383102, "updateTime": 1632553383102, "isWorking": false, "origQuoteOrderQty": "0.00000000" }, { "symbol": "BTCUSDT", "orderId": 5676214, "orderListId": 10035, "clientOrderId": "UaLXJE6SXJq50b9aR7TXZK", "price": "42828.10000000", "origQty": "0.00035100", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT_MAKER", "side": "SELL", "stopPrice": "0.00000000", "icebergQty": "0.00000000", "time": 1632553383102, "updateTime": 1632553383102, "isWorking": true, "origQuoteOrderQty": "0.00000000" }

did you find a solution for this? I'm trying to use cancel_margin_oco_order() but I'm getting this error when sending it the orderid

cls.client.cancel_margin_oco_order(
                    symbol=symbol,
                    orderId=orderid)

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

But the documentation doesn't say where I can get orderListId or listClientOrderId

Karlheinzniebuhr avatar Jul 17 '22 20:07 Karlheinzniebuhr