jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 767 forks source link

Error: ETIMEDOUT #48

Closed bitcoinvsalts closed 6 years ago

bitcoinvsalts commented 6 years ago

I am getting those errors lately any idea why?

/app/node-binance-api.js:42
2018-01-10T18:12:43.896798+00:00 app[web.1]:            if ( !response || !body ) throw 'publicRequest error: '+error;
2018-01-10T18:12:43.896799+00:00 app[web.1]:                                      ^
2018-01-10T18:12:43.896825+00:00 app[web.1]: publicRequest error: Error: ETIMEDOUT
jaggedsoft commented 6 years ago

Could you try updating to the latest version?

bitcoinvsalts commented 6 years ago

I am still getting those ETIMEDOUT errors with the new code version

node-binance-api.js:42
                        if ( error ) throw error;
                                     ^
Error: ETIMEDOUT
jaggedsoft commented 6 years ago

Hmmm. I am not sure as to why. The only thing I can think of is maybe opening too many websocket connections too quickly could get your IP temporarily banned. If this is the case you need to add a 150-250ms delay between each new connection being opened

bitcoinvsalts commented 6 years ago

I dont think it's the issue I wait 2 sec between my api request. If I restart the code right after the issue, it runs normally until a few minutes and I get the issue again. When I am banned, it does allow me to run it for a few minutes.

On Wed, Jan 10, 2018 at 4:27 PM, Jon Eyrick notifications@github.com wrote:

Hmmm. I am not sure as to why. The only thing I can think of is maybe opening too many websocket connections too quickly could get your IP temporarily banned. If this is the case you need to add a 150-250ms delay between each new connection being opened

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jaggedsoft/node-binance-api/issues/48#issuecomment-356758408, or mute the thread https://github.com/notifications/unsubscribe-auth/AM0R9WkCWJwShdFlwoFOoi2SwotUxY44ks5tJTlCgaJpZM4RZvA- .

-- Hervé Fulchiron JSapp.me

bitcoinvsalts commented 6 years ago

I dont know if helps but I am getting this issue running this part of the code:

publicRequest(base+'v1/depth', {symbol:symbol, limit:limit}, function(json) { if ( messageQueue && typeof messageQueue[symbol] === 'object' ) { info[symbol].firstUpdateId = json.lastUpdateId; depthCache[symbol] = depthData(json); for ( let depth of messageQueue[symbol] ) { depthHandler(depth, json.lastUpdateId); } delete messageQueue[symbol]; if ( callback ) callback(symbol, depthCache[ symbol]); } });

On Wed, Jan 10, 2018 at 4:29 PM, Herve Fulchiron herve76@gmail.com wrote:

I dont think it's the issue I wait 2 sec between my api request. If I restart the code right after the issue, it runs normally until a few minutes and I get the issue again. When I am banned, it does allow me to run it for a few minutes.

On Wed, Jan 10, 2018 at 4:27 PM, Jon Eyrick notifications@github.com wrote:

Hmmm. I am not sure as to why. The only thing I can think of is maybe opening too many websocket connections too quickly could get your IP temporarily banned. If this is the case you need to add a 150-250ms delay between each new connection being opened

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jaggedsoft/node-binance-api/issues/48#issuecomment-356758408, or mute the thread https://github.com/notifications/unsubscribe-auth/AM0R9WkCWJwShdFlwoFOoi2SwotUxY44ks5tJTlCgaJpZM4RZvA- .

-- Hervé Fulchiron JSapp.me

-- Hervé Fulchiron JSapp.me

bitcoinvsalts commented 6 years ago

it seems putting a limit to 100 for the depthcache solves my issue

bitcoinvsalts commented 6 years ago

Hi Jon,

I know why I am getting those timeout issues. I am running more than 200 websockets (started every 1sec) and it seems after a while I am getting internal performance issues that create those timeout issues. I am kind of surprised by this idea because my computer does not show any heavy use of the hardware (neither memory neither cpu neither my bandwidth) I am guessing it's more like a port/network limit. I tried it on some of my other machines but I am also getting those issues around 200. I am wondering how many maximum concurrent websockets do you open at once?

Not related. I am big fan of your repo and I plan to use it a lot. I am a full stack JS developer and I just finished a long react native project. As you can see on my page https://jsapp.me/, I was more a react/react native dev guy before but I am trying to transition to offer full stack node.js + binance dev and expertise. I know you are busy these days. If you get some contacts on your repo for dev work using your repo, I am very available. Feel free to redirect them to me.

Thanks again for your good work.

HF

On Wed, Jan 10, 2018 at 4:39 PM, Herve Fulchiron herve76@gmail.com wrote:

I dont know if helps but I am getting this issue running this part of the code:

publicRequest(base+'v1/depth', {symbol:symbol, limit:limit}, function(json) { if ( messageQueue && typeof messageQueue[symbol] === 'object' ) { info[symbol].firstUpdateId = json.lastUpdateId ; depthCache[symbol] = depthData(json); for ( let depth of messageQueue[symbol] ) { depthHandler(depth, json.lastUpdateId); } delete messageQueue[symbol]; if ( callback ) callback(symbol, depthCache[ symbol]); } });

On Wed, Jan 10, 2018 at 4:29 PM, Herve Fulchiron herve76@gmail.com wrote:

I dont think it's the issue I wait 2 sec between my api request. If I restart the code right after the issue, it runs normally until a few minutes and I get the issue again. When I am banned, it does allow me to run it for a few minutes.

On Wed, Jan 10, 2018 at 4:27 PM, Jon Eyrick notifications@github.com wrote:

Hmmm. I am not sure as to why. The only thing I can think of is maybe opening too many websocket connections too quickly could get your IP temporarily banned. If this is the case you need to add a 150-250ms delay between each new connection being opened

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jaggedsoft/node-binance-api/issues/48#issuecomment-356758408, or mute the thread https://github.com/notifications/unsubscribe-auth/AM0R9WkCWJwShdFlwoFOoi2SwotUxY44ks5tJTlCgaJpZM4RZvA- .

-- Hervé Fulchiron JSapp.me

-- Hervé Fulchiron JSapp.me

-- Hervé Fulchiron JSapp.me

jaggedsoft commented 6 years ago

Thank you for your kind words, love to hear it. Will do! :)

I have no answer for you on the maximum connections, I'm able to open one websocket for every symbol on binance, but haven't tested too much beyond that. I'll look in to it and test everything as soon as I can

bitcoinvsalts commented 6 years ago

one websocket for every symbol, so it's more than 200 ?

HF

On Fri, Jan 12, 2018 at 3:21 PM, Jon Eyrick notifications@github.com wrote:

Thank you for your kind words, love to hear it. Will do! :)

I have no answer for you on the maximum connections, I'm able to open one websocket for every symbol on binance, but haven't tested too much beyond that. I'll look in to it and test everything as soon as I can

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jaggedsoft/node-binance-api/issues/48#issuecomment-357357355, or mute the thread https://github.com/notifications/unsubscribe-auth/AM0R9bLSt8lF1XGRs_Pcw2G5ClSNFCHsks5tJ8zEgaJpZM4RZvA- .

-- Hervé Fulchiron JSapp.me