From 12702289b088ee6c46651ab8a73f78a3e750600c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 4 Feb 2021 17:17:32 +0100 Subject: [PATCH] Final Generalization --- .../Low-Frequency-Trading/TradingProcess.js | 4 +++- .../Function-Libraries/DataDependenciesFunctions.js | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) 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 0466610dd..1f2713679 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 @@ -90,7 +90,9 @@ multiTimeFrameDataFiles, dataDependenciesModule, currentTimeFrame, - TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeFrame.config.label + TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeFrame.config.label, + TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.initialDatetime, + TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.finalDatetime ) === false) { TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waiting for Data Mining to be run') callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE) diff --git a/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js b/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js index a98e2c129..8bbbc8d08 100644 --- a/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js +++ b/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js @@ -96,7 +96,9 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { multiTimeFrameDataFiles, dataDependenciesModule, currentTimeFrame, - userDefinedTimeFrame + userDefinedTimeFrame, + initialDatetime, + finalDatetime ) { /* We do market files first since if the simulation is run on daily files, there will @@ -207,8 +209,8 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { let dataRecord = dataFile[i] let begin = dataRecord[beginIndex] let end = dataRecord[endIndex] - if (end + timeFrame < TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.initialDatetime - 1) { continue } // /1 because we need the previous closed element - if (begin > TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.finalDatetime) { continue } + if (end + timeFrame < initialDatetime - 1) { continue } // /1 because we need the previous closed element + if (begin > finalDatetime) { continue } result.push(dataRecord) } return result @@ -365,14 +367,14 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { let mainDependency = {} /* THe first thing we do is to build an array of all the - declared dependencies of the Trading Bot. + declared dependencies of the Bot Process. */ let dataDependencies = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency') /* Then we will filter out declared dependencies that are not referencing nodes currently present at the workspace. This will allow the user to have less Data Mines loaded at - the workspace that the ones that a Trading Bot depends on. + the workspace that the ones that a the Bot process depends on. */ dataDependencies = TS.projects.superalgos.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies) /*