ccxt: Binance cancelOrder error
Hi, I’ve experienced the error when canceling the order `
[Exchange Error] binance: unknown error code: {“code”:-1102,“msg”:“Mandatory parameter ‘symbol’ was not sent, was empty/null, or malformed.”} -1102
`
The orderId is Valid, and provided symbol ‘VEN/BTC’
- OS: mac
- Programming Language version: JS
- CCXT version: 1.13.45
- Exchange: Binance
- Method: cancelOrder
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (13 by maintainers)
Good to hear that, Thanks for the explanation and the support for this case too.
@ccasselman no worries…
Yeah, we will add more to this aspect, hopefully soon… Until then you will have to choose extra params carefully, cause those are exchange-specific, contrary to the other (unified) arguments of a method.
Sure ) Binance error message says that their server does not see a required parameter in the request:
Though, the
symbolparameter was sent, here it is, right there, present in the body, as we saw in your verbose log:In this case we’ve been sending it in the request body, but Binance did not see it.
Basically my guess was that DELETE requests work for Node.js, Python and PHP people, but not for browser people. I needed to find a way to make Binance see those params when a DELETE request is sent from a browser…
Next, what I did is I went to Binance docs and noticed that they can handle DELETE params in two ways:
So, I took the default sign implementation for binance and changed the following line:
This tells CCXT to send all DELETE request parameters to Binance via URL query instead of the default HTTP request body. And it worked, from your own words. Surprise-surprise. So, now I want to thank you for helping me debug this, and I’m going to upload a fix that would not require any
signoverrides on your side (you can safely delete that snippet after you update to the upcoming fixed version). Hope this answers your question.Sorry, full code looked like this :