diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/IndicatorOutput.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/IndicatorOutput.js index a9bb6340f..14a132d2f 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/IndicatorOutput.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/IndicatorOutput.js @@ -10,16 +10,12 @@ let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex); - const COMMONS = require('./Commons.js'); - let commons = COMMONS.newCommons(processIndex); - return thisObject; function finalize() { thisObject = undefined utilities = undefined fileStorage = undefined - commons = undefined } function initialize(callBackFunction) { @@ -52,13 +48,13 @@ /* The first phase here is about checking that we have everything we need at the definition level. */ let dataDependencies = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency') - if (commons.validateDataDependencies(dataDependencies, callBackFunction) !== true) { return } + if (TS.projects.superalgos.functionLibraries.singleMarketFunctions.validateDataDependencies(dataDependencies, callBackFunction) !== true) { return } let outputDatasets = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset') - if (commons.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return } + if (TS.projects.superalgos.functionLibraries.singleMarketFunctions.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return } /* The second phase is about transforming the inputs into a format that can be used to apply the user defined code. */ - commons.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, timeFrame) + TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, timeFrame) /* During the third phase, we need to generate the data of the different products this process produces an output */ for (let i = 0; i < outputDatasets.length; i++) { @@ -87,7 +83,7 @@ } /* Build the data */ - jsonData = commons.dataBuildingProcedure( + jsonData = TS.projects.superalgos.functionLibraries.singleMarketFunctions.dataBuildingProcedure( products, mainDependency, recordDefinition, @@ -104,7 +100,7 @@ /* Add the calculated properties */ if (outputDatasetNode.referenceParent.parentNode.calculations !== undefined) { - outputData = commons.calculationsProcedure(jsonData, recordDefinition, outputDatasetNode.referenceParent.parentNode.calculations, singularVariableName, timeFrame) + outputData = TS.projects.superalgos.functionLibraries.singleMarketFunctions.calculationsProcedure(jsonData, recordDefinition, outputDatasetNode.referenceParent.parentNode.calculations, singularVariableName, timeFrame) } else { outputData = jsonData } @@ -136,8 +132,8 @@ contextSummary.mineType = dataMineNode.type.replace(' ', '-') contextSummary.project = dataMineNode.project - let fileContent = commons.generateFileContent(outputData, outputDatasetNode.referenceParent.parentNode.record, resultsWithIrregularPeriods, processingDailyFiles, currentDay, callBackFunction) - commons.writeFile(contextSummary, fileContent, anotherFileWritten, processingDailyFiles, timeFrameLabel, currentDay, callBackFunction) + let fileContent = TS.projects.superalgos.functionLibraries.singleMarketFunctions.generateFileContent(outputData, outputDatasetNode.referenceParent.parentNode.record, resultsWithIrregularPeriods, processingDailyFiles, currentDay, callBackFunction) + TS.projects.superalgos.functionLibraries.singleMarketFunctions.writeFile(contextSummary, fileContent, anotherFileWritten, processingDailyFiles, timeFrameLabel, currentDay, callBackFunction) } diff --git a/TaskServer/Commons.js b/Projects/Superalgos/TS/Function-Libraries/SingleMarketFunctions.js similarity index 99% rename from TaskServer/Commons.js rename to Projects/Superalgos/TS/Function-Libraries/SingleMarketFunctions.js index 26032f387..888cbef50 100644 --- a/TaskServer/Commons.js +++ b/Projects/Superalgos/TS/Function-Libraries/SingleMarketFunctions.js @@ -1,6 +1,6 @@ -exports.newCommons = function (processIndex) { +exports.newSuperalgosFunctionLibrariesSingleMarketFunctions = function (processIndex) { - const MODULE_NAME = "Commons"; + const MODULE_NAME = "Single Market Functions"; let thisObject = { validateDataDependencies: validateDataDependencies, diff --git a/TaskServer/LowFrequencyTrading/TradingProcess.js b/TaskServer/LowFrequencyTrading/TradingProcess.js index 37d3d24c1..b5a9ae4e5 100644 --- a/TaskServer/LowFrequencyTrading/TradingProcess.js +++ b/TaskServer/LowFrequencyTrading/TradingProcess.js @@ -548,9 +548,6 @@ } function buildCharts(chart) { - const COMMONS = require('../Commons.js') - let commons = COMMONS.newCommons(processIndex) - let mainDependency = {} /* The first phase here is about checking that we have everything we need at the definition level. */ @@ -562,10 +559,10 @@ */ dataDependencies = TS.projects.superalgos.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies) - if (commons.validateDataDependencies(dataDependencies, callBackFunction) !== true) { return } + if (TS.projects.superalgos.functionLibraries.singleMarketFunctions.validateDataDependencies(dataDependencies, callBackFunction) !== true) { return } let outputDatasets = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset') - if (commons.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return } + if (TS.projects.superalgos.functionLibraries.singleMarketFunctions.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return } /* The second phase is about transforming the inputs into a format that can be used to apply the user defined code. */ for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; j++) { @@ -574,7 +571,7 @@ let products = {} if (dataFiles !== undefined) { - commons.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, currentTimeFrame) + TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, currentTimeFrame) let propertyName = 'at' + timeFrameLabel.replace('-', '') chart[propertyName] = products @@ -587,7 +584,7 @@ let products = {} if (dataFiles !== undefined) { - commons.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, currentTimeFrame) + TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, currentTimeFrame) let propertyName = 'at' + timeFrameLabel.replace('-', '') chart[propertyName] = products @@ -599,7 +596,7 @@ let products = {} if (dataFiles !== undefined) { - commons.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, currentTimeFrame) + TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(dataFiles, dataDependencies, products, mainDependency, currentTimeFrame) let propertyName = 'atAnyTimeFrame' chart[propertyName] = products