diff --git a/DataSet.js b/DataSet.js index a55029ab6..aa0c6bb1c 100644 --- a/DataSet.js +++ b/DataSet.js @@ -94,6 +94,37 @@ exports.newDataSet = function newDataSet(BOT, logger) { let market = singleMarketData.referenceParent let currentProcessMarket = bot.processNode.marketReference.referenceParent + if (currentProcessMarket.id === market.id) { + for (let m = 0; m < singleMarketData.dataProducts.length; m++) { + let dataProduct = singleMarketData.dataProducts[m] + if (dataProduct.referenceParent !== undefined) { + let productDefinition = dataProduct.referenceParent + if (datasetProductDefinition.id === productDefinition.id) { + + /* We found where the data is located on the network. */ + if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Retrieving data from " + networkNode.name + " -> host = " + networkNode.code.host + ' -> port = ' + networkNode.code.webPort + '.'); } + + fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.code.host, networkNode.code.webPort); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return + } + } + } + } + } + } + } + } + if (networkNode.dataStorage.sessionBasedData !== undefined) { + for (let j = 0; j < networkNode.dataStorage.sessionBasedData.exchangeDataProducts.length; j++) { + let exchangeDataProduct = networkNode.dataStorage.sessionBasedData.exchangeDataProducts[j] + for (let s = 0; s < exchangeDataProduct.sessionReferences.length; s++) { + let sessionReference = exchangeDataProduct.sessionReferences[s] + let singleMarketData = sessionReference.singleMarketData + if (singleMarketData.referenceParent !== undefined) { + let market = singleMarketData.referenceParent + let currentProcessMarket = bot.processNode.marketReference.referenceParent + if (currentProcessMarket.id === market.id) { for (let m = 0; m < singleMarketData.dataProducts.length; m++) { let dataProduct = singleMarketData.dataProducts[m] @@ -119,6 +150,8 @@ exports.newDataSet = function newDataSet(BOT, logger) { } logger.write(MODULE_NAME, "[ERROR] initialize -> Initialization Failed because we could not find where the data of this dataset is located within the network. Check the logs for more info."); + logger.write(MODULE_NAME, "[ERROR] initialize -> Could not find where " + datasetProductDefinition.name + " for " + bot.exchange + " " + bot.market.baseAsset + "/" + bot.market.quotedAsset + " is stored within the network."); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } catch (err) { diff --git a/StatusReport.js b/StatusReport.js index 6f95de543..267889a75 100644 --- a/StatusReport.js +++ b/StatusReport.js @@ -125,9 +125,10 @@ if (checkThisBranch(networkNode.testingEnvironment) === true) {return} if (checkThisBranch(networkNode.productionEnvironment) === true) { return } - function checkThisBranch() { - for (let j = 0; j < networkNode.dataMining.exchangeTasks.length; j++) { - let exchangeTasks = networkNode.dataMining.exchangeTasks[j] + function checkThisBranch(branch) { + if (branch === undefined) {return} + for (let j = 0; j < branch.exchangeTasks.length; j++) { + let exchangeTasks = branch.exchangeTasks[j] for (let k = 0; k < exchangeTasks.taskManagers.length; k++) { let taskManager = exchangeTasks.taskManagers[k] for (let m = 0; m < taskManager.tasks.length; m++) { @@ -143,6 +144,15 @@ if (process.referenceParent !== undefined) { 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 + } + } /* We found where the task that runs the process definition this status report depends on and where it is located on the network. */