From 30bfc4e3b188e41132972c50c6457bca43e2faa2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 31 Aug 2020 20:04:34 +0200 Subject: [PATCH] Plotters working with Folders at layers --- ChartingSpace/PlottersManager.js | 36 ++++++------- .../FunctionLibraries/TaskFunctions.js | 1 - Panels/Layer.js | 52 +++++++++++++------ 3 files changed, 53 insertions(+), 36 deletions(-) diff --git a/ChartingSpace/PlottersManager.js b/ChartingSpace/PlottersManager.js index 5338823ad..db9f03754 100644 --- a/ChartingSpace/PlottersManager.js +++ b/ChartingSpace/PlottersManager.js @@ -125,17 +125,17 @@ function newPlottersManager() { } } - let baseAsset = layer.definition.referenceParent.parentNode.referenceParent.baseAsset.referenceParent.config.codeName - let quotedAsset = layer.definition.referenceParent.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName + let baseAsset = layer.baseAsset.config.codeName + let quotedAsset = layer.quotedAsset.config.codeName let market = { baseAsset: baseAsset, quotedAsset: quotedAsset } - let productDefinition = layer.definition.referenceParent.referenceParent - let bot = layer.definition.referenceParent.referenceParent.parentNode - let dataMine = layer.definition.referenceParent.referenceParent.parentNode.parentNode - let exchange = layer.definition.referenceParent.parentNode.referenceParent.parentNode.parentNode - let plotterModule = layer.definition.referenceParent.referenceParent.referenceParent + let productDefinition = layer.productDefinition + let bot = layer.bot + let dataMine = layer.dataMine + let exchange = layer.exchange + let plotterModule = layer.plotterModule let session let tradingSystem let tradingEngine @@ -144,19 +144,17 @@ function newPlottersManager() { A layer can be referencing a Data Product in two different branches of the Network hiriatchy. In one of those braches we can get the Session node, at the other we Cannot. */ - if (layer.definition.referenceParent.parentNode.parentNode !== undefined) { - if (layer.definition.referenceParent.parentNode.parentNode.type === 'Session Reference') { - if (layer.definition.referenceParent.parentNode.parentNode.referenceParent !== undefined) { - session = layer.definition.referenceParent.parentNode.parentNode.referenceParent + let sessionReference = findNodeInNodeBranch(layer.definition, 'Session Reference') - /* From the session we might be able to reach the Trading System or the Trading Engine */ - if (session.tradingSystemReference !== undefined) { - tradingSystem = session.tradingSystemReference.referenceParent - } - if (session.tradingEngineReference !== undefined) { - tradingEngine = session.tradingEngineReference.referenceParent - } - } + if (sessionReference !== undefined) { + session = sessionReference.referenceParent + + /* From the session we might be able to reach the Trading System or the Trading Engine */ + if (session.tradingSystemReference !== undefined) { + tradingSystem = session.tradingSystemReference.referenceParent + } + if (session.tradingEngineReference !== undefined) { + tradingEngine = session.tradingEngineReference.referenceParent } } diff --git a/DesignSpace/Workspace/FunctionLibraries/TaskFunctions.js b/DesignSpace/Workspace/FunctionLibraries/TaskFunctions.js index 2eb918bdc..0db5b5ed0 100644 --- a/DesignSpace/Workspace/FunctionLibraries/TaskFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/TaskFunctions.js @@ -39,7 +39,6 @@ function newTaskFunctions() { 'Process Definition->' + 'Process Output->' + 'Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->' + - 'Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->' + 'Output Dataset->Dataset Definition->Product Definition->' + 'Process Dependencies->' + 'Status Dependency->Status Report->Process Definition->' + diff --git a/Panels/Layer.js b/Panels/Layer.js index f054d6a62..5a382c213 100644 --- a/Panels/Layer.js +++ b/Panels/Layer.js @@ -15,6 +15,9 @@ function newLayer() { quotedAsset: undefined, market: undefined, exchange: undefined, + bot: undefined, + productDefinition: undefined, + dataMine: undefined, plotterModule: undefined, exchangeIcon: undefined, plotterTypeIcon: undefined, @@ -130,6 +133,9 @@ function newLayer() { thisObject.baseAssetIcon = undefined thisObject.quotedAssetIcon = undefined thisObject.networkNode = undefined + thisObject.bot = undefined + thisObject.productDefinition = undefined + thisObject.dataMine = undefined } function initialize(callBackFunction) { @@ -155,7 +161,6 @@ function newLayer() { '->Layer->' + 'Data Product->' + 'Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->' + - 'Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->' + 'Bot Products->Data Mine Products->' + 'Single Market Data->Exchange Data Products->' + 'Session Reference->Session Independent Data->Session Based Data->Exchange Sessions->Session Based Data->Data Storage->Network Node->' + @@ -167,9 +172,8 @@ function newLayer() { 'Exchange Markets->Crypto Exchange->' + 'Product Definition->' + 'Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->' + - 'Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->' + 'Sensor Bot->Indicator Bot->Trading Bot->' + - 'Data Mine->' + + 'Data Mine->' + 'Dataset Definition->' + 'Record Definition->Record Property->Formula->' + 'Data Building Procedure->Procedure Loop->Javascript Code->Procedure Initialization->Javascript Code->' + @@ -205,24 +209,40 @@ function newLayer() { thisObject.payload.uiObject.setErrorMessage('Data Product not Found') return } - if (findNodeInNodeBranch(thisObject.definition, 'Product Definition') === undefined) { - thisObject.payload.uiObject.setErrorMessage('Product Definition not Found') - return - } - if (findNodeInNodeBranch(thisObject.definition, 'Data Mine') === undefined) { - thisObject.payload.uiObject.setErrorMessage('Data Mine not Found') - return - } if (findNodeInNodeBranch(thisObject.definition, 'Market') === undefined) { thisObject.payload.uiObject.setErrorMessage('Market not Found') return - } + } + + thisObject.productDefinition = findNodeInNodeBranch(thisObject.definition, 'Product Definition') + if (thisObject.productDefinition === undefined) { + thisObject.payload.uiObject.setErrorMessage('Product Definition not Found') + return + } + + thisObject.bot = findNodeInNodeBranch(thisObject.definition, 'Sensor Bot') + if (thisObject.bot === undefined) { + thisObject.bot = findNodeInNodeBranch(thisObject.definition, 'Indicator Bot') + } + if (thisObject.bot === undefined) { + thisObject.bot = findNodeInNodeBranch(thisObject.definition, 'Trading Bot') + } + if (thisObject.bot === undefined) { + thisObject.payload.uiObject.setErrorMessage('Bot not Found') + return + } + + thisObject.dataMine = findNodeInNodeBranch(thisObject.definition, 'Data Mine') + if (thisObject.dataMine === undefined) { + thisObject.payload.uiObject.setErrorMessage('Data Mine not Found') + return + } thisObject.exchange = findNodeInNodeBranch(thisObject.definition, 'Crypto Exchange') if (thisObject.exchange === undefined) { thisObject.payload.uiObject.setErrorMessage('Crypto Exchange not Found') return - } + } thisObject.baseAsset = findNodeInNodeBranch(thisObject.definition, 'Market Base Asset') if (thisObject.baseAsset !== undefined) { @@ -240,19 +260,19 @@ function newLayer() { if (thisObject.quotedAsset === undefined) { thisObject.payload.uiObject.setErrorMessage('Market Quoted Asset not Found') return - } + } thisObject.plotterModule = findNodeInNodeBranch(thisObject.definition, 'Plotter Module') if (thisObject.plotterModule === undefined) { thisObject.payload.uiObject.setErrorMessage('Market Quoted Asset not Found') return - } + } thisObject.networkNode = findNodeInNodeBranch(thisObject.definition, 'Network Node') if (thisObject.networkNode === undefined) { thisObject.payload.uiObject.setErrorMessage('Network Node not Found') return - } + } /* Lets listen to our own events to react when we have a Mouse Click */ onMouseClickEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)