diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js index c4ed56b43..636e7389d 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js @@ -328,7 +328,7 @@ dependencyLoopBody() function dependencyLoopBody() { - let dependency = dataDependenciesModule.nodeArray[dependencyIndex] + let dependency = dataDependenciesModule.curatedNodeArray[dependencyIndex] if (dependency === undefined) { TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, @@ -453,7 +453,7 @@ function dependencyControlLoop() { dependencyIndex++; - if (dependencyIndex < dataDependenciesModule.nodeArray.length) { + if (dependencyIndex < dataDependenciesModule.curatedNodeArray.length) { dependencyLoopBody() } else { generateOutput() diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js index 120bdfef1..89dbba26a 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js @@ -68,7 +68,7 @@ dependencyLoopBody() function dependencyLoopBody() { - let dependency = dataDependenciesModule.nodeArray[dependencyIndex] + let dependency = dataDependenciesModule.curatedNodeArray[dependencyIndex] let datasetModule = dataDependenciesModule.dataSetsModulesArray[dependencyIndex] getFile() @@ -96,7 +96,7 @@ function dependencyControlLoop() { dependencyIndex++; - if (dependencyIndex < dataDependenciesModule.nodeArray.length) { + if (dependencyIndex < dataDependenciesModule.curatedNodeArray.length) { dependencyLoopBody() } else { generateOutput() diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingProcess.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingProcess.js index 1bb487e1b..f2954f07f 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingProcess.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingProcess.js @@ -332,8 +332,8 @@ async function processSingleFiles() { dataFiles = new Map() - for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.nodeArray.length; dependencyIndex++) { - let dependency = dataDependenciesModule.nodeArray[dependencyIndex] + for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.curatedNodeArray.length; dependencyIndex++) { + let dependency = dataDependenciesModule.curatedNodeArray[dependencyIndex] let datasetModule = dataDependenciesModule.dataSetsModulesArray[dependencyIndex] if (datasetModule.node.config.codeName !== "Single-File") { @@ -385,12 +385,15 @@ dataFiles = new Map() + /* Current Time Frame detection */ if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeFrame.config.label === timeFrameLabel) { currentTimeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0] currentTimeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] } - for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.nodeArray.length; dependencyIndex++) { - let dependency = dataDependenciesModule.nodeArray[dependencyIndex] + + /* Loop across the list of curated dependencies */ + for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.curatedNodeArray.length; dependencyIndex++) { + let dependency = dataDependenciesModule.curatedNodeArray[dependencyIndex] let datasetModule = dataDependenciesModule.dataSetsModulesArray[dependencyIndex] if (dependency.referenceParent.config.codeName !== "Multi-Period-Market") { @@ -499,8 +502,8 @@ We will iterate through all dependencies, in order to load the files that later will end up at the chart data structure. */ - for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.nodeArray.length; dependencyIndex++) { - let dependency = dataDependenciesModule.nodeArray[dependencyIndex] + for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.curatedNodeArray.length; dependencyIndex++) { + let dependency = dataDependenciesModule.curatedNodeArray[dependencyIndex] let datasetModule = dataDependenciesModule.dataSetsModulesArray[dependencyIndex] if (dependency.referenceParent.config.codeName !== "Multi-Period-Daily") { diff --git a/Projects/Superalgos/TS/Process-Modules/DataDependencies.js b/Projects/Superalgos/TS/Process-Modules/DataDependencies.js index eec6b6d0b..5b18b86a3 100644 --- a/Projects/Superalgos/TS/Process-Modules/DataDependencies.js +++ b/Projects/Superalgos/TS/Process-Modules/DataDependencies.js @@ -3,7 +3,10 @@ This module mantains a curated array of Data Dependency nodes, which is not exactly the ones listed at the Process Dependencies, but a smaller subset based on the circunstances found at the user's - workspace. + workspace. For example: + + 1. Dependencies without a Reference Parent are filtered out. + 2. Dependencies which don't have a Data Set are filtered out. It also mantains an array of Data Set Modules, which are the one's that ultimately know how to load a file based on the @@ -17,7 +20,7 @@ const MODULE_NAME = "Data Dependencies"; let thisObject = { - nodeArray: undefined, + curatedNodeArray: undefined, dataSetsModulesArray: [], isItADepenency: isItADepenency, initialize: initialize, @@ -35,8 +38,8 @@ /* First we will get all the data dependencies of the bot, as defined at the Trading Mine. */ - thisObject.nodeArray = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency') - if (thisObject.nodeArray.length === 0) { + thisObject.curatedNodeArray = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency') + if (thisObject.curatedNodeArray.length === 0) { TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> It is not possible to not have data dependencies at all."); callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE) return @@ -46,7 +49,7 @@ This will allow the user to have less Data Mines loaded at the workspace that the ones that a Trading Mine depends on. */ - thisObject.nodeArray = TS.projects.superalgos.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(thisObject.nodeArray) + thisObject.curatedNodeArray = TS.projects.superalgos.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(thisObject.curatedNodeArray) } else { TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> It is not possible not to have process dependencies, which means not data dependencies."); @@ -54,7 +57,7 @@ return } - if (thisObject.nodeArray.length === 0) { + if (thisObject.curatedNodeArray.length === 0) { // We allow old indicators not to declare their data dependencies. @@ -71,14 +74,14 @@ } /* - For each dependency declared at the nodeArray, we will initialize a DataSet as part of this initialization process. + For each dependency declared at the curatedNodeArray, we will initialize a DataSet as part of this initialization process. */ let alreadyCalledBack = false let addCount = 0 let skipCount = 0 /* - The current nodeArray that we have includes all the dependencies daclared in the Data Mine | Trading Mine | Learning Mine + The current curatedNodeArray that we have includes all the dependencies daclared in the Data Mine | Trading Mine | Learning Mine process dependencies, minus the ones without reference parent, meaning that references Data Mines that are not present at the workspace. From all the remaining dependencies there will be others that we need to filter out, and they are the ones which the user does not have a data product anywhere on the network where @@ -89,9 +92,9 @@ */ let newNodeArray = [] - for (let i = 0; i < thisObject.nodeArray.length; i++) { + for (let i = 0; i < thisObject.curatedNodeArray.length; i++) { let dataSetModule = TS.projects.superalgos.processModules.dataset.newSuperalgosProcessModulesDataset(processIndex); - dataSetModule.initialize(thisObject.nodeArray[i], onInitilized); + dataSetModule.initialize(thisObject.curatedNodeArray[i], onInitilized); function onInitilized(err, wasInitialized) { @@ -105,7 +108,7 @@ if (wasInitialized === true) { addCount++; - newNodeArray.push(thisObject.nodeArray[i]) + newNodeArray.push(thisObject.curatedNodeArray[i]) addDataSet() } else { skipCount++ @@ -118,10 +121,10 @@ } function checkIfWeAreDone() { - if (addCount + skipCount === thisObject.nodeArray.length) { + if (addCount + skipCount === thisObject.curatedNodeArray.length) { if (alreadyCalledBack === false) { alreadyCalledBack = true - thisObject.nodeArray = newNodeArray + thisObject.curatedNodeArray = newNodeArray callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE); return; }