From 4c51a2cd71db62131cacc5a2af152b6fac75c912 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Mar 2020 17:57:58 +0100 Subject: [PATCH] Bug Fixed --- Historic-OHLCVs/User.Bot.js | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Historic-OHLCVs/User.Bot.js b/Historic-OHLCVs/User.Bot.js index 4877fef0d..2e1b06c5b 100644 --- a/Historic-OHLCVs/User.Bot.js +++ b/Historic-OHLCVs/User.Bot.js @@ -94,7 +94,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt 'secret': secret, 'timeout': 30000, 'enableRateLimit': true, - verbose: false, + verbose: true, options: options } if (rateLimit !== undefined) { @@ -365,16 +365,28 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt return } - let record = allOHLCVs[i] - let OHLCV = { - timestamp: record[0], - open: record[1], - hight: record[2], - low: record[3], - close: record[4], - volume: record[5] + let OHLCV = { // these values should be overrided unless there are no OHLVCs fetched from the exchange. + timestamp: (new Date()).valueOf() + ONE_MIN, + open: 0, + hight: 0, + low: 0, + close: 0, + volume: 0 } + let record = allOHLCVs[i] + + if (record !== undefined) { // can be undefined if there is no candle fetched from the exchange + OHLCV = { + timestamp: record[0], + open: record[1], + hight: record[2], + low: record[3], + close: record[4], + volume: record[5] + } + } + let candleMinute = Math.trunc(candle.begin / ONE_MIN) let OHLCVMinute