Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop
This commit is contained in:
commit
36a1738532
39 files changed
+1333
-299
No files matched your search
+416
-8
@@ -8331,7 +8331,7 @@
|
||||
}
|
||||
],
|
||||
"initialValues": {
|
||||
"config": "{ \n\"param1Name\": \"Choose your own names for your parameters. Also, you can add as many as you want.\",\n\"param2Name\": 0\n}"
|
||||
"config": "{ \n\"param1Name\": \"A text string value example\",\n\"param2Name\": 0\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"editors": {
|
||||
@@ -9056,6 +9056,21 @@
|
||||
"relatedUiObject": "Output Dataset",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Output Dataset Folder",
|
||||
"relatedUiObject": "Output Dataset Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add All Output Datasets",
|
||||
"label": "Add All Output Datasets",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Proceed",
|
||||
"workDoneLabel": "Done",
|
||||
"relatedUiObject": "Output Dataset",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -9077,7 +9092,13 @@
|
||||
"name": "outputDatasets",
|
||||
"type": "array",
|
||||
"childType": "Output Dataset",
|
||||
"autoAdd": true
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "outputDatasetFolders",
|
||||
"type": "array",
|
||||
"childType": "Output Dataset Folder",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "processOutput"
|
||||
@@ -9248,6 +9269,100 @@
|
||||
"icon": "execution-finished-event",
|
||||
"propertyNameAtParent": "executionFinishedEvent"
|
||||
},
|
||||
{
|
||||
"type": "Output Dataset Folder",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Output Dataset",
|
||||
"relatedUiObject": "Output Dataset",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Output Dataset Folder",
|
||||
"relatedUiObject": "Output Dataset Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete",
|
||||
"iconPathOff": "delete",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Process Output->Output Dataset Folder->"
|
||||
},
|
||||
"icon": "scripts-library",
|
||||
"properties": [
|
||||
{
|
||||
"name": "outputDatasets",
|
||||
"type": "array",
|
||||
"childType": "Output Dataset",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "outputDatasetFolders",
|
||||
"type": "array",
|
||||
"childType": "Output Dataset Folder",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "outputDatasetFolders"
|
||||
},
|
||||
{
|
||||
"type": "Product Definition Folder",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Product Definition",
|
||||
"relatedUiObject": "Product Definition",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Product Definition Folder",
|
||||
"relatedUiObject": "Product Definition Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete",
|
||||
"iconPathOff": "delete",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Trading Bot->Product Definition Folder->"
|
||||
},
|
||||
"icon": "scripts-library",
|
||||
"properties": [
|
||||
{
|
||||
"name": "products",
|
||||
"type": "array",
|
||||
"childType": "Product Definition",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "productDefinitionFolders",
|
||||
"type": "array",
|
||||
"childType": "Product Definition Folder",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "productDefinitionFolders"
|
||||
},
|
||||
{
|
||||
"type": "Product Definition",
|
||||
"docURL": "https://docs.superalgos.org/suite-hierarchy-data-mine.html#product-definition",
|
||||
@@ -9303,7 +9418,7 @@
|
||||
"compatibleTypes": "->Plotter Module->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Sensor Bot->Indicator Bot->Trading Bot->"
|
||||
"compatibleTypes": "->Sensor Bot->Indicator Bot->Trading Bot->Product Definition Folder->"
|
||||
},
|
||||
"icon": "product-definition",
|
||||
"properties": [
|
||||
@@ -9457,7 +9572,7 @@
|
||||
"compatibleTypes": "->Dataset Definition->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Process Output->"
|
||||
"compatibleTypes": "->Process Output->Output Dataset Folder->"
|
||||
},
|
||||
"icon": "output-dataset",
|
||||
"propertyNameAtParent": "outputDatasets"
|
||||
@@ -9854,6 +9969,12 @@
|
||||
"relatedUiObject": "Product Definition",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Product Definition Folder",
|
||||
"relatedUiObject": "Product Definition Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -9889,6 +10010,12 @@
|
||||
"type": "array",
|
||||
"childType": "Product Definition",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "productDefinitionFolders",
|
||||
"type": "array",
|
||||
"childType": "Product Definition Folder",
|
||||
"autoAdd": true
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "tradingBots"
|
||||
@@ -13033,6 +13160,15 @@
|
||||
"relatedUiObject": "Layer",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add All Data Mine Layers",
|
||||
"label": "Add All Data Mine Layers",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Proceed",
|
||||
"workDoneLabel": "Done",
|
||||
"relatedUiObject": "Data Mine Products",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -13047,6 +13183,9 @@
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"title": [
|
||||
"Use Reference Parent"
|
||||
],
|
||||
"initialValues": {
|
||||
"config": "{ \n\"visibleLayers\": 5\n}"
|
||||
},
|
||||
@@ -13055,13 +13194,22 @@
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Timeline Chart->"
|
||||
},
|
||||
"referenceAttachesTo": {
|
||||
"compatibleTypes": "->Data Mine Products->"
|
||||
},
|
||||
"propertyNameAtParent": "layersManager",
|
||||
"properties": [
|
||||
{
|
||||
"name": "layers",
|
||||
"type": "array",
|
||||
"childType": "Layer",
|
||||
"autoAdd": true
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "botLayers",
|
||||
"type": "array",
|
||||
"childType": "Bot Layers",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -13111,7 +13259,7 @@
|
||||
"compatibleTypes": "->Data Product->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Layer Manager->Layers Manager->"
|
||||
"compatibleTypes": "->Layers Manager->Bot Layers->Layer Folder->"
|
||||
},
|
||||
"icon": "attractive",
|
||||
"propertyNameAtParent": "layers",
|
||||
@@ -13123,6 +13271,100 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Bot Layers",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Layer",
|
||||
"relatedUiObject": "Layer",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Layer Folder",
|
||||
"relatedUiObject": "Layer Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete",
|
||||
"iconPathOff": "delete",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"icon": "brainstorming",
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Layers Manager->"
|
||||
},
|
||||
"propertyNameAtParent": "botLayers",
|
||||
"properties": [
|
||||
{
|
||||
"name": "layers",
|
||||
"type": "array",
|
||||
"childType": "Layer",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "layerFolders",
|
||||
"type": "array",
|
||||
"childType": "Layer Folder",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Layer Folder",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Layer",
|
||||
"relatedUiObject": "Layer",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Layer Folder",
|
||||
"relatedUiObject": "Layer Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete",
|
||||
"iconPathOff": "delete",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"icon": "band",
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Layer Folder->Bot Layers->"
|
||||
},
|
||||
"propertyNameAtParent": "layerFolders",
|
||||
"properties": [
|
||||
{
|
||||
"name": "layers",
|
||||
"type": "array",
|
||||
"childType": "Layer",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "layerFolders",
|
||||
"type": "array",
|
||||
"childType": "Layer Folder",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Data Storage",
|
||||
"docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#data-storage",
|
||||
@@ -13611,6 +13853,21 @@
|
||||
"type": "Single Market Data",
|
||||
"docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#single-market-data",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Data Mine Products",
|
||||
"relatedUiObject": "Data Mine Products",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add All Data Mine Products",
|
||||
"label": "Add All Data Mine Products",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Proceed",
|
||||
"workDoneLabel": "Done",
|
||||
"relatedUiObject": "Data Mine Products",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Data Product",
|
||||
@@ -13647,7 +13904,13 @@
|
||||
"name": "dataProducts",
|
||||
"type": "array",
|
||||
"childType": "Data Product",
|
||||
"autoAdd": true
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "dataMineProducts",
|
||||
"type": "array",
|
||||
"childType": "Data Mine Products",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -13676,9 +13939,154 @@
|
||||
"compatibleTypes": "->Product Definition->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Single Market Data->"
|
||||
"compatibleTypes": "->Single Market Data->Data Product Folder->Bot Products->"
|
||||
},
|
||||
"propertyNameAtParent": "dataProducts",
|
||||
"properties": []
|
||||
},
|
||||
{
|
||||
"type": "Data Mine Products",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Bot Products",
|
||||
"relatedUiObject": "Bot Products",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add All Data Products",
|
||||
"label": "Add All Data Products",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Proceed",
|
||||
"workDoneLabel": "Done",
|
||||
"relatedUiObject": "Data Product",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete",
|
||||
"iconPathOff": "delete",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"icon": "arrangement-horizontal-bottom",
|
||||
"isTitleAllwaysVisible": true,
|
||||
"title": [
|
||||
"Use Reference Parent"
|
||||
],
|
||||
"referenceAttachesTo": {
|
||||
"compatibleTypes": "->Data Mine->"
|
||||
},
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Single Market Data->"
|
||||
},
|
||||
"propertyNameAtParent": "dataMineProducts",
|
||||
"properties": [
|
||||
{
|
||||
"name": "botProducts",
|
||||
"type": "array",
|
||||
"childType": "Bot Products",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Bot Products",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Data Product",
|
||||
"relatedUiObject": "Data Product",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Data Product Folder",
|
||||
"relatedUiObject": "Data Product Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete",
|
||||
"iconPathOff": "delete",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"icon": "brainstorming",
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Data Mine Products->"
|
||||
},
|
||||
"propertyNameAtParent": "botProducts",
|
||||
"properties": [
|
||||
{
|
||||
"name": "dataProducts",
|
||||
"type": "array",
|
||||
"childType": "Data Product",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "dataProductFolders",
|
||||
"type": "array",
|
||||
"childType": "Data Product Folder",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Data Product Folder",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Data Product",
|
||||
"relatedUiObject": "Data Product",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Data Product Folder",
|
||||
"relatedUiObject": "Data Product Folder",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete",
|
||||
"iconPathOff": "delete",
|
||||
"actionFunction": "payload.onMenuItemClick"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"icon": "band",
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Data Product Folder->Bot Products->"
|
||||
},
|
||||
"propertyNameAtParent": "dataProductFolders",
|
||||
"properties": [
|
||||
{
|
||||
"name": "dataProducts",
|
||||
"type": "array",
|
||||
"childType": "Data Product",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "dataProductFolders",
|
||||
"type": "array",
|
||||
"childType": "Data Product Folder",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -54,6 +54,9 @@ function newAppLoader() {
|
||||
'DesignSpace/Workspace/FunctionLibraries/WebhookFunctions.js',
|
||||
'DesignSpace/Workspace/FunctionLibraries/DependenciesFilter.js',
|
||||
'DesignSpace/Workspace/FunctionLibraries/NodePath.js',
|
||||
'DesignSpace/Workspace/FunctionLibraries/DataMineFunctions.js',
|
||||
'DesignSpace/Workspace/FunctionLibraries/DataStorageFunctions.js',
|
||||
'DesignSpace/Workspace/FunctionLibraries/ChartingSpaceFunctions.js',
|
||||
|
||||
'Utilities/CoordinateTransformations.js',
|
||||
'Utilities/DateRateTransformations.js',
|
||||
@@ -63,6 +66,9 @@ function newAppLoader() {
|
||||
'Utilities/LoadSaveFrame.js',
|
||||
'Utilities/NodeConfig.js',
|
||||
'Utilities/HiriarchyMap.js',
|
||||
'Utilities/Folders.js',
|
||||
'Utilities/Branches.js',
|
||||
'Utilities/Meshes.js',
|
||||
|
||||
'Panels/LayersPanel.js',
|
||||
'Panels/UpDownButton.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 = findNodeInNodeMesh(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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -672,8 +672,9 @@ function newTimeMachine() {
|
||||
for (let i = 0; i < thisObject.timelineCharts.length; i++) {
|
||||
let timelinechart = thisObject.timelineCharts[i]
|
||||
if (timelinechart.layersManager !== undefined) {
|
||||
for (let j = 0; j < timelinechart.layersManager.layers.length; j++) {
|
||||
let layer = timelinechart.layersManager.layers[j]
|
||||
let layers = timelinechart.layersManager.layers
|
||||
for (let j = 0; j < layers.length; j++) {
|
||||
let layer = layers[j]
|
||||
|
||||
exchangeMarket = {
|
||||
exchangeName: layer.exchange.name,
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
function newChartingSpaceFunctions() {
|
||||
thisObject = {
|
||||
addAllDataMineLayers: addAllDataMineLayers
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function addAllDataMineLayers(node, functionLibraryUiObjectsFromNodes) {
|
||||
|
||||
/* Validations to see if we can do this or not. */
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (node.payload.referenceParent === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('You need to have a reference parent node to execute this action.')
|
||||
return
|
||||
}
|
||||
if (node.payload.referenceParent.payload === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('You need to have a reference parent node to execute this action.')
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
We are going to go through the referenced branch and recreate the structure
|
||||
we find there inside the layers manager. We will end up having at the end
|
||||
all layers referencing the data products inside the referenced branch.
|
||||
*/
|
||||
let dataMine = node.payload.referenceParent
|
||||
scanBotArray(dataMine.botProducts)
|
||||
|
||||
function scanBotArray(botArray) {
|
||||
for (let i = 0; i < botArray.length; i++) {
|
||||
let bot = botArray[i]
|
||||
let botLayers = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Bot Layers')
|
||||
botLayers.name = bot.name
|
||||
|
||||
asymetricalFolderStructureCloning(
|
||||
bot,
|
||||
botLayers,
|
||||
'dataProducts',
|
||||
'dataProductFolders',
|
||||
'layerFolders',
|
||||
'Layer',
|
||||
'Layer Folder',
|
||||
undefined,
|
||||
functionLibraryUiObjectsFromNodes
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
function newDataMineFunctions() {
|
||||
thisObject = {
|
||||
addAllOutputDatasets: addAllOutputDatasets
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function addAllOutputDatasets(node, functionLibraryUiObjectsFromNodes) {
|
||||
|
||||
/* Validations to see if we can do this or not. */
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (node.payload.parentNode === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('You need to have a parent node to execute this action.')
|
||||
return
|
||||
}
|
||||
if (node.payload.parentNode.payload === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('You need to have a parent node to execute this action.')
|
||||
return
|
||||
}
|
||||
if (node.payload.parentNode.payload.parentNode === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('You need to have a grand parent node to execute this action.')
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
Next, we are going to scan recursively through all nodes of type Product Definition Folder
|
||||
and Product Definition. For each Product Definition Folder we will create a counterpart
|
||||
Output Dataset Folder, and for each Product Definition found we will create a Output Definition
|
||||
for each Dataset defined inside the Product Definition.
|
||||
*/
|
||||
asymetricalFolderStructureCloning(
|
||||
node.payload.parentNode.payload.parentNode,
|
||||
node,
|
||||
'products',
|
||||
'productDefinitionFolders',
|
||||
'outputDatasetFolders',
|
||||
'Output Dataset',
|
||||
'Output Dataset Folder',
|
||||
'datasets',
|
||||
functionLibraryUiObjectsFromNodes
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
function newDataStorageFunctions() {
|
||||
thisObject = {
|
||||
addAllDataProducts: addAllDataProducts,
|
||||
addAllDataMineProducts: addAllDataMineProducts
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function addAllDataProducts(node, functionLibraryUiObjectsFromNodes) {
|
||||
|
||||
/* Validations to see if we can do this or not. */
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (node.payload.referenceParent === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('You need to have a reference parent node to execute this action.')
|
||||
return
|
||||
}
|
||||
if (node.payload.referenceParent.payload === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('You need to have a reference parent node to execute this action.')
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
Next, we are going to scan through all the bots of the Data Mine referenced, and for each bot we will
|
||||
create a Bots Products node. Later we will scan all the Products Definitions of each bot, and for each one
|
||||
we will create a Data Product. In case we find Product Definition Folders, we will recreate that structure
|
||||
too, using in this case Data Product Folders.
|
||||
*/
|
||||
let dataMine = node.payload.referenceParent
|
||||
scanBotArray(dataMine.sensorBots)
|
||||
scanBotArray(dataMine.indicatorBots)
|
||||
scanBotArray(dataMine.tradingBots)
|
||||
|
||||
function scanBotArray(botArray) {
|
||||
for (let i = 0; i < botArray.length; i++) {
|
||||
let bot = botArray[i]
|
||||
let botProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Bot Products')
|
||||
botProducts.name = bot.name
|
||||
|
||||
asymetricalFolderStructureCloning(
|
||||
bot,
|
||||
botProducts,
|
||||
'products',
|
||||
'productDefinitionFolders',
|
||||
'dataProductFolders',
|
||||
'Data Product',
|
||||
'Data Product Folder',
|
||||
undefined,
|
||||
functionLibraryUiObjectsFromNodes
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addAllDataMineProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
for (let i = 0; i < rootNodes.length; i++) {
|
||||
let rootNode = rootNodes[i]
|
||||
|
||||
if (rootNode.type === 'Data Mine') {
|
||||
let dataMineProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Data Mine Products')
|
||||
dataMineProducts.payload.referenceParent = rootNode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,8 @@ function newProtocolNode() {
|
||||
let newLightingPath = getNewLightingPath(lightingPath, node.type, node.payload.parentNode.type)
|
||||
if (newLightingPath !== undefined) {
|
||||
object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseConfig, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
|
||||
} else {
|
||||
let newLightingPath = getNewLightingPath(lightingPath, node.type, node.payload.parentNode.type)
|
||||
}
|
||||
}
|
||||
if (node.payload.referenceParent !== undefined) {
|
||||
@@ -121,6 +123,16 @@ function newProtocolNode() {
|
||||
let currentNodePosition = lightingPath.indexOf('->' + currentNodeType + '->')
|
||||
let nextNodePosition = lightingPath.indexOf('->' + nextNodeType + '->')
|
||||
|
||||
/*
|
||||
In some situations, the current and next node are of the same type.
|
||||
When that happens, we need to search for the second instance of that type
|
||||
at the lighting path.
|
||||
*/
|
||||
if (currentNodeType === nextNodeType) {
|
||||
let tempLightingPath = lightingPath.substring(currentNodePosition + currentNodeType.length, lightingPath.length + 1)
|
||||
nextNodePosition = tempLightingPath.indexOf('->' + nextNodeType + '->')
|
||||
}
|
||||
|
||||
let newLightingPath = lightingPath.substring(nextNodePosition, lightingPath.length + 1)
|
||||
|
||||
if (nextNodePosition > currentNodePosition) {
|
||||
|
||||
@@ -97,7 +97,6 @@ function newSessionFunctions() {
|
||||
|
||||
/* Raise event to run the session */
|
||||
let event = {
|
||||
appSchema: JSON.stringify(APP_SCHEMA_ARRAY),
|
||||
session: JSON.stringify(session),
|
||||
tradingSystem: JSON.stringify(tradingSystem),
|
||||
tradingEngine: JSON.stringify(tradingEngine),
|
||||
|
||||
@@ -37,7 +37,9 @@ function newTaskFunctions() {
|
||||
'Market Base Asset->Market Quoted Asset->Asset->' +
|
||||
'Backtesting Session->Live Trading Session->Paper Trading Session->Fordward Testing Session->' +
|
||||
'Process Definition->' +
|
||||
'Process Output->Output Dataset->Dataset Definition->Product Definition->' +
|
||||
'Process Output->' +
|
||||
'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->' +
|
||||
'Data Dependency->Dataset Definition->Product Definition->' +
|
||||
@@ -52,6 +54,7 @@ function newTaskFunctions() {
|
||||
'Execution Finished Event->' +
|
||||
'Execution Started Event->Execution Finished Event->Process Definition->' +
|
||||
'Sensor Bot->' +
|
||||
'Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->' +
|
||||
'Indicator Bot->' +
|
||||
'Trading Bot->' +
|
||||
'Data Mine->'
|
||||
@@ -60,7 +63,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->' +
|
||||
@@ -73,6 +79,7 @@ function newTaskFunctions() {
|
||||
let networkDefinition = functionLibraryProtocolNode.getProtocolNode(networkNode.payload.parentNode, false, true, true, false, false, networkLightingPath)
|
||||
|
||||
let event = {
|
||||
appSchema: JSON.stringify(APP_SCHEMA_ARRAY),
|
||||
taskId: node.id,
|
||||
taskName: node.name,
|
||||
taskDefinition: JSON.stringify(taskDefinition),
|
||||
|
||||
@@ -66,6 +66,9 @@ function newWorkspace() {
|
||||
let functionLibraryWebhookFunctions = newWebhookFunctions()
|
||||
let functionLibraryDependenciesFilter = newDependenciesFilter()
|
||||
let functionLibraryNodePath = newNodePath()
|
||||
let functionLibraryDataMineFunctions = newDataMineFunctions()
|
||||
let functionLibraryDataStorageFunctions = newDataStorageFunctions()
|
||||
let functionLibraryChartingSpaceFunctions = newChartingSpaceFunctions()
|
||||
|
||||
thisObject.nodeChildren = newNodeChildren()
|
||||
|
||||
@@ -612,6 +615,26 @@ function newWorkspace() {
|
||||
functionLibraryCCXTFunctions.addMissingMarkets(payload.node, functionLibraryUiObjectsFromNodes, functionLibraryNodeCloning)
|
||||
}
|
||||
break
|
||||
case 'Add All Output Datasets':
|
||||
{
|
||||
functionLibraryDataMineFunctions.addAllOutputDatasets(payload.node, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Add All Data Products':
|
||||
{
|
||||
functionLibraryDataStorageFunctions.addAllDataProducts(payload.node, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Add All Data Mine Products':
|
||||
{
|
||||
functionLibraryDataStorageFunctions.addAllDataMineProducts(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Add All Data Mine Layers':
|
||||
{
|
||||
functionLibraryChartingSpaceFunctions.addAllDataMineLayers(payload.node, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Send Webhook Test Message':
|
||||
{
|
||||
functionLibraryWebhookFunctions.sendTestMessage(payload.node, callBackFunction)
|
||||
|
||||
@@ -199,8 +199,14 @@ function newEventsServerClient(networkNode) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
networkNode.payload.uiObject.setStatus('Connected to Superalgos Backend via WebSockets.')
|
||||
retryCommandsPhysics()
|
||||
if (networkNode !== undefined) {
|
||||
if (networkNode.payload !== undefined) {
|
||||
if (networkNode.payload.uiObject !== undefined) {
|
||||
networkNode.payload.uiObject.setStatus('Connected to Superalgos Backend via WebSockets.')
|
||||
retryCommandsPhysics()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG.variable4 = 'Commands Waiting For Confirmation from WS Server: ' + commandsWaitingConfirmation.size
|
||||
|
||||
@@ -74,12 +74,6 @@ function newFloatingLayer() {
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
|
||||
for (let i = 0; i < invisibleFloatingObjects.length; i++) {
|
||||
let floatingObject = invisibleFloatingObjects[i]
|
||||
container = floatingObject.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
|
||||
return container
|
||||
}
|
||||
|
||||
|
||||
@@ -111,9 +111,12 @@ function newFloatingObject() {
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
|
||||
if (thisObject.payload === undefined) { return }
|
||||
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
|
||||
if (canvas.floatingSpace.inMapMode === true) { return }
|
||||
|
||||
let container
|
||||
|
||||
container = thisObject.payload.uiObject.getContainer(point)
|
||||
|
||||
@@ -242,6 +242,7 @@ function newUiObject() {
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
let container
|
||||
|
||||
if (isDragging === false && thisObject.isOnFocus === true) {
|
||||
@@ -1244,22 +1245,21 @@ function newUiObject() {
|
||||
}
|
||||
|
||||
function drawMiddleground() {
|
||||
if (thisObject.isOnFocus === false) {
|
||||
drawBodyAndPicture()
|
||||
if (thisObject.isOnFocus === false) {
|
||||
drawErrorMessage()
|
||||
drawWarningMessage()
|
||||
drawInfoMessage()
|
||||
drawValue()
|
||||
drawPercentage()
|
||||
drawStatus()
|
||||
drawText()
|
||||
thisObject.uiObjectTitle.draw()
|
||||
drawText()
|
||||
}
|
||||
}
|
||||
|
||||
function drawForeground() {
|
||||
if (thisObject.isOnFocus === false) {
|
||||
|
||||
drawBodyAndPicture()
|
||||
if (isDragging === false) {
|
||||
thisObject.menu.drawForeground()
|
||||
}
|
||||
|
||||
+93
-46
@@ -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) {
|
||||
@@ -153,7 +159,10 @@ function newLayer() {
|
||||
let functionLibraryProtocolNode = newProtocolNode()
|
||||
let lightingPath =
|
||||
'->Layer->' +
|
||||
'Data Product->Single Market Data->Exchange Data Products->' +
|
||||
'Data Product->' +
|
||||
'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->' +
|
||||
'Data Storage->Network Node->' +
|
||||
'Backtesting Session->Paper Trading Session->Fordward Testing Session->Live Trading Session->' +
|
||||
@@ -162,6 +171,7 @@ function newLayer() {
|
||||
'Market Quoted Asset->Asset->' +
|
||||
'Exchange Markets->Crypto Exchange->' +
|
||||
'Product Definition->' +
|
||||
'Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->' +
|
||||
'Sensor Bot->Indicator Bot->Trading Bot->' +
|
||||
'Data Mine->' +
|
||||
'Dataset Definition->' +
|
||||
@@ -180,53 +190,96 @@ function newLayer() {
|
||||
'Nodes Highlights->Nodes Values->Nodes Errors->Nodes Warnings->Nodes Infos->Nodes Status->Nodes Progress->Nodes Running->Nodes Announcements->Record Values->'
|
||||
thisObject.definition = functionLibraryProtocolNode.getProtocolNode(thisObject.payload.node, false, true, true, false, false, lightingPath)
|
||||
|
||||
/* Without this I can not continue, because I can not even show error. */
|
||||
if (thisObject.payload === undefined) {
|
||||
console.log(MODULE_NAME + ' ' + 'thisObject.payload === undefined')
|
||||
return
|
||||
}
|
||||
if (thisObject.payload.uiObject === undefined) {
|
||||
console.log(MODULE_NAME + ' ' + 'thisObject.payload.uiObject === undefined')
|
||||
return
|
||||
}
|
||||
if (thisObject.payload.node === undefined) {
|
||||
console.log(MODULE_NAME + ' ' + 'thisObject.payload.node === undefined')
|
||||
return
|
||||
}
|
||||
|
||||
/* Here we validate that we have all the needed information */
|
||||
if (thisObject.definition.referenceParent === undefined) { return } // Data Product
|
||||
if (thisObject.definition.referenceParent.parentNode === undefined) { return } // Single Market Data
|
||||
if (thisObject.definition.referenceParent.parentNode.referenceParent === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.referenceParent.parentNode === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.referenceParent.parentNode.parentNode === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.referenceParent.baseAsset === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.referenceParent.baseAsset.referenceParent === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.referenceParent.quotedAsset === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.referenceParent.quotedAsset.referenceParent === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.referenceParent === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.referenceParent.parentNode === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.referenceParent.parentNode.parentNode === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.parentNode === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.parentNode.parentNode === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.parentNode.parentNode.parentNode === undefined) { return }
|
||||
if (thisObject.definition.referenceParent.parentNode.parentNode.parentNode.parentNode.parentNode === undefined) { return }
|
||||
if (findNodeInNodeMesh(thisObject.definition, 'Data Product') === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Data Product not Found')
|
||||
return
|
||||
}
|
||||
if (findNodeInNodeMesh(thisObject.definition, 'Market') === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Market not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.productDefinition = findNodeInNodeMesh(thisObject.definition, 'Product Definition')
|
||||
if (thisObject.productDefinition === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Product Definition not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.bot = findNodeInNodeMesh(thisObject.definition, 'Sensor Bot')
|
||||
if (thisObject.bot === undefined) {
|
||||
thisObject.bot = findNodeInNodeMesh(thisObject.definition, 'Indicator Bot')
|
||||
}
|
||||
if (thisObject.bot === undefined) {
|
||||
thisObject.bot = findNodeInNodeMesh(thisObject.definition, 'Trading Bot')
|
||||
}
|
||||
if (thisObject.bot === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Bot not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.dataMine = findNodeInNodeMesh(thisObject.definition, 'Data Mine')
|
||||
if (thisObject.dataMine === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Data Mine not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.exchange = findNodeInNodeMesh(thisObject.definition, 'Crypto Exchange')
|
||||
if (thisObject.exchange === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Crypto Exchange not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.baseAsset = findNodeInNodeMesh(thisObject.definition, 'Market Base Asset')
|
||||
if (thisObject.baseAsset !== undefined) {
|
||||
thisObject.baseAsset = thisObject.baseAsset.referenceParent
|
||||
}
|
||||
if (thisObject.baseAsset === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Market Base Asset not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.quotedAsset = findNodeInNodeMesh(thisObject.definition, 'Market Quoted Asset')
|
||||
if (thisObject.quotedAsset !== undefined) {
|
||||
thisObject.quotedAsset = thisObject.quotedAsset.referenceParent
|
||||
}
|
||||
if (thisObject.quotedAsset === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Market Quoted Asset not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.plotterModule = findNodeInNodeMesh(thisObject.definition, 'Plotter Module')
|
||||
if (thisObject.plotterModule === undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage('Market Quoted Asset not Found')
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.networkNode = findNodeInNodeMesh(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)
|
||||
|
||||
/* Get ready to draw this layer */
|
||||
thisObject.baseAsset = thisObject.definition.referenceParent.parentNode.referenceParent.baseAsset.referenceParent
|
||||
thisObject.quotedAsset = thisObject.definition.referenceParent.parentNode.referenceParent.quotedAsset.referenceParent
|
||||
thisObject.market = thisObject.baseAsset.config.codeName + '/' + thisObject.quotedAsset.config.codeName
|
||||
thisObject.exchange = thisObject.definition.referenceParent.parentNode.referenceParent.parentNode.parentNode
|
||||
|
||||
/* Some basic validations. */
|
||||
if (thisObject.definition.referenceParent === undefined) {
|
||||
console.log('[WARN] Could not start plotter because ' + thisObject.definition.type + ' ' + thisObject.definition.name + ' does not have a Reference Parent.')
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
|
||||
return
|
||||
}
|
||||
|
||||
if (thisObject.definition.referenceParent.referenceParent === undefined) {
|
||||
console.log('[WARN] Could not start plotter because ' + thisObject.definition.referenceParent.type + ' ' + thisObject.definition.referenceParent.name + ' does not have a Reference Parent.')
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
|
||||
return
|
||||
}
|
||||
|
||||
if (thisObject.definition.referenceParent.referenceParent.referenceParent === undefined) {
|
||||
console.log('[WARN] Could not start plotter because ' + thisObject.definition.referenceParent.referenceParent.type + ' ' + thisObject.definition.referenceParent.referenceParent.name + ' does not have a Reference Parent.')
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.plotterModule = thisObject.definition.referenceParent.referenceParent.referenceParent
|
||||
thisObject.exchangeIcon = getIcon(thisObject.exchange)
|
||||
|
||||
if (thisObject.plotterModule.config.icon !== undefined) {
|
||||
@@ -236,12 +289,6 @@ function newLayer() {
|
||||
thisObject.baseAssetIcon = getIcon(thisObject.baseAsset)
|
||||
thisObject.quotedAssetIcon = getIcon(thisObject.quotedAsset)
|
||||
|
||||
if (thisObject.definition.referenceParent.parentNode.parentNode.parentNode.parentNode.type === 'Data Storage') {
|
||||
thisObject.networkNode = thisObject.definition.referenceParent.parentNode.parentNode.parentNode.parentNode.parentNode
|
||||
} else {
|
||||
thisObject.networkNode = thisObject.definition.referenceParent.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
||||
}
|
||||
|
||||
function getIcon(node) {
|
||||
let nodeDefinition = getNodeDefinition(node)
|
||||
let iconName
|
||||
|
||||
@@ -375,8 +375,9 @@ function newLayersPanel() {
|
||||
function syncWithDesignerLayers() {
|
||||
if (thisObject.payload.node === undefined) { return }
|
||||
let layerManager = thisObject.payload.node
|
||||
for (let p = 0; p < layerManager.layers.length; p++) {
|
||||
let layerNode = layerManager.layers[p]
|
||||
let layers = nodeBranchToArray(layerManager, 'Layer')
|
||||
for (let p = 0; p < layers.length; p++) {
|
||||
let layerNode = layers[p]
|
||||
|
||||
let found = removeFromLocalLayers(layerNode.id)
|
||||
if (found !== true) {
|
||||
|
||||
@@ -42,7 +42,7 @@ function newRecordValues() {
|
||||
The Product Root Node is the root of the node hiriarchy from where we are going to extract the record values.
|
||||
*/
|
||||
let productRootNode = productRoot[index]
|
||||
scanProperties(productRootNode, index)
|
||||
scanProperties(productDefinition, productRootNode, index)
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
function nodeBranchToArray(node, nodeType) {
|
||||
/*
|
||||
This function scans a node branch for a certain node type and
|
||||
return an array of with all the nodes of that type found.
|
||||
*/
|
||||
let resultArray = []
|
||||
scanNodeBranch(node, nodeType)
|
||||
return resultArray
|
||||
|
||||
function scanNodeBranch(startingNode) {
|
||||
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (startingNode.type === nodeType) {
|
||||
resultArray.push(startingNode)
|
||||
return
|
||||
}
|
||||
|
||||
if (nodeDefinition.properties === undefined) { return }
|
||||
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]
|
||||
for (let m = 0; m < startingNodePropertyArray.length; m++) {
|
||||
scanNodeBranch(startingNodePropertyArray[m])
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
|
||||
|
||||
function asymetricalFolderStructureCloning(
|
||||
originNode,
|
||||
destinationNode,
|
||||
originObjectsArrayPropertyName,
|
||||
originFoldersArrayPropertyName,
|
||||
destinationFoldersArrayPropertyName,
|
||||
clonedObjectType,
|
||||
destinationFolderType,
|
||||
originObjectArrayPropertyName,
|
||||
functionLibraryUiObjectsFromNodes
|
||||
) {
|
||||
/*
|
||||
This function will scan one branch of the workspace, and recreate
|
||||
a similar structure in some other place, based on the parameters
|
||||
sent to the function is what types of nodes are going to be mapped
|
||||
into which other types.
|
||||
*/
|
||||
if (originNode === undefined) { return }
|
||||
if (destinationNode === undefined) { return }
|
||||
|
||||
/* Now we go down through all the children of the origin node, recreating at the destination node the same children structure*/
|
||||
let nodeDefinition = getNodeDefinition(originNode)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
for (let i = 0; i < nodeDefinition.properties.length; i++) {
|
||||
let property = nodeDefinition.properties[i]
|
||||
|
||||
switch (property.name) {
|
||||
case originObjectsArrayPropertyName: {
|
||||
let originNodePropertyArray = originNode[property.name]
|
||||
for (let m = 0; m < originNodePropertyArray.length; m++) {
|
||||
let originObject = originNodePropertyArray[m]
|
||||
if (originObjectArrayPropertyName === undefined) {
|
||||
/*
|
||||
In this first Use Case, we are going to connect each orgin object clone
|
||||
to its origin object counter part.
|
||||
*/
|
||||
let clonedObject = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, clonedObjectType)
|
||||
clonedObject.payload.referenceParent = originObject
|
||||
} else {
|
||||
/*
|
||||
In this second Use Case, we are going to connect an inner object that is
|
||||
inside the origin object at an array. We recognize we have to do this
|
||||
because we did receive this array proeprty name.
|
||||
*/
|
||||
let originObjectArray = originObject[originObjectArrayPropertyName]
|
||||
for (let n = 0; n < originObjectArray.length; n++) {
|
||||
let originObjectArrayItem = originObjectArray[n]
|
||||
let clonedObject = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, clonedObjectType)
|
||||
clonedObject.payload.referenceParent = originObjectArrayItem
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
case originFoldersArrayPropertyName: {
|
||||
let originNodePropertyArray = originNode[property.name]
|
||||
let destinationNodePropertyArray = destinationNode[destinationFoldersArrayPropertyName]
|
||||
for (let m = 0; m < originNodePropertyArray.length; m++) {
|
||||
let originFolder = originNodePropertyArray[m]
|
||||
let found = false
|
||||
let destinationFolder
|
||||
for (let n = 0; n < destinationNodePropertyArray.length; n++) {
|
||||
destinationFolder = destinationNodePropertyArray[n]
|
||||
if (originFolder.name === destinationFolder.name) {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if (found === false) {
|
||||
destinationFolder = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, destinationFolderType)
|
||||
destinationFolder.name = originFolder.name
|
||||
}
|
||||
asymetricalFolderStructureCloning(
|
||||
originFolder,
|
||||
destinationFolder,
|
||||
originObjectsArrayPropertyName,
|
||||
originFoldersArrayPropertyName,
|
||||
destinationFoldersArrayPropertyName,
|
||||
clonedObjectType,
|
||||
destinationFolderType,
|
||||
originObjectArrayPropertyName,
|
||||
functionLibraryUiObjectsFromNodes
|
||||
)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
{"type":"Data Mine","name":"Masters-Trading","config":"{ \n\"codeName\": \"Masters-Trading\"\n}","sensorBots":[],"indicatorBots":[],"tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","id":"6fc3054e-5034-4fc7-bddf-02360e0a6acf","savedPayload":{"position":{"x":15043.502763626615,"y":13565.633447736122},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"db063d7b-db05-4bf6-941f-999e1ccb38fc"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","id":"c3c2240f-514b-40de-825f-674037117d0b","savedPayload":{"position":{"x":14976.659274738518,"y":13409.942947906273},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"0764aaaf-d970-4f23-9df8-55fe5b7dd273"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","id":"1dfdfc0d-842f-4e63-a591-256ac8a06b0f","savedPayload":{"position":{"x":14914.888630231306,"y":13251.92462190976},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","id":"39360c55-5ba8-413b-b0bd-cac3789ebf5f","savedPayload":{"position":{"x":14858.381757937008,"y":13091.90908668388},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","id":"ba614415-6e4f-4979-97a5-34c72a59e67c","savedPayload":{"position":{"x":14807.274021473277,"y":12930.139909734808},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","id":"1a2e3461-33e6-45b1-bcc1-c56a8c5d275c","savedPayload":{"position":{"x":14761.634620744779,"y":12766.829832535312},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","id":"567e4dc9-4deb-41e4-9ac9-dde943fb91ba","savedPayload":{"position":{"x":14721.557593855016,"y":12602.16006759612},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","id":"e94b9bb3-9f0c-4550-94e1-09de444780a8","savedPayload":{"position":{"x":14687.08147628032,"y":12436.31530565774},"targetPosition":{"x":19587.798820144457,"y":11500.464802301472},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"213b8fe8-f772-41ea-a3f5-97867be555f7"}}},{"type":"Output Dataset","name":"Multi-Period-Market Distance To Event","id":"a30e7306-7be9-41b6-a465-558fdfe2a903","savedPayload":{"position":{"x":14658.226523037441,"y":12269.479511483436},"targetPosition":{"x":19587.7988201444Line truncated
|
||||
{"type":"Data Mine","name":"Masters-Trading","config":"{ \n\"codeName\": \"Masters-Trading\"\n}","sensorBots":[],"indicatorBots":[],"tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Engine","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Episode","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","id":"a1ba5aea-27cf-4789-858f-bcae5e844d68","savedPayload":{"position":{"x":18860.923681487337,"y":18247.525308470573},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"3ed03a02-381d-43fe-9faa-761728c53bd8"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","id":"0545bf38-80e0-4888-88bc-a8710355fa57","savedPayload":{"position":{"x":18718.205605989744,"y":18305.60710763915},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"15f5b150-f1cf-403c-8cb9-2c7c4e1db8e8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","id":"5af42032-7ce1-4afe-95d7-e33ba00794eb","savedPayload":{"position":{"x":18568.617530232634,"y":18331.473839316524},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","id":"d18cec41-5512-44d3-8005-5b9a7fd80461","savedPayload":{"position":{"x":18413.491312433358,"y":18400.55774757291},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","id":"3df1601e-ef97-4103-b90e-364c1b6527f6","savedPayload":{"position":{"x":18277.376927713693,"y":18333.58422678474},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","id":"7745d3f8-0a55-4d1a-9778-1360c5a5fad6","savedPayload":{"position":{"x":18139.788157009552,"y":18275.65069441889},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","id":"f5549653-3d66-4f6b-8aff-44f728772ed9","savedPayload":{"position":{"x":18008.91092339713,"y":18204.882708917103},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","id":"5d016965-9c3b-48bf-8969-157430be4d54","savedPayload":{"position":{"x":17896.83382561979,"y":18108.353338748304},"targetPosition":{"x":18467.88162987363,"y":17550.614477200405},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"213b8fe8-f772-41ea-a3f5-97867be555f7"}}},{"type":"Output Dataset","name":"Multi-PeriodLine truncated
|
||||
@@ -1 +1 @@
|
||||
{"type":"Super Scripts","name":"Masters","code":"{ \n\"codeName\": \"Masters\"\n}","scriptsLibrary":{"type":"Scripts Library","name":"New Scripts Library","masterScripts":[{"type":"Master Script","name":"Setup Market","templateScripts":[{"type":"Template Script","name":"Install Single Market Data","templateStructure":{"type":"Template Structure","name":"New Template Structure","singleMarketData":{"type":"Single Market Data","name":"","dataProducts":[{"type":"Data Product","name":"Candles","id":"24c5f795-acf3-43c3-99ee-ddb521b082f4","savedPayload":{"position":{"x":39655.39345377463,"y":28084.121285348076},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Candles","id":"fe6065ec-4d2d-47a0-bae0-8647f0e195d7"}}},{"type":"Data Product","name":"Volumes","id":"204ec959-0861-486a-aa2a-276dbf48f775","savedPayload":{"position":{"x":39619.08803001109,"y":27971.34006849996},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Volumes","id":"1a366aef-efef-470e-88e0-2a6fbe4dd91f"}}},{"type":"Data Product","name":"Candles Channels","id":"90ee9733-ab7e-41a0-ac78-4a7661a27017","savedPayload":{"position":{"x":39594.11393185164,"y":27855.840877332517},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Candles Channels","id":"8c81d378-0947-4e9d-be25-58e69120152e"}}},{"type":"Data Product","name":"Candles Channels Objects","id":"9ade8e93-9071-422b-8cce-7a50d6dad739","savedPayload":{"position":{"x":39580.59887306321,"y":27738.507421368748},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Candles Channels Objects","id":"ba5dbb67-2030-42a0-9ff8-1ee80874f047"}}},{"type":"Data Product","name":"Bollinger Bands","id":"b5ef2cf7-3d35-45ec-848c-31970b59c04e","savedPayload":{"position":{"x":39578.655464896365,"y":27620.63069875915},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Bollinger Bands","id":"29088877-8d63-4217-8d34-8742afc262f4"}}},{"type":"Data Product","name":"Percentage Bandwidth","id":"1c3881ca-24b3-4cc9-b16b-9db7aa2b4c24","savedPayload":{"position":{"x":39588.297198778826,"y":27502.946480135615},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Percentage Bandwidth","id":"3b7885a0-cd72-4a3f-a38b-3dc8c47bd068"}}},{"type":"Data Product","name":"Bollinger Channels Objects","id":"92eec33b-86be-4b73-899f-e9550f7b0df3","savedPayload":{"position":{"x":39609.428887621216,"y":27386.77785099828},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Bollinger Channels Objects","id":"1f111f72-624f-4166-9f99-ab8d785d5267"}}},{"type":"Data Product","name":"Bollinger Sub-Channels Objects","id":"4b69df71-9091-4d22-9b0d-571304297033","savedPayload":{"position":{"x":39641.84608404141,"y":27273.24280350331},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Bollinger Sub-Channels Objects","id":"080c87fc-4546-4482-ab11-180a33f6d9ab"}}},{"type":"Data Product","name":"Popular SMAs","id":"8a5f7e27-9ca5-4d6e-b6b9-2d6cbdda8040","savedPayload":{"position":{"x":39685.2360649887,"y":27163.433854438405},"targetPosition":{"x":40780.996436099675,"y":27659.843516028},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"PLine truncated
|
||||
{"type":"Super Scripts","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","scriptsLibrary":{"type":"Scripts Library","name":"New Scripts Library","masterScripts":[{"type":"Master Script","name":"Setup Market","templateScripts":[{"type":"Template Script","name":"Install Single Market Data","templateStructure":{"type":"Template Structure","name":"New Template Structure","singleMarketData":{"type":"Single Market Data","name":"","dataProducts":[{"type":"Data Product","name":"Candles","id":"5e93b8b3-3ed7-4c98-bbc1-3804900cf6aa","savedPayload":{"position":{"x":39650.030384991085,"y":28142.770659988782},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Candles","id":"fe6065ec-4d2d-47a0-bae0-8647f0e195d7"}}},{"type":"Data Product","name":"Volumes","id":"7c9bb27e-b439-4391-82ae-c1d0eeac404e","savedPayload":{"position":{"x":39602.32443296776,"y":28028.041261771512},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Volumes","id":"1a366aef-efef-470e-88e0-2a6fbe4dd91f"}}},{"type":"Data Product","name":"Candles Channels","id":"4c98c4d3-cd29-41ba-8d5e-80b932bf2d86","savedPayload":{"position":{"x":39574.77784960979,"y":27916.594007704927},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Candles Channels","id":"8c81d378-0947-4e9d-be25-58e69120152e"}}},{"type":"Data Product","name":"Candles Channels Objects","id":"83695a47-e8bc-454b-9904-4e4f817542cb","savedPayload":{"position":{"x":39554.52222383268,"y":27807.90661198409},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Candles Channels Objects","id":"ba5dbb67-2030-42a0-9ff8-1ee80874f047"}}},{"type":"Data Product","name":"Bollinger Bands","id":"9fdb24c0-ecb7-4cd6-a61d-49d51de6c3e7","savedPayload":{"position":{"x":39552.30927819702,"y":27700.222235085923},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Bollinger Bands","id":"29088877-8d63-4217-8d34-8742afc262f4"}}},{"type":"Data Product","name":"Percentage Bandwidth","id":"018210b2-49f8-4d60-841a-c20d87543851","savedPayload":{"position":{"x":39542.24590323085,"y":27591.843126728603},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Percentage Bandwidth","id":"3b7885a0-cd72-4a3f-a38b-3dc8c47bd068"}}},{"type":"Data Product","name":"Bollinger Channels Objects","id":"ceddddcc-461a-48c1-9a6f-84e43676b2d1","savedPayload":{"position":{"x":39585.23490295202,"y":27490.884320551177},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Bollinger Channels Objects","id":"1f111f72-624f-4166-9f99-ab8d785d5267"}}},{"type":"Data Product","name":"Bollinger Sub-Channels Objects","id":"68a764ce-c162-4984-a4ee-ef92872b7fc9","savedPayload":{"position":{"x":39539.82297232588,"y":27361.579082279957},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Product Definition","name":"Bollinger Sub-Channels Objects","id":"080c87fc-4546-4482-ab11-180a33f6d9ab"}}},{"type":"Data Product","name":"Popular SMAs","id":"97d661ae-559b-4ab2-b877-2eeb0fc08fbe","savedPayload":{"position":{"x":39689.20422657283,"y":27296.335084035833},"targetPosition":{"x":40757.00079050569,"y":27671.679802500574},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referLine truncated
|
||||
+13
-8
@@ -95,26 +95,31 @@
|
||||
return
|
||||
}
|
||||
|
||||
if (outputDatasetNode.referenceParent.parentNode.parentNode === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> Product Definition not attached to a Bot. Product Definition = " + JSON.stringify(outputDatasetNode.referenceParent.parentNode));
|
||||
let botNode = global.FIND_NODE_IN_NODE_MESH(outputDatasetNode, 'Indicator Bot')
|
||||
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 = " );
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
|
||||
if (outputDatasetNode.referenceParent.parentNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> Bot witn no codeName defined. Bot = " + JSON.stringify(outputDatasetNode.referenceParent.parentNode.parentNode));
|
||||
if (botNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> Bot witn no codeName defined." );
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
|
||||
if (outputDatasetNode.referenceParent.parentNode.parentNode.parentNode === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(outputDatasetNode.referenceParent.parentNode.parentNode));
|
||||
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 (outputDatasetNode.referenceParent.parentNode.parentNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> Data Mine witn no codeName defined. Data Mine = " + JSON.stringify(outputDatasetNode.referenceParent.parentNode.parentNode.parentNode));
|
||||
if (dataMineNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> Data Mine witn no codeName defined." );
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
|
||||
+12
-67
@@ -79,77 +79,22 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
let network = global.TASK_NETWORK
|
||||
let datasetProductDefinition = thisObject.node.parentNode
|
||||
|
||||
for (let i = 0; i < network.networkNodes.length; i++) {
|
||||
let networkNode = network.networkNodes[i]
|
||||
if (networkNode.dataStorage !== undefined) {
|
||||
if (networkNode.dataStorage.sessionIndependentData !== undefined) {
|
||||
for (let j = 0; j < networkNode.dataStorage.sessionIndependentData.exchangeDataProducts.length; j++) {
|
||||
let exchangeDataProduct = networkNode.dataStorage.sessionIndependentData.exchangeDataProducts[j]
|
||||
for (let k = 0; k < exchangeDataProduct.singleMarketData.length; k++) {
|
||||
let singleMarketData = exchangeDataProduct.singleMarketData[k]
|
||||
if (singleMarketData.referenceParent !== undefined) {
|
||||
let market = singleMarketData.referenceParent
|
||||
let currentProcessMarket = bot.processNode.marketReference.referenceParent
|
||||
let nodeArray = global.NODE_MESH_TO_PATH_ARRAY(network, datasetProductDefinition.id)
|
||||
let networkNode = global.FIND_NODE_IN_NODE_ARRAY(nodeArray, 'Network Node')
|
||||
|
||||
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.config.host + ' -> port = ' + networkNode.config.webPort + '.'); }
|
||||
|
||||
fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.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]
|
||||
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.config.host + ' -> port = ' + networkNode.config.webPort + '.'); }
|
||||
|
||||
fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.webPort);
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (networkNode === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> Network Node not found.")
|
||||
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);
|
||||
return
|
||||
}
|
||||
|
||||
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.");
|
||||
/* 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.config.host + ' -> port = ' + networkNode.config.webPort + '.'); }
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.webPort);
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
|
||||
} catch (err) {
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> err = " + err.stack);
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
let dataDependencies = bot.processNode.referenceParent.processDependencies.dataDependencies
|
||||
if (commons.validateDataDependencies(dataDependencies, callBackFunction) !== true) { return }
|
||||
|
||||
let outputDatasets = bot.processNode.referenceParent.processOutput.outputDatasets
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY (bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
if (commons.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return }
|
||||
|
||||
/* The second phase is about transforming the inputs into a format that can be used to apply the user defined code. */
|
||||
@@ -130,8 +130,11 @@
|
||||
|
||||
contextSummary.dataset = outputDatasetNode.referenceParent.config.codeName
|
||||
contextSummary.product = outputDatasetNode.referenceParent.parentNode.config.codeName
|
||||
contextSummary.bot = outputDatasetNode.referenceParent.parentNode.parentNode.config.codeName
|
||||
contextSummary.dataMine = outputDatasetNode.referenceParent.parentNode.parentNode.parentNode.config.codeName
|
||||
|
||||
let botNode = global.FIND_NODE_IN_NODE_MESH(outputDatasetNode, 'Indicator Bot')
|
||||
contextSummary.bot = botNode.config.codeName
|
||||
let dataMineNode = global.FIND_NODE_IN_NODE_MESH(outputDatasetNode, 'Data Mine')
|
||||
contextSummary.dataMine = dataMineNode.config.codeName
|
||||
|
||||
let fileContent = commons.generateFileContent(outputData, outputDatasetNode.referenceParent.parentNode.record, resultsWithIrregularPeriods, processingDailyFiles, currentDay, callBackFunction)
|
||||
commons.writeFile(contextSummary, fileContent, anotherFileWritten, processingDailyFiles, timeFrameLabel, currentDay, callBackFunction)
|
||||
|
||||
@@ -124,7 +124,7 @@ exports.newSnapshots = function newSnapshots(bot, logger) {
|
||||
}
|
||||
|
||||
/* Now we go down through all this node children */
|
||||
let nodeDefinition = bot.APP_SCHEMA_MAP.get(node.type)
|
||||
let nodeDefinition = global.APP_SCHEMA_MAP.get(node.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
|
||||
@@ -99,7 +99,7 @@ exports.newTradingEngine = function newTradingEngine(bot, logger) {
|
||||
destinationNode.value = originNode.value
|
||||
|
||||
/* Now we go down through all the children of the origin node, assuming the destination node has the same children structure*/
|
||||
let nodeDefinition = bot.APP_SCHEMA_MAP.get(originNode.type)
|
||||
let nodeDefinition = global.APP_SCHEMA_MAP.get(originNode.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
@@ -138,7 +138,7 @@ exports.newTradingEngine = function newTradingEngine(bot, logger) {
|
||||
nodesMap.set(node.id, node)
|
||||
|
||||
/* Now we go down through all this node children */
|
||||
let nodeDefinition = bot.APP_SCHEMA_MAP.get(node.type)
|
||||
let nodeDefinition = global.APP_SCHEMA_MAP.get(node.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
@@ -181,7 +181,7 @@ exports.newTradingEngine = function newTradingEngine(bot, logger) {
|
||||
}
|
||||
|
||||
/* Now we go down through all this node children */
|
||||
let nodeDefinition = bot.APP_SCHEMA_MAP.get(node.type)
|
||||
let nodeDefinition = global.APP_SCHEMA_MAP.get(node.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
|
||||
@@ -503,7 +503,7 @@ exports.newTradingOrders = function newTradingOrders(bot, logger, tradingEngineM
|
||||
tradingEngineOrder.orderQuotedAsset.size.value = global.PRECISE(tradingEngineOrder.orderQuotedAsset.size.value, 10)
|
||||
}
|
||||
|
||||
function recalculateSizePlaced(){
|
||||
function recalculateSizePlaced() {
|
||||
/*
|
||||
Recaulculate the Size Placed Based on the newly calculated Quoted Asset Size.
|
||||
*/
|
||||
@@ -723,12 +723,14 @@ exports.newTradingOrders = function newTradingOrders(bot, logger, tradingEngineM
|
||||
|
||||
function syncWithExchange(tradingEngineStage, tradingSystemOrder, tradingEngineOrder, order) {
|
||||
|
||||
let previousBaseAssetSize = tradingEngineOrder.orderBaseAsset.size.value
|
||||
let previousQuotedAssetSize = tradingEngineOrder.orderQuotedAsset.size.value
|
||||
let previousBaseAssetSizeFilled = tradingEngineOrder.orderBaseAsset.sizeFilled.value
|
||||
let previousQuotedAssetSizeFilled = tradingEngineOrder.orderQuotedAsset.sizeFilled.value
|
||||
let previousBaseAssetFeesPaid = tradingEngineOrder.orderBaseAsset.feesPaid.value
|
||||
let previousQuotedAssetFeesPaid = tradingEngineOrder.orderQuotedAsset.feesPaid.value
|
||||
|
||||
actualSizeCalculation()
|
||||
actualRateCalculation()
|
||||
percentageFilledCalculation()
|
||||
feesPaidCalculation()
|
||||
@@ -746,6 +748,51 @@ exports.newTradingOrders = function newTradingOrders(bot, logger, tradingEngineM
|
||||
|
||||
return
|
||||
|
||||
function actualSizeCalculation() {
|
||||
/*
|
||||
When we submit the order to the exchange, we do it specifying the order size
|
||||
in Base Asset. The exchange might take that size or might change it a little
|
||||
bit if for example, it does not accept as many decimals as we are sending.
|
||||
If we identify the situation in which the size accepted is different than the
|
||||
size we have accounted for, we need to make several adjustments so that the
|
||||
accounting syncronizes with reality.
|
||||
*/
|
||||
if (tradingEngineOrder.orderBaseAsset.size.value === order.amount) { return }
|
||||
/*
|
||||
We will sync the Base Asset size, and recalculate the Quoted Asset size too.
|
||||
*/
|
||||
tradingEngineOrder.orderBaseAsset.size.value = order.amount
|
||||
tradingEngineOrder.orderQuotedAsset.size.value = tradingEngineOrder.orderBaseAsset.size.value * tradingEngineOrder.rate.value
|
||||
|
||||
tradingEngineOrder.orderBaseAsset.size.value = global.PRECISE(tradingEngineOrder.orderBaseAsset.size.value, 10)
|
||||
tradingEngineOrder.orderQuotedAsset.size.value = global.PRECISE(tradingEngineOrder.orderQuotedAsset.size.value, 10)
|
||||
/*
|
||||
Finaly we need to unaccount the previous size placed and correctly account
|
||||
for the the new sizes we know have.
|
||||
*/
|
||||
tradingEngineStage.stageBaseAsset.sizePlaced.value =
|
||||
tradingEngineStage.stageBaseAsset.sizePlaced.value -
|
||||
previousBaseAssetSize
|
||||
|
||||
tradingEngineStage.stageBaseAsset.sizePlaced.value =
|
||||
tradingEngineStage.stageBaseAsset.sizePlaced.value +
|
||||
tradingEngineOrder.orderBaseAsset.size.value
|
||||
|
||||
tradingEngineStage.stageQuotedAsset.sizePlaced.value =
|
||||
tradingEngineStage.stageQuotedAsset.sizePlaced.value -
|
||||
previousQuotedAssetSize
|
||||
|
||||
tradingEngineStage.stageQuotedAsset.sizePlaced.value =
|
||||
tradingEngineStage.stageQuotedAsset.sizePlaced.value +
|
||||
tradingEngineOrder.orderQuotedAsset.size.value
|
||||
|
||||
tradingEngineStage.stageBaseAsset.sizePlaced.value = global.PRECISE(tradingEngineStage.stageBaseAsset.sizePlaced.value, 10)
|
||||
tradingEngineStage.stageQuotedAsset.sizePlaced.value = global.PRECISE(tradingEngineStage.stageQuotedAsset.sizePlaced.value, 10)
|
||||
|
||||
previousBaseAssetSize = tradingEngineOrder.orderBaseAsset.size.value
|
||||
previousQuotedAssetSize = tradingEngineOrder.orderQuotedAsset.size.value
|
||||
}
|
||||
|
||||
function actualRateCalculation() {
|
||||
/*
|
||||
Actual Rate Calculation: Let's remember that the exchange may not take the rate
|
||||
@@ -772,9 +819,11 @@ exports.newTradingOrders = function newTradingOrders(bot, logger, tradingEngineM
|
||||
}
|
||||
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = global.PRECISE(tradingEngineOrder.orderStatistics.actualRate.value, 10)
|
||||
|
||||
if (tradingEngineOrder.orderStatistics.actualRate.value === tradingEngineOrder.rate.value) {return}
|
||||
/*
|
||||
Now we know the Actual Rate at which the order was filled. Since the actual rate
|
||||
might not be the same as the Rate we defined for the order, we need to syncronize
|
||||
is not the same as the Rate we defined for the order, we need to syncronize
|
||||
the Order Size for Quoted Asset since it was calculated with the Order Size that we
|
||||
now know it is not the once really used at the exchange. We will recalculate the
|
||||
Order Size in Quoted Asset and not in Base Asset, since the Order Size in Base Asset
|
||||
|
||||
@@ -40,7 +40,7 @@ exports.newTradingOutput = function newTradingOutput(bot, logger, tradingEngineM
|
||||
const TRADING_SIMULATION = require('./TradingSimulation.js')
|
||||
let tradingSimulation = TRADING_SIMULATION.newTradingSimulation(bot, logger, tradingEngineModule, UTILITIES)
|
||||
|
||||
let outputDatasets = bot.processNode.referenceParent.processOutput.outputDatasets
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY(bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasetsMap = new Map()
|
||||
|
||||
if (bot.processingDailyFiles === true) {
|
||||
|
||||
@@ -507,7 +507,7 @@
|
||||
let dataDependencies = bot.processNode.referenceParent.processDependencies.dataDependencies
|
||||
if (commons.validateDataDependencies(dataDependencies, callBackFunction) !== true) { return }
|
||||
|
||||
let outputDatasets = bot.processNode.referenceParent.processOutput.outputDatasets
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY(bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
if (commons.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return }
|
||||
|
||||
/* The second phase is about transforming the inputs into a format that can be used to apply the user defined code. */
|
||||
@@ -566,6 +566,7 @@
|
||||
}
|
||||
|
||||
async function writeProcessFiles() {
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY(bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
|
||||
await writeTimeFramesFiles(currentTimeFrame, currentTimeFrameLabel)
|
||||
await writeDataRanges()
|
||||
@@ -579,10 +580,10 @@
|
||||
async function writeDataRanges() {
|
||||
for (
|
||||
let outputDatasetIndex = 0;
|
||||
outputDatasetIndex < bot.processNode.referenceParent.processOutput.outputDatasets.length;
|
||||
outputDatasetIndex < outputDatasets.length;
|
||||
outputDatasetIndex++
|
||||
) {
|
||||
let productCodeName = bot.processNode.referenceParent.processOutput.outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
let productCodeName = outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
await writeDataRange(productCodeName);
|
||||
}
|
||||
|
||||
@@ -618,10 +619,10 @@
|
||||
|
||||
for (
|
||||
let outputDatasetIndex = 0;
|
||||
outputDatasetIndex < bot.processNode.referenceParent.processOutput.outputDatasets.length;
|
||||
outputDatasetIndex < outputDatasets.length;
|
||||
outputDatasetIndex++
|
||||
) {
|
||||
let productCodeName = bot.processNode.referenceParent.processOutput.outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
let productCodeName = outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
await writeTimeFramesFile( currentTimeFrameLabel, productCodeName, 'Multi-Period-Daily')
|
||||
await writeTimeFramesFile( currentTimeFrameLabel, productCodeName, 'Multi-Period-Market')
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ exports.newTradingRecords = function newTradingRecords(bot, logger) {
|
||||
we have a pointer to the node that have the information we need to extract.
|
||||
Later, based on the product record definition we will extract each individual value.
|
||||
*/
|
||||
let outputDatasets = bot.processNode.referenceParent.processOutput.outputDatasets
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY(bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
|
||||
for (let i = 0; i < outputDatasets.length; i++) {
|
||||
let outputDatasetNode = outputDatasets[i]
|
||||
let dataset = outputDatasetNode.referenceParent
|
||||
|
||||
@@ -182,7 +182,7 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
|
||||
}
|
||||
|
||||
/* Now we go down through all this node children */
|
||||
let nodeDefinition = bot.APP_SCHEMA_MAP.get(node.type)
|
||||
let nodeDefinition = global.APP_SCHEMA_MAP.get(node.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
|
||||
@@ -469,17 +469,18 @@
|
||||
}
|
||||
|
||||
function writeDataRanges(callBack) {
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY (bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasetIndex = -1;
|
||||
controlLoop()
|
||||
|
||||
function productLoopBody() {
|
||||
let productCodeName = bot.processNode.referenceParent.processOutput.outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
let productCodeName = outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodDailyProcessDatetime, productCodeName, controlLoop)
|
||||
}
|
||||
|
||||
function controlLoop() {
|
||||
outputDatasetIndex++
|
||||
if (outputDatasetIndex < bot.processNode.referenceParent.processOutput.outputDatasets.length) {
|
||||
if (outputDatasetIndex < outputDatasets.length) {
|
||||
productLoopBody()
|
||||
} else {
|
||||
callBack(global.DEFAULT_OK_RESPONSE)
|
||||
|
||||
@@ -141,17 +141,18 @@
|
||||
}
|
||||
|
||||
function writeTimeFramesFiles(callBack) {
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY (bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasetIndex = -1;
|
||||
controlLoop()
|
||||
|
||||
function productLoopBody() {
|
||||
let productCodeName = bot.processNode.referenceParent.processOutput.outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
let productCodeName = outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName;
|
||||
writeTimeFramesFile(productCodeName, controlLoop)
|
||||
}
|
||||
|
||||
function controlLoop() {
|
||||
outputDatasetIndex++
|
||||
if (outputDatasetIndex < bot.processNode.referenceParent.processOutput.outputDatasets.length) {
|
||||
if (outputDatasetIndex < outputDatasets.length) {
|
||||
productLoopBody()
|
||||
} else {
|
||||
callBack()
|
||||
|
||||
+102
-93
@@ -16,80 +16,83 @@
|
||||
return thisObject;
|
||||
|
||||
function raiseEvents(lastFile, timeFrames, callBackFunction) {
|
||||
|
||||
try {
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] raiseEvents -> Entering function."); }
|
||||
|
||||
/* We will reaise the events for the datasets impacted by the process that just finished. */
|
||||
|
||||
if (bot.processNode.referenceParent.processOutput !== undefined) {
|
||||
if (bot.processNode.referenceParent.processOutput.outputDatasets !== undefined) {
|
||||
let outputDatasets = bot.processNode.referenceParent.processOutput.outputDatasets
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY(bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
|
||||
for (let j = 0; j < outputDatasets.length; j++) {
|
||||
let outputDataset = outputDatasets[j]
|
||||
for (let j = 0; j < outputDatasets.length; j++) {
|
||||
let outputDataset = outputDatasets[j]
|
||||
|
||||
/* Some validations to verify that everything is in place. */
|
||||
if (outputDataset.referenceParent !== undefined) {
|
||||
if (outputDataset.referenceParent.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Dataset Definition not defined. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
let botNode = global.FIND_NODE_IN_NODE_MESH(outputDataset, 'Indicator Bot')
|
||||
if (botNode === undefined) {
|
||||
botNode = global.FIND_NODE_IN_NODE_MESH(outputDataset, 'Trading Bot')
|
||||
}
|
||||
if (botNode === undefined) {
|
||||
botNode = global.FIND_NODE_IN_NODE_MESH(outputDataset, 'Sensor Bot')
|
||||
}
|
||||
|
||||
/* Some validations to verify that everything is in place. */
|
||||
if (outputDataset.referenceParent !== undefined) {
|
||||
if (outputDataset.referenceParent.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Dataset Definition not defined. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Product not defined. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Product not defined. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
if (botNode !== undefined) {
|
||||
if (botNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Bot not defined. Bot = " + JSON.stringify(botNode));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Bot not defined. Bot = " + JSON.stringify(outputDataset.referenceParent.parentNode.parentNode));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode.parentNode.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.parentNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Data Mine not defined. Data Mine = " + JSON.stringify(outputDataset.referenceParent.parentNode.parentNode.parentNode));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(outputDataset.referenceParent.parentNode.parentNode));
|
||||
if (botNode.parentNode !== undefined) {
|
||||
if (botNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Data Mine not defined. Data Mine = " + JSON.stringify(botNode.parentNode));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Product not attached to a Bot. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(botNode));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Dataset Definition not attached to a Product. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Product not attached to a Bot. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Output Dataset with no reference to a Dataset Definition. Output Dataset = " + JSON.stringify(outputDataset));
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Dataset Definition not attached to a Product. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
|
||||
/* All good, lets emit the event. */
|
||||
|
||||
let dataMine = outputDataset.referenceParent.parentNode.parentNode.parentNode.config.codeName
|
||||
let botName = outputDataset.referenceParent.parentNode.parentNode.config.codeName
|
||||
let product = outputDataset.referenceParent.parentNode.config.codeName
|
||||
let dataset = outputDataset.referenceParent.config.codeName
|
||||
|
||||
key = dataMine + "-" + botName + "-" + product + "-" + dataset + "-" + bot.exchange + "-" + bot.market.baseAsset + '/' + bot.market.quotedAsset
|
||||
let event = {
|
||||
lastFile: lastFile,
|
||||
timeFrames: timeFrames
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.createEventHandler(key, 'Dataset Updated')
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Dataset Updated', event)
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Output Dataset with no reference to a Dataset Definition. Output Dataset = " + JSON.stringify(outputDataset));
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return
|
||||
}
|
||||
|
||||
/* All good, lets emit the event. */
|
||||
|
||||
let dataMine = botNode.parentNode.config.codeName
|
||||
let botName = botNode.config.codeName
|
||||
let product = outputDataset.referenceParent.parentNode.config.codeName
|
||||
let dataset = outputDataset.referenceParent.config.codeName
|
||||
|
||||
key = dataMine + "-" + botName + "-" + product + "-" + dataset + "-" + bot.exchange + "-" + bot.market.baseAsset + '/' + bot.market.quotedAsset
|
||||
let event = {
|
||||
lastFile: lastFile,
|
||||
timeFrames: timeFrames
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.createEventHandler(key, 'Dataset Updated')
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Dataset Updated', event)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,65 +107,71 @@
|
||||
function asyncRaiseEvents(lastFile, timeFrames) {
|
||||
|
||||
if (bot.processNode.referenceParent.processOutput !== undefined) {
|
||||
if (bot.processNode.referenceParent.processOutput.outputDatasets !== undefined) {
|
||||
let outputDatasets = bot.processNode.referenceParent.processOutput.outputDatasets
|
||||
let outputDatasets = global.NODE_BRANCH_TO_ARRAY(bot.processNode.referenceParent.processOutput, 'Output Dataset')
|
||||
|
||||
for (let j = 0; j < outputDatasets.length; j++) {
|
||||
let outputDataset = outputDatasets[j]
|
||||
for (let j = 0; j < outputDatasets.length; j++) {
|
||||
let outputDataset = outputDatasets[j]
|
||||
|
||||
/* Some validations to verify that everything is in place. */
|
||||
if (outputDataset.referenceParent !== undefined) {
|
||||
if (outputDataset.referenceParent.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Dataset Definition not defined. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
let botNode = global.FIND_NODE_IN_NODE_MESH(outputDataset, 'Indicator Bot')
|
||||
if (botNode === undefined) {
|
||||
botNode = global.FIND_NODE_IN_NODE_MESH(outputDataset, 'Trading Bot')
|
||||
}
|
||||
if (botNode === undefined) {
|
||||
botNode = global.FIND_NODE_IN_NODE_MESH(outputDataset, 'Sensor Bot')
|
||||
}
|
||||
|
||||
/* Some validations to verify that everything is in place. */
|
||||
if (outputDataset.referenceParent !== undefined) {
|
||||
if (outputDataset.referenceParent.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Dataset Definition not defined. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Product not defined. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Product not defined. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
if (botNode !== undefined) {
|
||||
if (botNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Bot not defined. Bot = " + JSON.stringify(botNode));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Bot not defined. Bot = " + JSON.stringify(outputDataset.referenceParent.parentNode.parentNode));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
if (outputDataset.referenceParent.parentNode.parentNode.parentNode !== undefined) {
|
||||
if (outputDataset.referenceParent.parentNode.parentNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Data Mine not defined. Data Mine = " + JSON.stringify(outputDataset.referenceParent.parentNode.parentNode.parentNode));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(outputDataset.referenceParent.parentNode.parentNode));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
if (botNode.parentNode !== undefined) {
|
||||
if (botNode.parentNode.config.codeName === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Data Mine not defined. Data Mine = " + JSON.stringify(botNode.parentNode));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Product not attached to a Bot. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine. Bot = " + JSON.stringify(botNode));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Dataset Definition not attached to a Product. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Product not attached to a Bot. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Output Dataset with no reference to a Dataset Definition. Output Dataset = " + JSON.stringify(outputDataset));
|
||||
throw(global.DEFAULT_FAIL_RESPONSE);
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Dataset Definition not attached to a Product. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
|
||||
/* All good, lets emit the event. */
|
||||
|
||||
let dataMine = outputDataset.referenceParent.parentNode.parentNode.parentNode.config.codeName
|
||||
let botName = outputDataset.referenceParent.parentNode.parentNode.config.codeName
|
||||
let product = outputDataset.referenceParent.parentNode.config.codeName
|
||||
let dataset = outputDataset.referenceParent.config.codeName
|
||||
|
||||
key = dataMine + "-" + botName + "-" + product + "-" + dataset + "-" + bot.exchange + "-" + bot.market.baseAsset + '/' + bot.market.quotedAsset
|
||||
let event = {
|
||||
lastFile: lastFile,
|
||||
timeFrames: timeFrames
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.createEventHandler(key, 'Dataset Updated')
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Dataset Updated', event)
|
||||
} else {
|
||||
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Output Dataset with no reference to a Dataset Definition. Output Dataset = " + JSON.stringify(outputDataset));
|
||||
throw (global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
|
||||
/* All good, lets emit the event. */
|
||||
|
||||
let dataMine = botNode.parentNode.config.codeName
|
||||
let botName = botNode.config.codeName
|
||||
let product = outputDataset.referenceParent.parentNode.config.codeName
|
||||
let dataset = outputDataset.referenceParent.config.codeName
|
||||
|
||||
key = dataMine + "-" + botName + "-" + product + "-" + dataset + "-" + bot.exchange + "-" + bot.market.baseAsset + '/' + bot.market.quotedAsset
|
||||
let event = {
|
||||
lastFile: lastFile,
|
||||
timeFrames: timeFrames
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.createEventHandler(key, 'Dataset Updated')
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Dataset Updated', event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
if (bot.SESSION_STATUS === 'Idle' || bot.SESSION_STATUS === 'Running') { return } // This happens when the UI is reloaded, the session was running and tries to run it again.
|
||||
|
||||
/* We are going to run the Definition comming at the event. */
|
||||
bot.APP_SCHEMA_ARRAY = JSON.parse(message.event.appSchema)
|
||||
bot.TRADING_SYSTEM = JSON.parse(message.event.tradingSystem)
|
||||
bot.TRADING_ENGINE = JSON.parse(message.event.tradingEngine)
|
||||
bot.SESSION = JSON.parse(message.event.session)
|
||||
@@ -66,7 +65,6 @@
|
||||
bot.FIRST_EXECUTION = true
|
||||
bot.SESSION.stop = stopSession // stop function
|
||||
|
||||
setUpAppSchema()
|
||||
setUpSessionFolderName()
|
||||
|
||||
/* We validate all parameters received and complete some that might be missing if needed. */
|
||||
@@ -118,16 +116,6 @@
|
||||
sessionInfo(bot.SESSION, commandOrigin)
|
||||
}
|
||||
|
||||
function setUpAppSchema() {
|
||||
/* Setup the APP_SCHEMA_MAP based on the APP_SCHEMA_ARRAY */
|
||||
bot.APP_SCHEMA_MAP = new Map()
|
||||
for (let i = 0; i < bot.APP_SCHEMA_ARRAY.length; i++) {
|
||||
let nodeDefinition = bot.APP_SCHEMA_ARRAY[i]
|
||||
let key = nodeDefinition.type
|
||||
bot.APP_SCHEMA_MAP.set(key, nodeDefinition)
|
||||
}
|
||||
}
|
||||
|
||||
function setUpSessionFolderName() {
|
||||
/*
|
||||
The session object is overwritten when the session is run. For that reason we
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
function validationFailed(errorInNode, errorMessage) {
|
||||
let nodeString = JSON.stringify(errorInNode)
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> " + errorMessage + ' -> nodeString = ' + nodeString)
|
||||
bot.global.PROCESS_ERROR(bot.processKey, errorInNode, errorMessage)
|
||||
global.PROCESS_ERROR(bot.processKey, errorInNode, errorMessage)
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
|
||||
|
||||
+185
-2
@@ -102,6 +102,177 @@ global.PROCESS_INFO = function (processKey, node, infoMessage) {
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(processKey, 'Info', event)
|
||||
}
|
||||
|
||||
global.NODE_BRANCH_TO_ARRAY = function (node, nodeType) {
|
||||
let resultArray = []
|
||||
scanNodeBranch(node, nodeType)
|
||||
return resultArray
|
||||
|
||||
function scanNodeBranch(startingNode) {
|
||||
let nodeDefinition = global.APP_SCHEMA_MAP.get(startingNode.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (startingNode.type === nodeType) {
|
||||
resultArray.push(startingNode)
|
||||
return
|
||||
}
|
||||
|
||||
if (nodeDefinition.properties === undefined) { return }
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global.FIND_NODE_IN_NODE_MESH = function (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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global.NODE_MESH_TO_PATH_ARRAY = function (node, nodeId) {
|
||||
/*
|
||||
This function scans a node mesh for a certain node if and
|
||||
returns an array with the path within that mesh to the
|
||||
requested node.
|
||||
*/
|
||||
let nodeArray = []
|
||||
scanNodeMesh(node)
|
||||
return nodeArray
|
||||
|
||||
function scanNodeMesh(startingNode) {
|
||||
if (startingNode === undefined) { return }
|
||||
|
||||
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
|
||||
if (nodeDefinition === undefined) { return }
|
||||
|
||||
if (startingNode.id === nodeId) {
|
||||
nodeArray.push(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])
|
||||
if (nodeArray.length > 0) {
|
||||
nodeArray.unshift(startingNode)
|
||||
return
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'array': {
|
||||
let startingNodePropertyArray = startingNode[property.name]
|
||||
if (startingNodePropertyArray !== undefined) {
|
||||
for (let m = 0; m < startingNodePropertyArray.length; m++) {
|
||||
scanNodeMesh(startingNodePropertyArray[m])
|
||||
if (nodeArray.length > 0) {
|
||||
nodeArray.unshift(startingNode)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* We scan parents nodes. */
|
||||
if (startingNode.parentNode !== undefined) {
|
||||
scanNodeMesh(startingNode.parentNode)
|
||||
if (nodeArray.length > 0) {
|
||||
nodeArray.unshift(startingNode)
|
||||
return
|
||||
}
|
||||
}
|
||||
/* We scan reference parents too. */
|
||||
if (startingNode.referenceParent !== undefined) {
|
||||
scanNodeMesh(startingNode.referenceParent)
|
||||
if (nodeArray.length > 0) {
|
||||
nodeArray.unshift(startingNode)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global.FIND_NODE_IN_NODE_ARRAY = function (nodeArray, nodeType) {
|
||||
for (let i=0; i < nodeArray.length; i++) {
|
||||
let node = nodeArray[i]
|
||||
if (node.type === nodeType) {
|
||||
return node
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.log('[ERROR] Task Server -> server -> uncaughtException -> err.message = ' + err.message)
|
||||
console.log('[ERROR] Task Server -> server -> uncaughtException -> err.stack = ' + err.stack)
|
||||
@@ -230,7 +401,8 @@ function preLoader() {
|
||||
global.EVENT_SERVER_CLIENT.listenToEvent('Task Server - ' + taskId, 'Run Task', undefined, 'Task Server - ' + taskId, undefined, eventReceived)
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent('Task Manager - ' + taskId, 'Nodejs Process Ready for Task')
|
||||
function eventReceived(message) {
|
||||
global.TASK_NODE = message
|
||||
global.APP_SCHEMA_ARRAY = JSON.parse(message.event.appSchema)
|
||||
setUpAppSchema()
|
||||
global.TASK_NODE = JSON.parse(message.event.taskDefinition)
|
||||
global.TASK_NETWORK = JSON.parse(message.event.networkDefinition)
|
||||
bootLoader()
|
||||
@@ -245,7 +417,8 @@ function preLoader() {
|
||||
//console.log('[INFO] Task Server -> server -> preLoader -> Waiting for event to start debugging...')
|
||||
global.EVENT_SERVER_CLIENT.listenToEvent('Task Server', 'Debug Task Started', undefined, 'Task Server', undefined, startDebugging)
|
||||
function startDebugging(message) {
|
||||
global.TASK_NODE = message
|
||||
global.APP_SCHEMA_ARRAY = JSON.parse(message.event.appSchema)
|
||||
setUpAppSchema()
|
||||
global.TASK_NODE = JSON.parse(message.event.taskDefinition)
|
||||
global.TASK_NETWORK = JSON.parse(message.event.networkDefinition)
|
||||
bootLoader()
|
||||
@@ -255,6 +428,16 @@ function preLoader() {
|
||||
console.log('[ERROR] Task Server -> server -> preLoader -> global.TASK_NODE = ' + JSON.stringify(global.TASK_NODE).substring(0, 1000))
|
||||
}
|
||||
}
|
||||
|
||||
function setUpAppSchema() {
|
||||
/* Setup the APP_SCHEMA_MAP based on the APP_SCHEMA_ARRAY */
|
||||
global.APP_SCHEMA_MAP = new Map()
|
||||
for (let i = 0; i < global.APP_SCHEMA_ARRAY.length; i++) {
|
||||
let nodeDefinition = global.APP_SCHEMA_ARRAY[i]
|
||||
let key = nodeDefinition.type
|
||||
global.APP_SCHEMA_MAP.set(key, nodeDefinition)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bootLoader() {
|
||||
|
||||
Reference in new issue
Block a user