diff --git a/Multi-Period-Daily/User.bot.js b/Multi-Period-Daily/User.bot.js index deb44b58a..81812dbd7 100644 --- a/Multi-Period-Daily/User.bot.js +++ b/Multi-Period-Daily/User.bot.js @@ -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()); } diff --git a/Multi-Period-Market/User.bot.js b/Multi-Period-Market/User.bot.js index 2b52d158c..794009e16 100644 --- a/Multi-Period-Market/User.bot.js +++ b/Multi-Period-Market/User.bot.js @@ -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()); } diff --git a/this.bot.config.json b/this.bot.config.json index 20787be7f..7a1d30d9f 100644 --- a/this.bot.config.json +++ b/this.bot.config.json @@ -85,6 +85,7 @@ "retryWaitTime": 10000, "sleepWaitTime": 3600000, "comaWaitTime": 86400000, + "timePeriod": 1800000, "statusDependencies": [ { "devTeam": "AAVikings",