Adding fix for undefined when checking head of market

This commit is contained in:
Matias Benitez committed 2018-07-21 11:46:48 -03:00
1 parent 05b290b3b5
commit fb00ed716e
3 files changed
+15 -3

No files matched your search

+6 -1
View File
@@ -309,6 +309,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, BLOB_S
function isExecutionOnHeadOfMarket() {
let candleBeginIndex = 4;
let lastCandlePeriodOnCache;
let lastDayIndex = 10 + '/' + executionTime.getUTCFullYear() + "/" + utilities.pad(executionTime.getUTCMonth() + 1, 2) + "/" + utilities.pad(executionTime.getUTCDate(), 2);
if (!dailyFileCache.has(lastDayIndex)) {
@@ -316,7 +317,11 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, BLOB_S
}
let currentFile = dailyFileCache.get(lastDayIndex);
let lastCandlePeriodOnCache = currentFile[currentFile.length - 1][candleBeginIndex];
if(currentFile === undefined || currentFile[currentFile.length - 1] === undefined)
return false;
else
lastCandlePeriodOnCache = currentFile[currentFile.length - 1][candleBeginIndex];
return (executionTime.valueOf() >= lastCandlePeriodOnCache.valueOf());
}
+8 -2
View File
@@ -309,12 +309,18 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, BLOB_S
function isExecutionOnHeadOfMarket() {
let candleBeginIndex = 4;
if (!marketFileCache.has(7)) {
let lastCandlePeriodOnCache;
if (!marketFileCache.has(7)) {
return false;
}
let currentFile = marketFileCache.get(7);
let lastCandlePeriodOnCache = currentFile[currentFile.length - 1][candleBeginIndex];
if(currentFile === undefined || currentFile[currentFile.length - 1] === undefined)
return false;
else
lastCandlePeriodOnCache = currentFile[currentFile.length - 1][candleBeginIndex];
return (executionTime.valueOf() >= lastCandlePeriodOnCache.valueOf());
}
+1
View File
@@ -85,6 +85,7 @@
"retryWaitTime": 10000,
"sleepWaitTime": 3600000,
"comaWaitTime": 86400000,
"timePeriod": 1800000,
"statusDependencies": [
{
"devTeam": "AAVikings",