From 4a884a74c99b14e1dd0e2cc7bba8f298c0948c05 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 13 Sep 2020 20:05:17 +0200 Subject: [PATCH] Trading mine --- Commons.js | 35 ++++++++++++++++++++++------------- DataSet.js | 2 +- ProcessOutput.js | 4 ++-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Commons.js b/Commons.js index a93cd8d85..050791f24 100644 --- a/Commons.js +++ b/Commons.js @@ -96,33 +96,42 @@ } let botNode = global.FIND_NODE_IN_NODE_MESH(outputDatasetNode, 'Indicator Bot') - if (botNode === undefined) { + if (botNode === undefined) { botNode = global.FIND_NODE_IN_NODE_MESH(outputDatasetNode, 'Trading Bot') } if (botNode === undefined) { - logger.write(MODULE_NAME, "[ERROR] start -> Product Definition not attached to a Bot. Product Definition = " ); + logger.write(MODULE_NAME, "[ERROR] start -> Product Definition not attached to a Bot. Product Definition = "); callBackFunction(global.DEFAULT_FAIL_RESPONSE); return } if (botNode.config.codeName === undefined) { - logger.write(MODULE_NAME, "[ERROR] start -> Bot witn no codeName defined." ); + logger.write(MODULE_NAME, "[ERROR] start -> Bot witn no codeName defined."); callBackFunction(global.DEFAULT_FAIL_RESPONSE); return } let dataMineNode = global.FIND_NODE_IN_NODE_MESH(outputDatasetNode, 'Data Mine') if (dataMineNode === undefined) { - logger.write(MODULE_NAME, "[ERROR] start -> Bot not attached to a Data Mine."); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return - } - - if (dataMineNode.config.codeName === undefined) { - logger.write(MODULE_NAME, "[ERROR] start -> Data Mine witn no codeName defined." ); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return - } + let tradingMineNode = global.FIND_NODE_IN_NODE_MESH(outputDatasetNode, 'Trading Mine') + if (tradingMineNode === undefined) { + logger.write(MODULE_NAME, "[ERROR] start -> Bot not attached to a Data Mine or a Trading Mine."); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return + } else { + if (tradingMineNode.config.codeName === undefined) { + logger.write(MODULE_NAME, "[ERROR] start -> Trading Mine witn no codeName defined."); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return + } + } + } else { + if (dataMineNode.config.codeName === undefined) { + logger.write(MODULE_NAME, "[ERROR] start -> Data Mine witn no codeName defined."); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return + } + } } return true } diff --git a/DataSet.js b/DataSet.js index 7dce95fe8..5d1527055 100644 --- a/DataSet.js +++ b/DataSet.js @@ -64,7 +64,7 @@ exports.newDataSet = function newDataSet(BOT, logger) { } if (thisObject.node.parentNode.parentNode.parentNode === undefined) { - logger.write(MODULE_NAME, "[ERROR] initialize -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(thisObject.node.parentNode.parentNode)); + logger.write(MODULE_NAME, "[ERROR] initialize -> Bot not attached to a Data Mine or Trading Mine. Bot = " + JSON.stringify(thisObject.node.parentNode.parentNode)); callBackFunction(global.DEFAULT_FAIL_RESPONSE); return } diff --git a/ProcessOutput.js b/ProcessOutput.js index 5ac15c864..9f6f0ee71 100644 --- a/ProcessOutput.js +++ b/ProcessOutput.js @@ -59,7 +59,7 @@ return } } else { - logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(botNode)); + logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine or Trading Mine. Bot = " + JSON.stringify(botNode)); callBackFunction(global.DEFAULT_FAIL_RESPONSE); return } @@ -142,7 +142,7 @@ throw (global.DEFAULT_FAIL_RESPONSE); } } else { - logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(botNode)); + logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine or Trading Mine. Bot = " + JSON.stringify(botNode)); throw (global.DEFAULT_FAIL_RESPONSE); } } else {