first id field parametrizied

This commit is contained in:
Luis Fernando Molina committed 2020-01-28 11:03:05 +01:00
1 parent 04d99839ba
commit 8256563a4e
1 file changed
+5 -5
+5 -5
View File
@@ -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.*/
}