Adding fix for undefined when checking head of market
This commit is contained in:
1 parent
05b290b3b5
commit
fb00ed716e
3 files changed
+15
-3
No files matched your search
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
"retryWaitTime": 10000,
|
||||
"sleepWaitTime": 3600000,
|
||||
"comaWaitTime": 86400000,
|
||||
"timePeriod": 1800000,
|
||||
"statusDependencies": [
|
||||
{
|
||||
"devTeam": "AAVikings",
|
||||
|
||||
Reference in new issue
Block a user