DeviaVir / zenbot

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

Zenbot not able to cancel orders #1542

Open ZeroCool940711 opened 6 years ago

ZeroCool940711 commented 6 years ago

System information

Describe the problem

I've been using zenbot for some time now and recently I noticed that zenbot was not able to cancel some orders, zenbot runs perfectly for the first few minutes but then after 10 or more minutes or some times before that it starts to fail when trying to cancel an order, Im on gdax, it keeps showing an error saying that the order was not found, maybe it has something to do with the recently changes to the gdax api, also that error continues to show after each line on the console making it pretty annoying, would be nice to have an option to log that to a file instead of showing it on the console.

Source code / Error logs

This is the part of the error that I could copy from the console, it was longer but I couldn't scroll more as my console has a limit on the amount of lines I can see. If there is a log file where I can get more from that error so I can copy it on pastebin or something it would be nice but I cant find any log file for zenbot.

_events: [Object], _eventsCount: 5, _maxListeners: undefined, headers: [Object], method: 'DELETE', uri: [Object], qsStringifyOptions: [Object], timeout: 10000, callback: [Function], readable: true, writable: true, explicitMethod: true, _qs: [Object], _auth: [Object], _oauth: [Object], _multipart: [Object], _redirect: [Object], _tunnel: [Object], setHeader: [Function], hasHeader: [Function], getHeader: [Function], removeHeader: [Function], localAddress: undefined, pool: {}, dests: [], __isRequestRequest: true, _callback: [Function], proxy: null, tunnel: true, setHost: true, originalCookieHeader: undefined, _disableCookies: true, _jar: undefined, port: 443, host: 'api.gdax.com', path: '/orders/bb0034c3-e927-4966-8b8c-c69c066bd6', httpModule: [Object], agentClass: [Object], agent: [Object], _started: true, href: 'https://api.gdax.com/orders/bb0034c3-e927-4966-8b8c-c69c066bd6', req: [Object], ntick: true, timeoutTimer: null, response: [Circular], originalHost: 'api.gdax.com', originalHostHeaderName: 'host', responseContent: [Circular], _destdata: true, _ended: true, _callbackCalled: true }, toJSON: [Function: responseToJSON], caseless: Caseless { dict: [Object] }, read: [Function], body: '{"message":"order not found"}' }, data: { message: 'order not found' } } [ { order_id: 'bb0034c3-e927-4966-8b8c-c69c066bd6', product_id: 'ETH-USD' } ]

Have a good day/night and thanks for the time, hope this problem can be fixed.

blevok commented 6 years ago

I also noticed this happening a lot, both in sim and live trading. It'll just keep triggering actions every period, but it doesn't make any more trades.

sim cancel_failed_sim

trade cancel_failed_trade

edit: just noticed this is the same as #1514

fdk0 commented 6 years ago

Try specify the --conf="./conf.js", it worked for me for the same error on GDAX. Also specify it at the beginning of the command after trade or sim. This happen on sell cancel not on buy cancel at least in my case.. This is just a workaround but hope this helps.

ZeroCool940711 commented 6 years ago

Hi @fdk0 , I tried what you said on your comment and for some reason it worked .-. , I used the same conf.js that I had before just added the command as you suggested, I now have another problem but I think I should create a new issue here and get help with that specific problem but just in case gonna write it here, maybe someone can help, the problem is that now zenbot started to show an error saying that I dont have enough funds when I do have enough money to buy the amount its trying to buy, after some time that error started to be a bit annoying as zenbot is not making any trade and the console output is only showing that error and I cant see anything else, would be nice to be able to suppress that error or receive less information about it as the whole error output takes too much space on the console, here is the error output on pastebin, zenbot is trying to buy 13.03888186 ETH at a price of 431.56 USD, it would a total of $5,627.06 my current balance is 5683.89 USD , so, I do have the money to buy that amount but zenbot says I dont have enough funds for some reason. Thanks for the time and hope all this helps someone else having the same problems.

blevok commented 6 years ago

@fdk0 I just tried this, but it didn't work unfortunately. I'm still getting: 2018-03-29 16:56:59 - placing buy order... 2018-03-29 16:57:00 - buy order placed at 7063.02 USD 2018-03-29 16:57:00 - signal switched during sell, aborting 2018-03-29 16:57:01 - cancel failed, order done, executing 2018-03-29 16:57:05 - signal switched during buy, aborting 2018-03-29 16:57:05 - cancel failed, order done, executing

And yeah, it's only when selling that i've seen it get stuck, meaning the signal that i see is "selling". However, the debug output is kinda confusing. It looks like it's buying, then trying to sell and failing, then trying to buy again, even though it already bought, and failing, and that all happens in a few seconds. Then it starts a never ending attempt to sell, until the signal switches, and then it starts a never ending attempt to buy. So it just won't make any trades after this happens, regardless of conditions being met and signals being sent.

ZeroCool940711 commented 6 years ago

Guys, I'm having this problem again, it was temporarily fixed by using the workaround @fdk0 mentioned before but now its back again, zenbot is not able to cancel some orders on gdax, also is throwing a lot of errors about insufficient funds even if you have enough fund for the order its trying to place.

fdk0 commented 6 years ago

@blevok I still run the bot with --conf="./conf.js" and it works fine I am live 24/7 with latest unstable and no error since a month or more. The only other thing I had to do was disable IP whitelist on GDAX.. I don't know if that's the case.. I am sorry I cannot help you to solve this but I have no coding skills so I wouldn't know what to change, just trial and error..

Good luck.

fdk0 commented 6 years ago

btw I am not sure if this is a zenbot problem or a gdax module's one, since I first got the problem after gdax 0.7 update.