Data Mining Running Again

This commit is contained in:
Luis Fernando Molina committed 2020-09-01 12:48:59 +02:00
1 parent edc20a1a0a
commit 4239ef1a40
5 files changed
+70 -68

No files matched your search

+1 -1
View File
@@ -144,7 +144,7 @@ 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.
*/
let sessionReference = findNodeInNodeBranch(layer.definition, 'Session Reference')
let sessionReference = findNodeInNodeMesh(layer.definition, 'Session Reference')
if (sessionReference !== undefined) {
session = sessionReference.referenceParent
@@ -62,7 +62,10 @@ function newTaskFunctions() {
let networkLightingPath = '->Network->Network Node->' +
'Data Storage->Session Independent Data->Exchange Data Products->' +
'Single Market Data->Data Product->Product Definition->' +
'Single Market Data->' +
'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 Mining->Testing Environment->Production Environment->' +
'Exchange Tasks->Crypto Exchange->' +
'Task Manager->Task->' +
+12 -12
View File
@@ -205,46 +205,46 @@ function newLayer() {
}
/* Here we validate that we have all the needed information */
if (findNodeInNodeBranch(thisObject.definition, 'Data Product') === undefined) {
if (findNodeInNodeMesh(thisObject.definition, 'Data Product') === undefined) {
thisObject.payload.uiObject.setErrorMessage('Data Product not Found')
return
}
if (findNodeInNodeBranch(thisObject.definition, 'Market') === undefined) {
if (findNodeInNodeMesh(thisObject.definition, 'Market') === undefined) {
thisObject.payload.uiObject.setErrorMessage('Market not Found')
return
}
thisObject.productDefinition = findNodeInNodeBranch(thisObject.definition, 'Product Definition')
thisObject.productDefinition = findNodeInNodeMesh(thisObject.definition, 'Product Definition')
if (thisObject.productDefinition === undefined) {
thisObject.payload.uiObject.setErrorMessage('Product Definition not Found')
return
}
thisObject.bot = findNodeInNodeBranch(thisObject.definition, 'Sensor Bot')
thisObject.bot = findNodeInNodeMesh(thisObject.definition, 'Sensor Bot')
if (thisObject.bot === undefined) {
thisObject.bot = findNodeInNodeBranch(thisObject.definition, 'Indicator Bot')
thisObject.bot = findNodeInNodeMesh(thisObject.definition, 'Indicator Bot')
}
if (thisObject.bot === undefined) {
thisObject.bot = findNodeInNodeBranch(thisObject.definition, 'Trading Bot')
thisObject.bot = findNodeInNodeMesh(thisObject.definition, 'Trading Bot')
}
if (thisObject.bot === undefined) {
thisObject.payload.uiObject.setErrorMessage('Bot not Found')
return
}
thisObject.dataMine = findNodeInNodeBranch(thisObject.definition, 'Data Mine')
thisObject.dataMine = findNodeInNodeMesh(thisObject.definition, 'Data Mine')
if (thisObject.dataMine === undefined) {
thisObject.payload.uiObject.setErrorMessage('Data Mine not Found')
return
}
thisObject.exchange = findNodeInNodeBranch(thisObject.definition, 'Crypto Exchange')
thisObject.exchange = findNodeInNodeMesh(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')
thisObject.baseAsset = findNodeInNodeMesh(thisObject.definition, 'Market Base Asset')
if (thisObject.baseAsset !== undefined) {
thisObject.baseAsset = thisObject.baseAsset.referenceParent
}
@@ -253,7 +253,7 @@ function newLayer() {
return
}
thisObject.quotedAsset = findNodeInNodeBranch(thisObject.definition, 'Market Quoted Asset')
thisObject.quotedAsset = findNodeInNodeMesh(thisObject.definition, 'Market Quoted Asset')
if (thisObject.quotedAsset !== undefined) {
thisObject.quotedAsset = thisObject.quotedAsset.referenceParent
}
@@ -262,13 +262,13 @@ function newLayer() {
return
}
thisObject.plotterModule = findNodeInNodeBranch(thisObject.definition, 'Plotter Module')
thisObject.plotterModule = findNodeInNodeMesh(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')
thisObject.networkNode = findNodeInNodeMesh(thisObject.definition, 'Network Node')
if (thisObject.networkNode === undefined) {
thisObject.payload.uiObject.setErrorMessage('Network Node not Found')
return
-54
View File
@@ -36,57 +36,3 @@ function nodeBranchToArray(node, nodeType) {
}
}
}
function findNodeInNodeBranch(node, nodeType) {
/*
This function scans a node branch for a certain node type and
returns the first instance found.
*/
let nodeFound
scanNodeBranch(node, nodeType)
return nodeFound
function scanNodeBranch(startingNode) {
if (startingNode === undefined) { return }
if (nodeFound !== undefined) { return }
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
if (nodeDefinition === undefined) { return }
if (startingNode.type === nodeType) {
nodeFound = startingNode
return
}
/* We scan through this node children */
if (nodeDefinition.properties !== undefined) {
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
scanNodeBranch(startingNode[property.name])
}
break
case 'array': {
let startingNodePropertyArray = startingNode[property.name]
if (startingNodePropertyArray !== undefined) {
for (let m = 0; m < startingNodePropertyArray.length; m++) {
scanNodeBranch(startingNodePropertyArray[m])
}
}
break
}
}
}
}
/* We scan parents nodes. */
if (startingNode.parentNode !== undefined) {
scanNodeBranch(startingNode.parentNode)
}
/* We scan reference parents too. */
if (startingNode.referenceParent !== undefined) {
scanNodeBranch(startingNode.referenceParent)
}
}
}
+53
View File
@@ -0,0 +1,53 @@
function findNodeInNodeMesh(node, nodeType) {
/*
This function scans a node mesh for a certain node type and
returns the first instance found.
*/
let nodeFound
scanNodeMesh(node, nodeType)
return nodeFound
function scanNodeMesh(startingNode) {
if (startingNode === undefined) { return }
if (nodeFound !== undefined) { return }
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
if (nodeDefinition === undefined) { return }
if (startingNode.type === nodeType) {
nodeFound = startingNode
return
}
/* We scan through this node children */
if (nodeDefinition.properties !== undefined) {
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
scanNodeMesh(startingNode[property.name])
}
break
case 'array': {
let startingNodePropertyArray = startingNode[property.name]
if (startingNodePropertyArray !== undefined) {
for (let m = 0; m < startingNodePropertyArray.length; m++) {
scanNodeMesh(startingNodePropertyArray[m])
}
}
break
}
}
}
}
/* We scan parents nodes. */
if (startingNode.parentNode !== undefined) {
scanNodeMesh(startingNode.parentNode)
}
/* We scan reference parents too. */
if (startingNode.referenceParent !== undefined) {
scanNodeMesh(startingNode.referenceParent)
}
}
}