diff --git a/Historic-Trades/User.Bot.js b/Historic-Trades/User.Bot.js index 723f04e2f..3809b54be 100644 --- a/Historic-Trades/User.Bot.js +++ b/Historic-Trades/User.Bot.js @@ -52,6 +52,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt let options let fetchType = "by Time" let lastId + let firstId /* Applying the parameters defined by the user at the Exchange node */ if (bot.exchangeNode.code.API !== undefined) { @@ -68,6 +69,9 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt 'fetchTradesMethod': bot.exchangeNode.code.API[i].fetchTradesMethod } } + if (bot.exchangeNode.code.API[i].firstId !== undefined) { + firstId = bot.exchangeNode.code.API[i].firstId + } } } } @@ -159,11 +163,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt const trades = await exchange.fetchTrades(symbol, since, limit, undefined) let lastRecord = trades[trades.length - 1] - lastId = lastRecord.info.f - - - //lastId = trades[trades.length - 1]['id'] - + lastId = lastRecord.info[firstId] } catch (err) { /* If something fails trying to get an id close to since, we just will continue without an id.*/ }