How to use the node-binance-api.candlesticks 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 andresilvasantos / bitprophet / exchange_utils.js View on Github external
chartUpdate: function(pairName, interval, next) {
        binance.candlesticks(pairName, interval, function(error, ticks, pairName) {
            next(error, pairName, ticks)
        })
    },
    startChartUpdate: function(pairName, interval, next) {
github bmino / trading-with-trends / src / main / service / MarketDataService.js View on Github external
let candlesPromise = new Promise((resolve, reject) => {
            let options = {
                limit: limit,
                endTime: typeof endTime === 'number' ? endTime : endTime.getTime()
            };

            binance.candlesticks(ticker, interval, (error, ticks, symbol) => {
                if (error) return reject(error);
                let candles = ticks.map(tick => {
                    let [time, open, high, low, close, volume, closeTime, assetVolume, trades, buyBaseVolume, buyAssetVolume, ignored] = tick;
                    return {
                        time: time,
                        ticker: symbol,
                        open: parseFloat(open),
                        high: parseFloat(high),
                        low: parseFloat(low),
                        close: parseFloat(close),
                        volume: parseFloat(volume),
                        trades: trades,
                        final: true,
                        backfilled: true
                    };
                });