Refactoring TimePeriods for TimeFramesArray

This commit is contained in:
Luis Fernando Molina committed 2021-05-21 19:16:00 +02:00
1 parent ca5573459e
commit 3676d4ac8c
23 files changed
+107 -107

No files matched your search

@@ -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
@@ -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)
@@ -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);
@@ -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);
@@ -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(
@@ -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(
@@ -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) {
@@ -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) {
@@ -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
@@ -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
@@ -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]
@@ -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
@@ -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]
@@ -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
@@ -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 = {}
@@ -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()
+8 -8
View File
@@ -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)
}
}
@@ -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
+6 -6
View File
@@ -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)
+2 -2
View File
@@ -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
+8 -8
View File
@@ -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() {
+4 -4
View File
@@ -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
+4 -4
View File
@@ -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]
}