From c1c036b37c8d9813d9f8121c4e61a1a55e36c2e1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 23 Nov 2020 18:30:31 +0100 Subject: [PATCH] Fixing status report and task functions. --- .../Function-Libraries/TaskFunctions.js | 9 +- Projects/Superalgos/Schemas/AppSchema.json | 13 ++ TaskServer/StatusReport.js | 138 +++++++++--------- 3 files changed, 92 insertions(+), 68 deletions(-) diff --git a/Projects/Superalgos/Function-Libraries/TaskFunctions.js b/Projects/Superalgos/Function-Libraries/TaskFunctions.js index 09bc365c9..648aac0f8 100644 --- a/Projects/Superalgos/Function-Libraries/TaskFunctions.js +++ b/Projects/Superalgos/Function-Libraries/TaskFunctions.js @@ -114,6 +114,7 @@ function newSuperalgosFunctionLibraryTaskFunctions() { 'Exchange Data Tasks->Exchange Trading Tasks->Exchange Learning Tasks->' + 'Market->Exchange Markets->Crypto Exchange->' + 'Market Base Asset->Market Quoted Asset->Asset->' + + 'Project Data Tasks->Project Trading Tasks->Project Learning Tasks->Project Definition->' + 'Backtesting Session->Live Trading Session->Paper Trading Session->Forward Testing Session->' + 'Learning Session->' + 'Process Definition->' + @@ -145,12 +146,16 @@ function newSuperalgosFunctionLibraryTaskFunctions() { let taskDefinition = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node, false, true, true, false, false, taskLightingPath) let networkLightingPath = '->Network->Network Node->' + - 'Data Storage->Data Mines Data->Exchange Data Products->' + - 'Market Data Products->' + + 'Data Storage->' + + 'Data Mines Data->Trading Mines Data->Learning Mines Data->' + + 'Project Data Products->Project Trading Products->Project Learning Products->' + + 'Exchange Data Products->Exchange Trading Products->Exchange Learning Products->' + + 'Market Data Products->Market Trading Products->Market Learning Products->' + 'Data Mine Products->Bot Products->' + 'Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->' + 'Data Product->Product Definition->' + 'Data Tasks->Learning Tasks->Testing Trading Tasks->Production Trading Tasks->' + + 'Project Data Tasks->Project Trading Tasks->Project Learning Tasks->' + 'Exchange Data Tasks->Exchange Trading Tasks->Exchange Learning Tasks->Crypto Exchange->' + 'Market Data Tasks->Market Trading Tasks->Market Learning Tasks->Market->' + 'Data Mine Tasks->Trading Mine Tasks->Learning Mine Tasks->' + diff --git a/Projects/Superalgos/Schemas/AppSchema.json b/Projects/Superalgos/Schemas/AppSchema.json index 2ec739a1b..d08d33562 100644 --- a/Projects/Superalgos/Schemas/AppSchema.json +++ b/Projects/Superalgos/Schemas/AppSchema.json @@ -54,6 +54,13 @@ { "type": "Project Definition", "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -64,6 +71,12 @@ "iconPathOff": "delete" } ], + "initialValues": { + "config": "{ \n \"codeName\": \"\"\n}" + }, + "editors": { + "config": true + }, "alternativeIcons": "Use Parent", "isTitleAllwaysVisible": false, "addLeftIcons": true, diff --git a/TaskServer/StatusReport.js b/TaskServer/StatusReport.js index 0c7b32507..bafb1bba4 100644 --- a/TaskServer/StatusReport.js +++ b/TaskServer/StatusReport.js @@ -123,43 +123,46 @@ function checkThisDataBranch(branch) { if (branch === undefined) { return } - for (let j = 0; j < branch.exchangeDataTasks.length; j++) { - let exchangeTasks = branch.exchangeDataTasks[j] - for (let p = 0; p < exchangeTasks.marketDataTasks.length; p++) { - let marketTasks = exchangeTasks.marketDataTasks[p] - if (marketTasks.referenceParent === undefined) { continue } - if (marketTasks.referenceParent.id !== global.MARKET_NODE.id) { continue } - for (let q = 0; q < marketTasks.dataMineTasks.length; q++) { - let mineTasks = marketTasks.dataMineTasks[q] - for (let k = 0; k < mineTasks.taskManagers.length; k++) { - let taskManager = mineTasks.taskManagers[k] - for (let m = 0; m < taskManager.tasks.length; m++) { - let task = taskManager.tasks[m] - if (task.bot === undefined) { continue } - for (let n = 0; n < task.bot.processes.length; n++) { - let process = task.bot.processes[n] - if (process.referenceParent === undefined) { continue } - let processDefinition = process.referenceParent - if (processThisDependsOn.id === processDefinition.id) { - if (process.type === 'Trading Process Instance') { - if (process.session !== undefined) { - if (bot.processNode.session.id !== process.session.id) { + for (let z = 0; z < branch.projectDataTasks.length; z++) { + let projectDataTasks = branch.projectDataTasks[z] + for (let j = 0; j < projectDataTasks.exchangeDataTasks.length; j++) { + let exchangeTasks = projectDataTasks.exchangeDataTasks[j] + for (let p = 0; p < exchangeTasks.marketDataTasks.length; p++) { + let marketTasks = exchangeTasks.marketDataTasks[p] + if (marketTasks.referenceParent === undefined) { continue } + if (marketTasks.referenceParent.id !== global.MARKET_NODE.id) { continue } + for (let q = 0; q < marketTasks.dataMineTasks.length; q++) { + let mineTasks = marketTasks.dataMineTasks[q] + for (let k = 0; k < mineTasks.taskManagers.length; k++) { + let taskManager = mineTasks.taskManagers[k] + for (let m = 0; m < taskManager.tasks.length; m++) { + let task = taskManager.tasks[m] + if (task.bot === undefined) { continue } + for (let n = 0; n < task.bot.processes.length; n++) { + let process = task.bot.processes[n] + if (process.referenceParent === undefined) { continue } + let processDefinition = process.referenceParent + if (processThisDependsOn.id === processDefinition.id) { + if (process.type === 'Trading Process Instance') { + if (process.session !== undefined) { + if (bot.processNode.session.id !== process.session.id) { + continue + } + } else { continue } - } else { - continue } + /* + We found where the task that runs the process definition this status report depends on + and where it is located on the network. + */ + thisObject.networkNode = networkNode + if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Retrieving status report from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.'); } + + fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.webPort); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return true } - /* - We found where the task that runs the process definition this status report depends on - and where it is located on the network. - */ - thisObject.networkNode = networkNode - if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Retrieving status report from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.'); } - - fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.webPort); - callBackFunction(global.DEFAULT_OK_RESPONSE); - return true } } } @@ -171,43 +174,46 @@ function checkThisTradingBranch(branch) { if (branch === undefined) { return } - for (let j = 0; j < branch.exchangeTradingTasks.length; j++) { - let exchangeTasks = branch.exchangeTradingTasks[j] - for (let p = 0; p < exchangeTasks.marketTradingTasks.length; p++) { - let marketTasks = exchangeTasks.marketTradingTasks[p] - if (marketTasks.referenceParent === undefined) { continue } - if (marketTasks.referenceParent.id !== global.MARKET_NODE.id) { continue } - for (let q = 0; q < marketTasks.tradingMineTasks.length; q++) { - let mineTasks = marketTasks.tradingMineTasks[q] - for (let k = 0; k < mineTasks.taskManagers.length; k++) { - let taskManager = mineTasks.taskManagers[k] - for (let m = 0; m < taskManager.tasks.length; m++) { - let task = taskManager.tasks[m] - if (task.bot === undefined) { continue } - for (let n = 0; n < task.bot.processes.length; n++) { - let process = task.bot.processes[n] - if (process.referenceParent === undefined) { continue } - let processDefinition = process.referenceParent - if (processThisDependsOn.id === processDefinition.id) { - if (process.type === 'Trading Process Instance') { - if (process.session !== undefined) { - if (bot.processNode.session.id !== process.session.id) { + for (let z = 0; z < branch.projectTradingTasks.length; z++) { + let projectTradingTasks = branch.projectTradingTasks[z] + for (let j = 0; j < projectTradingTasks.exchangeTradingTasks.length; j++) { + let exchangeTasks = projectTradingTasks.exchangeTradingTasks[j] + for (let p = 0; p < exchangeTasks.marketTradingTasks.length; p++) { + let marketTasks = exchangeTasks.marketTradingTasks[p] + if (marketTasks.referenceParent === undefined) { continue } + if (marketTasks.referenceParent.id !== global.MARKET_NODE.id) { continue } + for (let q = 0; q < marketTasks.tradingMineTasks.length; q++) { + let mineTasks = marketTasks.tradingMineTasks[q] + for (let k = 0; k < mineTasks.taskManagers.length; k++) { + let taskManager = mineTasks.taskManagers[k] + for (let m = 0; m < taskManager.tasks.length; m++) { + let task = taskManager.tasks[m] + if (task.bot === undefined) { continue } + for (let n = 0; n < task.bot.processes.length; n++) { + let process = task.bot.processes[n] + if (process.referenceParent === undefined) { continue } + let processDefinition = process.referenceParent + if (processThisDependsOn.id === processDefinition.id) { + if (process.type === 'Trading Process Instance') { + if (process.session !== undefined) { + if (bot.processNode.session.id !== process.session.id) { + continue + } + } else { continue } - } else { - continue } + /* + We found where the task that runs the process definition this status report depends on + and where it is located on the network. + */ + thisObject.networkNode = networkNode + if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Retrieving status report from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.'); } + + fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.webPort); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return true } - /* - We found where the task that runs the process definition this status report depends on - and where it is located on the network. - */ - thisObject.networkNode = networkNode - if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Retrieving status report from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.'); } - - fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.webPort); - callBackFunction(global.DEFAULT_OK_RESPONSE); - return true } } }