DeviaVir / zenbot

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

ESOCKETTIMEDOUT on Poloniex while syncing balance (trades too). #1670

Open h311m4n opened 6 years ago

h311m4n commented 6 years ago

Hello,

I've launched a bot on Poloniex with a small amount of funds to try it out on the BTC-USDT pair. It made it's first trade and bought USDT. Zenbot running on an Ubuntu 16.04 vm.

Using node.js 8.11.3

However, I'm getting errors likes these at a few minutes interval:

2018-07-22 10:50:14 - error syncing balance
{ Error: ESOCKETTIMEDOUT
    at ClientRequest.<anonymous> (/home/user/zenbot/node_modules/poloniex.js/node_modules/request/request.js:812:19)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
    at ClientRequest.emit (events.js:208:7)
    at TLSSocket.emitTimeout (_http_client.js:706:34)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket.Socket._onTimeout (net.js:410:8)
    at ontimeout (timers.js:498:11) code: 'ESOCKETTIMEDOUT', connect: false }

However it does get the correct USDT balance from my polo account on the GUI. I'm getting similar errors for getting trades etc. And when I relaunch the bot, I have no trade history on the GUI (don't know if this is normal or not?).

When I relaunch the bot, all is fine, but after say 10mins, I start getting these timeouts. It seems to crash after a while with a nonce error.

I'm a complete node.js noob so this doesn't really speak to me. What I've tried:

New api key+secret: no difference Checked my firewall (running pfsense at home): nothing is getting blocked DNS requests seem to work fine from the linux box

Can someone advise on what needs to be done? I've googled around but nothing specific to this error with Zenbot and Poloniex.

Thanks!

h311m4n commented 6 years ago

I've made the following change in node_modules/poloniex.js/lib/poloniex.js:

options.json = true;
      options.headers['User-Agent'] = Poloniex.USER_AGENT;
      options.strictSSL = Poloniex.STRICT_SSL;
      options.timeout = 60 * 2000;

Before it was 60*1000, I'm not sure if it fixes the problem or what exact consequences this may have. However the bot has been running for 20mins now without any timeout occuring.

h311m4n commented 6 years ago

Ok, so the bot has now been running for over a day and I haven't seen these timeout issues again.

I do however, every now and then get the infamous nonce error where is says nonce is x and I provided y. The difference between the 2 nonce is 2000.

I've google this quite extensively but I'm not sure of what fix should be applied? I read some people where advancing their clocks a few seconds to counter this, sounds a bit edgy though, especially for bot trading.

Also read to create new API+Key pair, should I try this once more? These nonce errors are popping up every now and then but it seems not in a constant manner (like not every x minutes).

Any insight welcome!

Enelar commented 6 years ago

Hey @h311m4n , im trying to run bot for the first time. It keeps showing same blue timestamp. Is it running? 2018-07-31 04:26:56 now its 4:33. I've tried run it several times, no effect.

Its not the same, but still poloniex.