diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js index 5e62afa0e..eb41b9175 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js @@ -869,7 +869,7 @@ let reportKey = "Masters" + "-" + "Bollinger-Bands" + "-" + "Multi-Period-Daily" let thisReport = statusDependencies.statusReports.get(reportKey); - thisReport.file.lastExecution = bot.processDatetime; + thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME; thisReport.file.lastFile = lastFileDate; thisReport.file.beginingOfMarket = beginingOfMarket.toUTCString() thisReport.save(callBack); diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js index 29eb8f6f6..cd4818e4c 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js @@ -466,16 +466,16 @@ let reportKey = "Masters" + "-" + "Bollinger-Bands" + "-" + "Multi-Period-Market" let thisReport = statusDependencies.statusReports.get(reportKey); - thisReport.file.lastExecution = bot.processDatetime; + thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME; thisReport.save(callBack); - if (TS.projects.superalgos.utilities.dateTimeFunctions.areTheseDatesEqual(bot.processDatetime, new Date()) === false) { - logger.newInternalLoop(bot.processDatetime); + if (TS.projects.superalgos.utilities.dateTimeFunctions.areTheseDatesEqual(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME, new Date()) === false) { + logger.newInternalLoop(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME); } /* Telling the world we are alive and doing well */ - let currentDateString = bot.processDatetime.getUTCFullYear() + '-' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '-' + utilities.pad(bot.processDatetime.getUTCDate(), 2); - let currentDate = new Date(bot.processDatetime) + let currentDateString = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCFullYear() + '-' + utilities.pad(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' + utilities.pad(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCDate(), 2); + let currentDate = new Date(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME) let lastDate = new Date() TS.projects.superalgos.functionLibraries.processFunctions.processHeartBeat(processIndex, currentDateString, TS.projects.superalgos.utilities.dateTimeFunctions.getPercentage(currentDate, currentDate, lastDate)) } diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js index ee8229a5c..6b47d9fd7 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js @@ -789,7 +789,7 @@ Read the candles and volumes from Exchange Raw Data and produce a file for each let reportKey = "Masters" + "-" + "Candles-Volumes" + "-" + "Multi-Period-Daily" let thisReport = statusDependencies.statusReports.get(reportKey); - thisReport.file.lastExecution = bot.processDatetime; + thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME; thisReport.file.lastFile = lastFileDate; thisReport.file.beginingOfMarket = beginingOfMarket.toUTCString() thisReport.save(callBack); diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js index 7779fbffe..fc7af3c15 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js @@ -907,7 +907,7 @@ let reportKey = "Masters" + "-" + "Candles-Volumes" + "-" + "Multi-Period-Market" let thisReport = statusDependencies.statusReports.get(reportKey); - thisReport.file.lastExecution = bot.processDatetime; + thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME; thisReport.file.lastFile = lastFileDate; thisReport.file.beginingOfMarket = beginingOfMarket.toUTCString() thisReport.save(callBack); diff --git a/Projects/Superalgos/TS/Globals/ProcessVariables.js b/Projects/Superalgos/TS/Globals/ProcessVariables.js index 569592c3e..1fc3e9857 100644 --- a/Projects/Superalgos/TS/Globals/ProcessVariables.js +++ b/Projects/Superalgos/TS/Globals/ProcessVariables.js @@ -27,6 +27,7 @@ exports.newSuperalgosGlobalsProcessVariables = function () { IS_SESSION_RESUMING This tell us if a session is resuming from the state at the previous execution. IS_SESSION_FIRST_LOOP This tell us if we are at the execution of the first loop of the bot related to this session. SIMULATION_STATE This is the state of a simulaation, as it is loaded from disk. + PROCESS_DATETIME When processing daily files, this holds the date of the file being processed. */ return thisObject } \ No newline at end of file diff --git a/TaskServer/DebugLog.js b/TaskServer/DebugLog.js index e1b2ad8fa..7cad3a8fc 100644 --- a/TaskServer/DebugLog.js +++ b/TaskServer/DebugLog.js @@ -87,7 +87,7 @@ exports.newDebugLog = function (processIndex) { percentage = percentage.toFixed(2) + " %" } - if (date === undefined) { date = thisObject.bot.processDatetime } + if (date === undefined) { date = thisObject.TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME } date = date.getUTCFullYear() + '-' + strPad(date.getUTCMonth() + 1, 2, "0") + '-' + strPad(date.getUTCDate(), 2, "0"); logLoop(date, percentage, " Internal Loop # ") diff --git a/TaskServer/IndicatorBot.js b/TaskServer/IndicatorBot.js index 0aba85f07..ff1832b47 100644 --- a/TaskServer/IndicatorBot.js +++ b/TaskServer/IndicatorBot.js @@ -118,7 +118,7 @@ const PROCESS_OUTPUT = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'ProcessOutput'); /* We define the datetime for the process that we are running now. This will be the official processing time for both the infraestructure and the bot. */ - bot.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution. + TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution. /* Main Loop Console Logging */ logger.newMainLoop() diff --git a/TaskServer/LowFrequencyTrading/TradingProcess.js b/TaskServer/LowFrequencyTrading/TradingProcess.js index a3afb56ad..d46d0ee80 100644 --- a/TaskServer/LowFrequencyTrading/TradingProcess.js +++ b/TaskServer/LowFrequencyTrading/TradingProcess.js @@ -717,7 +717,7 @@ let reportKey = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.parentNode.config.codeName + "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.config.codeName + "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.config.codeName let thisReport = statusDependencies.statusReports.get(reportKey); - thisReport.file.lastExecution = bot.processDatetime + thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME thisReport.file.simulationState = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE thisReport.file.timeFrames = currentTimeFrameLabel diff --git a/TaskServer/MultiPeriodMarket.js b/TaskServer/MultiPeriodMarket.js index 82d0b4787..5f89918a3 100644 --- a/TaskServer/MultiPeriodMarket.js +++ b/TaskServer/MultiPeriodMarket.js @@ -202,7 +202,7 @@ let reportKey = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.parentNode.config.codeName + "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.config.codeName + "-" + "Multi-Period-Market" let thisReport = statusDependencies.statusReports.get(reportKey) - thisReport.file.lastExecution = bot.processDatetime; + thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME; if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.timeFramesFilter !== undefined) { if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.timeFramesFilter.config.marketTimeFrames !== undefined) { thisReport.file.timeFrames = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.timeFramesFilter.config.marketTimeFrames @@ -210,13 +210,13 @@ } thisReport.save(callBack) - if (TS.projects.superalgos.utilities.dateTimeFunctions.areTheseDatesEqual(bot.processDatetime, new Date()) === false) { - logger.newInternalLoop(bot.processDatetime) + if (TS.projects.superalgos.utilities.dateTimeFunctions.areTheseDatesEqual(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME, new Date()) === false) { + logger.newInternalLoop(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME) } /* Telling the world we are alive and doing well */ - let currentDateString = bot.processDatetime.getUTCFullYear() + '-' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '-' + utilities.pad(bot.processDatetime.getUTCDate(), 2) - let currentDate = new Date(bot.processDatetime) + let currentDateString = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCFullYear() + '-' + utilities.pad(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' + utilities.pad(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCDate(), 2) + let currentDate = new Date(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME) let lastDate = new Date() TS.projects.superalgos.functionLibraries.processFunctions.processHeartBeat(processIndex, currentDateString, TS.projects.superalgos.utilities.dateTimeFunctions.getPercentage(currentDate, currentDate, lastDate)) } diff --git a/TaskServer/SensorBot.js b/TaskServer/SensorBot.js index 6dc6192ee..f2c0c1875 100644 --- a/TaskServer/SensorBot.js +++ b/TaskServer/SensorBot.js @@ -122,7 +122,7 @@ const PROCESS_OUTPUT = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'ProcessOutput'); /* We define the datetime for the process that we are running now. This will be the official processing time for both the infraestructure and the bot. */ - bot.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution. + TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution. /* Main Loop Console Logging */ logger.newMainLoop() diff --git a/TaskServer/TradingBot.js b/TaskServer/TradingBot.js index 8f7c81194..22f5a5180 100644 --- a/TaskServer/TradingBot.js +++ b/TaskServer/TradingBot.js @@ -82,7 +82,7 @@ const PROCESS_OUTPUT = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'ProcessOutput'); /* We define the datetime for the process that we are running now. This will be the official processing time for both the infraestructure and the bot. */ - bot.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution. + TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution. /* Main Loop Console Logging */ logger.newMainLoop()