DeviaVir / zenbot

Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB.
MIT License
8.23k stars 2.03k forks source link

binance/exchange.js switches to full-ape mode and keeps retrying to execute an impossible order infinitely #1096

Open Orwi53 opened 6 years ago

Orwi53 commented 6 years ago

This morning I woke up to find out my bot betrayed me during sleep. In the logs, I found interminable repetitions of the following:

error1

To my understanding, my custom strategy wrongly tried to buy asset when it didn't have enough currency, and binance/exchange.js kept retrying to re-enact the wrongfully-posed order, infinitely.

By having a look at binance/exchange.js, it appears to me that the incriminating code is in the lines 179 and 223.

I would suggest something like changing:

return retry('buy', func_args)

into:

return cb(null, order)

So that, if for some reason that can be due to many factors, an impossible order is attempted, exchange.js doesn't retry it, instead, it waits for the next signal.

Any thoughts on this?

hoajb commented 6 years ago

under binance/exchange.js change line 158, 202 from if (result && result.message === 'Insufficient funds') {

to if (result && (result.message === 'Insufficient funds'||result.message === 'Filter failure: MIN_NOTIONAL')) {

DeviaVir commented 6 years ago

@hoajb why not PR that change?

hoajb commented 6 years ago

@DeviaVir sorry for my English. what do you mean "PR"? I'm newbie in zenbot. When I got error response, checked binance/exchange.js, i found the wrong condition.(Maybe binance API changed error message )=> So quick fix is add more check new error message. It work fine for me.

But i think better we should change condition to check error-code. This case is "code:-1013"

yoonhona commented 6 years ago

I am sorry for my English ability. I have this problem too. Same in Ubuntu OS. (Node -v: v8.9.4) There is no problem in Mac OS. (Node -v: v8.4.0)

ilap commented 6 years ago

Hi @hoajb,

PR means Pull Request.

Haehnchen commented 6 years ago

PR via #1123