Error when calling batch_cancel

I’m not sure what I’m doing wrong here but I can’t seem to be able to cancel orders. I can make orders, make Websocket connections, and access all other REST API endpoints just fine (although I haven’t tested Edit Order yet), it’s only when I try to cancel an active order that I get the following error:

{
 'error': 'unknown',
 'error_details': 'proto:\xa0syntax error (line 1:1): unexpected token "{\\"order_ids\\": [\\"XXXXXXXXXX\\"]}"',
 'message': 'proto:\xa0syntax error (line 1:1): unexpected token "{\\"order_ids\\": [\\"XXXXXXXXXX\\"]}"'
}

It’s odd because of the escaped quotes, no other responses I’ve ever received from the server, including errors, have escaped quotes.

payload = json.dumps({"order_ids": ["XXXXXXX"]})
return cb_auth(Method.POST.value, "/api/v3/brokerage/orders/batch_cancel", payload)

Again, I can place orders just fine so I know my headers are valid.

Please let me know if I can provide anything else that might help to solve this.

Thank you.

1 Like

Can you post how generated payload looks as string?

EDIT: Or maybe small code that can be used to reproduce problem? For me that endpoint seems to work…

Thank you so much for your quick reply and sorry for my late reply. I just realized I had json.dumps() when setting the payload and I don’t know why I had it that way. It works now, thank you.

2 Likes