binance-exchange / node-binance-api

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

ESOCKETTIMEDOUT error #99

Closed tmyerskerry closed 5 years ago

tmyerskerry commented 6 years ago

I am using the chart method. Maybe I'm subscribing too many in one go so I need to throttle them somehow.

In any case do you might need to add some error handling when handling callback as its passing empty object to klineData function.

Error

node_modules/node-binance-api/node-binance-api.js:395 for ( let tick of ticks ) { ^

TypeError: undefined is not a function

=======================================================

let getSymbolKlineSnapshot = function(symbol) { publicRequest(base + 'v1/klines', { symbol:symbol, interval:interval }, function (error, data) { klineData(symbol, interval, data); //options.log('/klines at ' + info[symbol][interval].timestamp); if ( typeof klineQueue[symbol][interval] !== 'undefined' ) { for ( let kline of klineQueue[symbol][interval] ) klineHandler(symbol, kline, info[symbol][interval].timestamp); delete klineQueue[symbol][interval]; } if ( callback ) callback(symbol, interval, klineConcat(symbol, interval)); }); };

jaggedsoft commented 6 years ago

I think this will be fixed automatically with https://github.com/jaggedsoft/node-binance-api/issues/110

keith1024 added combined websocket streams which are awesome, but I could see potential problems in certain situations:

bkrypt commented 6 years ago

Agreed, internal rate limiting is something the library still needs. Just a tiny correction, the default limit of depthCache is 500, giving it a weight of 5 and not the highest weight of 10. Sure, the weight is still high but I thought it was worth pointing out since it doubles the number of requests in question.