How to use the node-binance-api.sortBids function in node-binance-api

To help you get started, we’ve selected a few node-binance-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bmino / binance-triangle-arbitrage / routes / BinanceController.js View on Github external
binance.websockets.depthCache(tickers, function(symbol, depth) {
        var bids = binance.sortBids(depth.bids);
        var asks = binance.sortAsks(depth.asks);
        var askDepth = Object.keys(asks).length;
        var bidDepth = Object.keys(bids).length;
        var index = UNFILLED.indexOf(symbol);

        if (askDepth < MIN_THRESHOLD && bidDepth < MIN_THRESHOLD) {
            if (!isPresent(index)) {
                UNFILLED.push(symbol);
                console.log('Added ' + symbol + ' (' + askDepth + '/' + bidDepth + ') - ' + UNFILLED.length);
            }
        } else if (isPresent(index)) {
            UNFILLED.splice(index, 1);
            console.log('Removed ' + symbol + ' (' + askDepth + '/' + bidDepth + ') - ' + UNFILLED.length);
        }

        sockets.emit('depth:new', {