diff --git a/MultiPeriodMarket.js b/MultiPeriodMarket.js index 85002e5eb..3e29f55f7 100644 --- a/MultiPeriodMarket.js +++ b/MultiPeriodMarket.js @@ -57,6 +57,15 @@ const timeFrame = global.marketFilesPeriods[n][0] const timeFrameLabel = global.marketFilesPeriods[n][1] + /* Check Time Frames Filter */ + if (bot.marketTimeFrames !== undefined) { + if (bot.marketTimeFrames.includes(timeFrameLabel) === false) { + /* We are not going to process this Time Frame */ + timeFramesControlLoop() + return + } + } + let dependencyIndex = 0; dataFiles = new Map; @@ -69,15 +78,8 @@ getFile() function getFile() { - let dateForPath = bot.processDatetime.getUTCFullYear() + '/' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.processDatetime.getUTCDate(), 2) let fileName = "Data.json"; - - let filePath - if (dependency.referenceParent.config.codeName === "Multi-Period-Market") { - filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel; - } else { - filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + dateForPath; - } + let filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel; datasetModule.getTextFile(filePath, fileName, onFileReceived) function onFileReceived(err, text) { @@ -138,6 +140,9 @@ let thisReport = statusDependencies.statusReports.get(reportKey) thisReport.file.lastExecution = bot.processDatetime; + if (bot.marketTimeFrames !== undefined) { + thisReport.file.timeFrames = bot.marketTimeFrames + } thisReport.save(callBack) if (global.areEqualDates(bot.processDatetime, new Date()) === false) { diff --git a/ProcessOutput.js b/ProcessOutput.js index 2130a7cf6..f9cb330d1 100644 --- a/ProcessOutput.js +++ b/ProcessOutput.js @@ -14,7 +14,7 @@ return thisObject; - function raiseEvents(lastFile, callBackFunction) { + function raiseEvents(lastFile, timeFrames, callBackFunction) { try { if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] raiseEvents -> Entering function."); } @@ -83,7 +83,8 @@ key = dataMine + "-" + botName + "-" + product + "-" + dataset + "-" + bot.exchange + "-" + bot.market.baseAsset + '/' + bot.market.quotedAsset let event = { - lastFile: lastFile + lastFile: lastFile, + timeFrames: timeFrames } global.EVENT_SERVER_CLIENT.createEventHandler(key, 'Dataset Updated') global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Dataset Updated', event) diff --git a/Root.js b/Root.js index 5349465ce..06b1fe77b 100644 --- a/Root.js +++ b/Root.js @@ -225,6 +225,12 @@ /* Bot Type */ botConfig.type = global.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.type + /* Time Frame Filter */ + if (global.TASK_NODE.bot.timeFramesFilter !== undefined) { + botConfig.dailyTimeFrames = global.TASK_NODE.bot.timeFramesFilter.config.dailyTimeFrames + botConfig.marketTimeFrames = global.TASK_NODE.bot.timeFramesFilter.config.marketTimeFrames + } + if (botConfig.processNode) { if (botConfig.processNode.marketReference) { if (botConfig.processNode.marketReference.keyReference !== undefined) { diff --git a/StatusReport.js b/StatusReport.js index ff40b4e74..4da076767 100644 --- a/StatusReport.js +++ b/StatusReport.js @@ -334,7 +334,7 @@ let processOutput = PROCESS_OUTPUT.newProcessOutput(bot, logger) - processOutput.raiseEvents(thisObject.file.lastFile, callBackFunction); + processOutput.raiseEvents(thisObject.file.lastFile, thisObject.file.timeFrames, callBackFunction); return; }