From 3676d4ac8ca6833f5735efd3d7f4aec62efea73d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 21 May 2021 19:16:00 +0200 Subject: [PATCH] Refactoring TimePeriods for TimeFramesArray --- .../BollingerBandsMultiPeriodDaily.js | 4 +-- .../BollingerBandsMultiPeriodMarket.js | 6 ++-- .../CandlesVolumesMultiPeriodDaily.js | 8 ++--- .../CandlesVolumesMultiPeriodMarket.js | 12 ++++---- .../FromOneMinToMultiPeriodDaily.js | 8 ++--- .../FromOneMinToMultiPeriodMarket.js | 12 ++++---- .../Indicator-Bot/MultiPeriodDaily.js | 12 ++++---- .../Indicator-Bot/MultiPeriodMarket.js | 10 +++---- .../Learning-Bot/LearningSession.js | 12 ++++---- .../Low-Frequency-Learning/LearningOutput.js | 2 +- .../LearningSimulation.js | 8 ++--- .../Low-Frequency-Trading/TradingOutput.js | 2 +- .../TradingSimulation.js | 8 ++--- .../Bot-Modules/Trading-Bot/TradingSession.js | 12 ++++---- .../DataDependenciesFunctions.js | 30 +++++++++---------- .../ProcessFilesFunctions.js | 2 +- Projects/Superalgos/TS/Globals/TimeFrames.js | 16 +++++----- .../Charting-Space/Scales/TimeFrameScale.js | 2 +- UI/Data-Files/src/DailyFiles.js | 12 ++++---- UI/Data-Files/src/FileCursor.js | 4 +-- UI/Data-Files/src/MarketFiles.js | 16 +++++----- UI/Globals.js | 8 ++--- UI/Utilities.js | 8 ++--- 23 files changed, 107 insertions(+), 107 deletions(-) diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodDaily.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodDaily.js index 6555f101a..c23286975 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodDaily.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodDaily.js @@ -328,7 +328,7 @@ function loopBody() { try { - const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]; + const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][1]; let candles = []; // Here we will put all the candles of the 2 files read. @@ -725,7 +725,7 @@ function controlLoop() { try { n++ - if (n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length) { + if (n < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length) { loopBody() } else { n = 0 diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodMarket.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodMarket.js index f178fd35c..f7dd7030a 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodMarket.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Bollinger-Bands/BollingerBandsMultiPeriodMarket.js @@ -57,8 +57,8 @@ function loopBody() { try { - const outputPeriod = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]; - const timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; + const outputPeriod = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][0]; + const timeFrame = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1]; nextCandleFile() @@ -372,7 +372,7 @@ function controlLoop() { try { n++ - if (n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { + if (n < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length) { loopBody() } else { writeStatusReport(callBackFunction) diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodDaily.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodDaily.js index c651d67ac..a4a1d8df9 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodDaily.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodDaily.js @@ -269,7 +269,7 @@ outputCandles = [] outputVolumes = [] - for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; n++) { + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; n++) { const emptyArray1 = [] const emptyArray2 = [] outputCandles.push(emptyArray1) @@ -286,8 +286,8 @@ loopBody(); function loopBody() { - const outputPeriod = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0] - const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] + const outputPeriod = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][0] + const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][1] nextCandleFile(); @@ -512,7 +512,7 @@ function controlLoop() { n++; - if (n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length) { + if (n < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length) { loopBody() } else { writeDataRanges(onWritten); diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodMarket.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodMarket.js index 52b6da409..15601f12d 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodMarket.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/Candles-Volumes/CandlesVolumesMultiPeriodMarket.js @@ -276,7 +276,7 @@ loopBody() function loopBody() { - let timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; + let timeFrame = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1]; TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[INFO] start -> findPreviousContent -> loopBody -> timeFrame = " + timeFrame) @@ -378,7 +378,7 @@ function controlLoop() { n++ - if (n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { + if (n < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length) { loopBody() } else { buildCandles(allPreviousCandles, allPreviousVolumes); @@ -404,7 +404,7 @@ let outputCandles = []; let outputVolumes = []; - for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; n++) { + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; n++) { const emptyArray1 = []; const emptyArray2 = []; outputCandles.push(emptyArray1); @@ -467,8 +467,8 @@ previousVolumes = allPreviousVolumes[n]; } - const outputPeriod = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]; - const timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; + const outputPeriod = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][0]; + const timeFrame = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1]; /* Here we are inside a Loop that is going to advance 1 day at the time, at each pass, we will read one of Exchange Raw Data's daily files and @@ -760,7 +760,7 @@ TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[INFO] start -> buildCandles -> timeframesLoop -> controlLoop -> Entering function.") n++ - if (n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { + if (n < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length) { loopBody() } else { writeStatusReport(contextVariables.datetimeLastProducedFile, advanceTime); diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodDaily.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodDaily.js index 7f00bbdef..f507f51e0 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodDaily.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodDaily.js @@ -81,7 +81,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI */ let outputElements = [] - for (let timeFrameArrayIndex = 0; timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; timeFrameArrayIndex++) { + for (let timeFrameArrayIndex = 0; timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; timeFrameArrayIndex++) { const emptyArray = [] outputElements.push(emptyArray) } @@ -108,8 +108,8 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI function loopBody() { - const TIME_FRAME_VALUE = TS.projects.superalgos.globals.timeFrames.dailyFilesPeriods()[timeFrameArrayIndex][0] - const TIME_FRAME_LABEL = TS.projects.superalgos.globals.timeFrames.dailyFilesPeriods()[timeFrameArrayIndex][1] + const TIME_FRAME_VALUE = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[timeFrameArrayIndex][0] + const TIME_FRAME_LABEL = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[timeFrameArrayIndex][1] /* Here we are inside a Loop that is going to advance 1 day at the time, at each pass, we will read one of Exchange Raw Data's daily files and @@ -206,7 +206,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI function controlLoop() { timeFrameArrayIndex++ - if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { + if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length) { loopBody() } else { TS.projects.superalgos.functionLibraries.dataAggregationFunctions.writeStatusReport( diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodMarket.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodMarket.js index a5dbd14dc..5428c3666 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodMarket.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/FromOneMinToMultiPeriodMarket.js @@ -92,7 +92,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process loopBody() function loopBody() { - const TIME_FRAME_LABEL = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[timeFrameArrayIndex][1]; + const TIME_FRAME_LABEL = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[timeFrameArrayIndex][1]; let previousElements @@ -143,7 +143,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process function controlLoop() { timeFrameArrayIndex++ - if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { + if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length) { loopBody() } else { buildOutput(allPreviousElements) @@ -168,7 +168,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process */ let outputElements = [] - for (let timeFrameArrayIndex = 0; timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; timeFrameArrayIndex++) { + for (let timeFrameArrayIndex = 0; timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; timeFrameArrayIndex++) { const emptyArray = [] outputElements.push(emptyArray) } @@ -200,8 +200,8 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process previousElements = allPreviousElements[timeFrameArrayIndex]; } - const TIME_FRAME_VALUE = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[timeFrameArrayIndex][0] - const TIME_FRAME_LABEL = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[timeFrameArrayIndex][1] + const TIME_FRAME_VALUE = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[timeFrameArrayIndex][0] + const TIME_FRAME_LABEL = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[timeFrameArrayIndex][1] /* Here we are inside a Loop that is going to advance 1 day at the time, at each pass, we will read one of Exchange Raw Data's daily files and @@ -311,7 +311,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process function controlLoop() { timeFrameArrayIndex++ - if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { + if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length) { loopBody() } else { TS.projects.superalgos.functionLibraries.dataAggregationFunctions.writeStatusReport( diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js index 79d75c321..94685e1d0 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodDaily.js @@ -208,7 +208,7 @@ */ bootstrappingTheProcess = true - for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; i++) { + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; i++) { let emptyObject = {}; interExecutionMemoryArray.push(emptyObject) } @@ -298,8 +298,8 @@ function timeFramesLoopBody() { - const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0] - const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] + const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][0] + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][1] /* Check Time Frames Filter */ if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.timeFramesFilter !== undefined) { @@ -486,7 +486,7 @@ function timeFramesControlLoop() { n++ - if (n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length) { + if (n < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length) { timeFramesLoopBody() } else { n = 0; @@ -567,8 +567,8 @@ function writeTimeFramesFile(productCodeName, callBack) { let timeFramesArray = [] - for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; n++) { - let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; n++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][1] /* Check Time Frames Filter */ if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.timeFramesFilter !== undefined) { diff --git a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js index 5286de81a..520828b50 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js +++ b/Projects/Superalgos/TS/Bot-Modules/Indicator-Bot/MultiPeriodMarket.js @@ -52,8 +52,8 @@ } function timeFramesLoopBody() { - const timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0] - const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] + const timeFrame = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][0] + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1] /* Check Time Frames Filter */ if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.timeFramesFilter !== undefined) { @@ -138,7 +138,7 @@ function timeFramesControlLoop() { n++; - if (n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { + if (n < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length) { timeFramesLoopBody() } else { writeTimeFramesFiles(onTimeFrameFilesWritten) @@ -173,8 +173,8 @@ function writeTimeFramesFile(productCodeName, callBack) { let timeFramesArray = [] - for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; n++) { - let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; n++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1] /* Check Time Frames Filter */ if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.timeFramesFilter !== undefined) { diff --git a/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/LearningSession.js b/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/LearningSession.js index 0c2650954..51e373d86 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/LearningSession.js +++ b/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/LearningSession.js @@ -401,18 +401,18 @@ function getTimeFrameFromLabel(timeFrameLabel) { - for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; i++) { - let value = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][0] - let label = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[i][1] if (timeFrameLabel === label) { return value } } - for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; i++) { - let value = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][0] - let label = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[i][1] if (timeFrameLabel === label) { return value diff --git a/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningOutput.js b/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningOutput.js index ca4a2dafd..1c1d57a7b 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningOutput.js +++ b/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningOutput.js @@ -22,7 +22,7 @@ exports.newSuperalgosBotModulesLearningOutput = function (processIndex) { try { let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex) - if (timeFrame > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) { + if (timeFrame > TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[0][0]) { TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES = false } else { TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES = true diff --git a/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningSimulation.js b/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningSimulation.js index bb054df4d..771d62095 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningSimulation.js +++ b/Projects/Superalgos/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/LearningSimulation.js @@ -407,8 +407,8 @@ exports.newSuperalgosBotModulesLearningSimulation = function (processIndex) { /* Finding the Current Element on Market Files */ if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) { - for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; j++) { - let mapKey = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; j++) { + let mapKey = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[j][1] let propertyName = 'at' + mapKey.replace('-', '') let thisChart = chart[propertyName] @@ -430,8 +430,8 @@ exports.newSuperalgosBotModulesLearningSimulation = function (processIndex) { } /* Finding the Current Element on Market Files */ - for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; j++) { - let mapKey = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; j++) { + let mapKey = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[j][1] let propertyName = 'at' + mapKey.replace('-', '') let thisChart = chart[propertyName] diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOutput.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOutput.js index 44e67658a..c3f1c0764 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOutput.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOutput.js @@ -22,7 +22,7 @@ exports.newSuperalgosBotModulesTradingOutput = function (processIndex) { try { let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex) - if (timeFrame > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) { + if (timeFrame > TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[0][0]) { TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES = false } else { TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES = true diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingSimulation.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingSimulation.js index 99b0d2776..ad730673e 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingSimulation.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingSimulation.js @@ -376,8 +376,8 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) { /* Finding the Current Element on Daily Files */ if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) { - for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; j++) { - let mapKey = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; j++) { + let mapKey = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[j][1] let propertyName = 'at' + mapKey.replace('-', '') let thisChart = chart[propertyName] @@ -399,8 +399,8 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) { } /* Finding the Current Element on Market Files */ - for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; j++) { - let mapKey = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; j++) { + let mapKey = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[j][1] let propertyName = 'at' + mapKey.replace('-', '') let thisChart = chart[propertyName] diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js index 8d20d07cd..d0afeed6a 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js @@ -613,18 +613,18 @@ function getTimeFrameFromLabel(timeFrameLabel) { - for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; i++) { - let value = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][0] - let label = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[i][1] if (timeFrameLabel === label) { return value } } - for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; i++) { - let value = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][0] - let label = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[i][1] if (timeFrameLabel === label) { return value diff --git a/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js b/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js index 6278e37f1..26fff67af 100644 --- a/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js +++ b/Projects/Superalgos/TS/Function-Libraries/DataDependenciesFunctions.js @@ -118,16 +118,16 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { /* We will iterate through all posible timeFrames. */ - for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; n++) { - const timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0] - const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; n++) { + const timeFrame = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][0] + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1] dataFiles = new Map() /* Current Time Frame detection */ if (userDefinedTimeFrame === timeFrameLabel) { - currentTimeFrame.value = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0] - currentTimeFrame.label = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] + currentTimeFrame.value = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][0] + currentTimeFrame.label = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1] } /* Loop across the list of curated dependencies */ @@ -223,7 +223,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { } } - let mapKey = currentExchange + '-' + currentMarket + '-' + TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] + let mapKey = currentExchange + '-' + currentMarket + '-' + TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[n][1] multiTimeFrameDataFiles.set(mapKey, dataFiles) } } @@ -257,8 +257,8 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { /* We will iterate through all posible timeFrames. */ - for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; n++) { - const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; n++) { + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][1] if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.config.framework.validtimeFrames !== undefined) { let validPeriod = false @@ -272,8 +272,8 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { } if (userDefinedTimeFrame === timeFrameLabel) { - currentTimeFrame.value = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0] - currentTimeFrame.label = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] + currentTimeFrame.value = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][0] + currentTimeFrame.label = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][1] } dataFiles = new Map() @@ -350,7 +350,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { return JSON.parse(response.text) } } - let mapKey = currentExchange + '-' + currentMarket + '-' + TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] + let mapKey = currentExchange + '-' + currentMarket + '-' + TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[n][1] multiTimeFrameDataFiles.set(mapKey, dataFiles) } @@ -420,8 +420,8 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { let quotedAsset = splittedMarket[1] /* Market Files */ - for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; j++) { - let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length; j++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray()[j][1] let dataFiles = multiTimeFrameDataFiles.get(currentExchange + '-' + currentMarket + '-' + timeFrameLabel) let products = {} @@ -434,8 +434,8 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () { } /* Daily Files */ - for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; j++) { - let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length; j++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[j][1] let dataFiles = multiTimeFrameDataFiles.get(currentExchange + '-' + currentMarket + '-' + timeFrameLabel) let products = {} diff --git a/Projects/Superalgos/TS/Function-Libraries/ProcessFilesFunctions.js b/Projects/Superalgos/TS/Function-Libraries/ProcessFilesFunctions.js index 4ad59c482..5dacfe46d 100644 --- a/Projects/Superalgos/TS/Function-Libraries/ProcessFilesFunctions.js +++ b/Projects/Superalgos/TS/Function-Libraries/ProcessFilesFunctions.js @@ -128,7 +128,7 @@ exports.newSuperalgosFunctionLibrariesProcessFilesFunctions = function () { await writeTimeFramesFiles() await writeDataRanges() - if (currentTimeFrame.value > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) { + if (currentTimeFrame.value > TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray()[0][0]) { await writeMarketStatusReport() } else { await writeDailyStatusReport() diff --git a/Projects/Superalgos/TS/Globals/TimeFrames.js b/Projects/Superalgos/TS/Globals/TimeFrames.js index 35ac1070c..fa41c1ec3 100644 --- a/Projects/Superalgos/TS/Globals/TimeFrames.js +++ b/Projects/Superalgos/TS/Globals/TimeFrames.js @@ -1,15 +1,15 @@ exports.newSuperalgosGlobalsTimeFrames = function () { let thisObject = { - marketFilesPeriods: marketFilesPeriods, - dailyFilePeriods: dailyFilePeriods + marketTimeFramesArray: marketTimeFramesArray, + dailyTimeFramesArray: dailyTimeFramesArray } return thisObject - function marketFilesPeriods() { + function marketTimeFramesArray() { - let marketFilesPeriods = + let marketTimeFramesArray = '[' + '[' + 24 * 60 * 60 * 1000 + ',' + '"24-hs"' + ']' + ',' + '[' + 12 * 60 * 60 * 1000 + ',' + '"12-hs"' + ']' + ',' + @@ -20,12 +20,12 @@ exports.newSuperalgosGlobalsTimeFrames = function () { '[' + 2 * 60 * 60 * 1000 + ',' + '"02-hs"' + ']' + ',' + '[' + 1 * 60 * 60 * 1000 + ',' + '"01-hs"' + ']' + ']' - return JSON.parse(marketFilesPeriods) + return JSON.parse(marketTimeFramesArray) } - function dailyFilePeriods() { + function dailyTimeFramesArray() { - let dailyFilePeriods = + let dailyTimeFramesArray = '[' + '[' + 45 * 60 * 1000 + ',' + '"45-min"' + ']' + ',' + '[' + 40 * 60 * 1000 + ',' + '"40-min"' + ']' + ',' + @@ -39,6 +39,6 @@ exports.newSuperalgosGlobalsTimeFrames = function () { '[' + 02 * 60 * 1000 + ',' + '"02-min"' + ']' + ',' + '[' + 01 * 60 * 1000 + ',' + '"01-min"' + ']' + ']' - return JSON.parse(dailyFilePeriods) + return JSON.parse(dailyTimeFramesArray) } } \ No newline at end of file diff --git a/Projects/Superalgos/UI/Spaces/Charting-Space/Scales/TimeFrameScale.js b/Projects/Superalgos/UI/Spaces/Charting-Space/Scales/TimeFrameScale.js index 5edabe274..0acdff48d 100644 --- a/Projects/Superalgos/UI/Spaces/Charting-Space/Scales/TimeFrameScale.js +++ b/Projects/Superalgos/UI/Spaces/Charting-Space/Scales/TimeFrameScale.js @@ -28,7 +28,7 @@ function newTimeFrameScale() { let filePeriodIndex = FILES_PERIOD_DEFAULT_VALUE let timeFrameIndex = TIME_PERIOD_DEFAULT_VALUE - let timeFramesMasterArray = [marketFilesPeriods, dailyFilePeriods] + let timeFramesMasterArray = [marketTimeFramesArray, dailyTimeFramesArray] let timeFrameLabel = '24-hs' let onMouseWheelEventSubscriptionId diff --git a/UI/Data-Files/src/DailyFiles.js b/UI/Data-Files/src/DailyFiles.js index 1be7657c1..939228820 100644 --- a/UI/Data-Files/src/DailyFiles.js +++ b/UI/Data-Files/src/DailyFiles.js @@ -150,9 +150,9 @@ function newDailyFiles() { function createFileCursors() { try { /* Now we will get the daily files */ - for (let i = 0; i < dailyFilePeriods.length; i++) { - let periodTime = dailyFilePeriods[i][0] - let periodName = dailyFilePeriods[i][1] + for (let i = 0; i < dailyTimeFramesArray.length; i++) { + let periodTime = dailyTimeFramesArray[i][0] + let periodName = dailyTimeFramesArray[i][1] if (pDataset.config.validTimeFrames.includes(periodName) === false) { continue @@ -198,9 +198,9 @@ function newDailyFiles() { function loadThemAll() { try { - for (let i = 0; i < dailyFilePeriods.length; i++) { - let periodTime = dailyFilePeriods[i][0] - let periodName = dailyFilePeriods[i][1] + for (let i = 0; i < dailyTimeFramesArray.length; i++) { + let periodTime = dailyTimeFramesArray[i][0] + let periodName = dailyTimeFramesArray[i][1] if (pDataset.config.validTimeFrames.includes(periodName) === true) { let fileCursor = fileCursors.get(periodTime) diff --git a/UI/Data-Files/src/FileCursor.js b/UI/Data-Files/src/FileCursor.js index fdb933c95..0f11e5479 100644 --- a/UI/Data-Files/src/FileCursor.js +++ b/UI/Data-Files/src/FileCursor.js @@ -207,8 +207,8 @@ function newFileCursor() { let positionA - for (let i = 0; i < dailyFilePeriods.length; i++) { - let period = dailyFilePeriods[i] + for (let i = 0; i < dailyTimeFramesArray.length; i++) { + let period = dailyTimeFramesArray[i] if (period[0] === pTimeFrame) { positionA = i diff --git a/UI/Data-Files/src/MarketFiles.js b/UI/Data-Files/src/MarketFiles.js index ccfadcdd2..ea20b9140 100644 --- a/UI/Data-Files/src/MarketFiles.js +++ b/UI/Data-Files/src/MarketFiles.js @@ -148,9 +148,9 @@ function newMarketFiles() { function getMarketFiles() { /* Now we will get the market files */ - for (let i = 0; i < marketFilesPeriods.length; i++) { - let periodTime = marketFilesPeriods[i][0] - let periodName = marketFilesPeriods[i][1] + for (let i = 0; i < marketTimeFramesArray.length; i++) { + let periodTime = marketTimeFramesArray[i][0] + let periodName = marketTimeFramesArray[i][1] if (dataset.config.validTimeFrames.includes(periodName) === false) { filesNotLoaded++ @@ -176,7 +176,7 @@ function newMarketFiles() { filesNotLoaded++ } - if (filesLoaded + filesNotLoaded === marketFilesPeriods.length) { + if (filesLoaded + filesNotLoaded === marketTimeFramesArray.length) { let key = mine.config.codeName + '-' + bot.config.codeName + '-' + product.config.codeName + '-' + dataset.config.codeName + '-' + exchange.config.codeName + '-' + market.baseAsset + '/' + market.quotedAsset let callerId = key + '-' + periodName + newUniqueId() eventsServerClient.listenToEvent(key, 'Dataset Updated', undefined, callerId, onResponse, updateFiles) @@ -209,9 +209,9 @@ function newMarketFiles() { /* Now we will get the market files */ - for (let i = 0; i < marketFilesPeriods.length; i++) { - let periodTime = marketFilesPeriods[i][0] - let periodName = marketFilesPeriods[i][1] + for (let i = 0; i < marketTimeFramesArray.length; i++) { + let periodTime = marketTimeFramesArray[i][0] + let periodName = marketTimeFramesArray[i][1] if (dataset.config.validTimeFrames.includes(periodName) !== true) { continue } if (message.event !== undefined) { @@ -245,7 +245,7 @@ function newMarketFiles() { } function getExpectedFiles() { - return marketFilesPeriods.length + return marketTimeFramesArray.length } function getFilesLoaded() { diff --git a/UI/Globals.js b/UI/Globals.js index 27149619c..83de16201 100644 --- a/UI/Globals.js +++ b/UI/Globals.js @@ -129,7 +129,7 @@ const UI_PANEL = { }; -let marketFilesPeriods = +let marketTimeFramesArray = '[' + '[' + 24 * 60 * 60 * 1000 + ',' + '"24-hs"' + ']' + ',' + '[' + 12 * 60 * 60 * 1000 + ',' + '"12-hs"' + ']' + ',' + @@ -140,9 +140,9 @@ let marketFilesPeriods = '[' + 2 * 60 * 60 * 1000 + ',' + '"02-hs"' + ']' + ',' + '[' + 1 * 60 * 60 * 1000 + ',' + '"01-hs"' + ']' + ']'; -marketFilesPeriods = JSON.parse(marketFilesPeriods); +marketTimeFramesArray = JSON.parse(marketTimeFramesArray); -let dailyFilePeriods = +let dailyTimeFramesArray = '[' + '[' + 45 * 60 * 1000 + ',' + '"45-min"' + ']' + ',' + '[' + 40 * 60 * 1000 + ',' + '"40-min"' + ']' + ',' + @@ -156,7 +156,7 @@ let dailyFilePeriods = '[' + 02 * 60 * 1000 + ',' + '"02-min"' + ']' + ',' + '[' + 01 * 60 * 1000 + ',' + '"01-min"' + ']' + ']'; -dailyFilePeriods = JSON.parse(dailyFilePeriods); +dailyTimeFramesArray = JSON.parse(dailyTimeFramesArray); let SHOW_ANIMATION_PERFORMACE = false; let MENU_ITEM_ON_FOCUS diff --git a/UI/Utilities.js b/UI/Utilities.js index 28b38e590..3206b190a 100644 --- a/UI/Utilities.js +++ b/UI/Utilities.js @@ -37,15 +37,15 @@ function dynamicDecimals(value, minDecimals) { } function convertTimeFrameToName(pTimeFrame) { - for (let i = 0; i < dailyFilePeriods.length; i++) { - let period = dailyFilePeriods[i] + for (let i = 0; i < dailyTimeFramesArray.length; i++) { + let period = dailyTimeFramesArray[i] if (period[0] === pTimeFrame) { return period[1] } } - for (let i = 0; i < marketFilesPeriods.length; i++) { - let period = marketFilesPeriods[i] + for (let i = 0; i < marketTimeFramesArray.length; i++) { + let period = marketTimeFramesArray[i] if (period[0] === pTimeFrame) { return period[1] }