From 4ab1dfefd76c5e2c5198bae70e61f97446ba0339 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 16 Jul 2019 16:10:44 +0200 Subject: [PATCH 01/27] Parts From Nodes Fixed at Close Stage --- StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 47f81f152..9c5942813 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -396,7 +396,9 @@ function newPartsFromNodes () { createPart('Stop', '', node.manageStage.stopLoss, node.manageStage, node.manageStage) createPart('Take Profit', '', node.manageStage.takeProfit, node.manageStage, node.manageStage) } - if (node.triggerStage === undefined) { + if (node.closeStage === undefined) { + node.closeStage = { + } createPart('Close Stage', '', node.closeStage, node, node, 'Close Stage') } } @@ -635,3 +637,4 @@ function newPartsFromNodes () { canvas.floatingSpace.strategyPartConstructor.createStrategyPart(payload) } } + From 02c471c44bdf7fc039781d9a71684f54e599e5ef Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 16 Jul 2019 19:36:16 +0200 Subject: [PATCH 02/27] Open Execution AND Close Execution objects implemented --- FloatingSpace/StrategyPart.js | 11 +- FloatingSpace/StrategyPartConstructor.js | 114 +++++++++++++++++- FloatingSpace/StrategyPartTitle.js | 6 + Spaces/StrategySpace.js | 2 + .../FunctionLibraries/AttachDetach.js | 24 ++++ .../FunctionLibraries/NodeChildren.js | 22 ++++ .../FunctionLibraries/NodeDeleter.js | 40 ++++++ .../FunctionLibraries/PartsFromNodes.js | 27 ++++- .../FunctionLibraries/ProtocolNode.js | 16 +++ .../FunctionLibraries/StringifyNode.js | 20 +++ StrategySpace/Workspace/Workspace.js | 10 ++ 11 files changed, 285 insertions(+), 7 deletions(-) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 049de0b79..e801de72d 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -248,6 +248,14 @@ function newStrategyPart () { compatibleType = '->' + 'Open Stage' compatibleSubType = undefined break + case 'Open Execution': + compatibleType = '->' + 'Open Stage' + compatibleSubType = undefined + break + case 'Close Execution': + compatibleType = '->' + 'Close Stage' + compatibleSubType = undefined + break case 'Stop': compatibleType = '->' + 'Manage Stage' + '->' + 'Initial Definition' compatibleSubType = undefined @@ -306,6 +314,8 @@ function newStrategyPart () { if (thisObject.payload.node.type === 'Trigger Off Event' && nearbyNode.triggerOff !== undefined) { continue } if (thisObject.payload.node.type === 'Trigger On Event' && nearbyNode.triggerOn !== undefined) { continue } if (thisObject.payload.node.type === 'Initial Definition' && nearbyNode.initialDefinition !== undefined) { continue } + if (thisObject.payload.node.type === 'Open Execution' && nearbyNode.openExecution !== undefined) { continue } + if (thisObject.payload.node.type === 'Close Execution' && nearbyNode.closeExecution !== undefined) { continue } if (thisObject.payload.node.type === 'Stop' && nearbyNode.stopLoss !== undefined) { continue } if (thisObject.payload.node.type === 'Take Profit' && nearbyNode.takeProfit !== undefined) { continue } if (thisObject.payload.node.type === 'Formula' && nearbyNode.formula !== undefined) { continue } @@ -962,4 +972,3 @@ function newStrategyPart () { } } } - diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 91d34379f..16ee8683c 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -524,7 +524,21 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Open Execution', + actionFunction: payload.onMenuItemClick, + label: 'Add Open Execution', + visible: false, + iconPathOn: 'target', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 } ) menuItemsInitialValues.push( @@ -540,7 +554,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 0 + angle: 20 } ) menuItemsInitialValues.push( @@ -554,7 +568,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 60 } ) break @@ -609,6 +623,20 @@ function newStrategyPartConstructor () { } case 'Close Stage': { addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Close Execution', + actionFunction: payload.onMenuItemClick, + label: 'Add Close Execution', + visible: false, + iconPathOn: 'target', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) menuItemsInitialValues.push( { action: 'Delete Close Stage', @@ -622,7 +650,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 0 } ) menuItemsInitialValues.push( @@ -636,7 +664,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 40 } ) break @@ -934,6 +962,74 @@ function newStrategyPartConstructor () { ) break } + case 'Open Execution': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Open Execution', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete This Definition', + visible: false, + iconPathOn: 'trash', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Download', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } + case 'Close Execution': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Close Execution', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete This Definition', + visible: false, + iconPathOn: 'trash', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Download', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } case 'Stop': { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -1424,6 +1520,14 @@ function newStrategyPartConstructor () { level_3() break } + case 'Open Execution': { + level_3() + break + } + case 'Close Execution': { + level_3() + break + } case 'Stop': { level_3() break diff --git a/FloatingSpace/StrategyPartTitle.js b/FloatingSpace/StrategyPartTitle.js index 27d0652d9..9a5209bc4 100644 --- a/FloatingSpace/StrategyPartTitle.js +++ b/FloatingSpace/StrategyPartTitle.js @@ -96,6 +96,12 @@ function newStrategyPartTitle () { case 'Initial Definition': { break } + case 'Open Execution': { + break + } + case 'Close Execution': { + break + } case 'Stop': { break } diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index 848785951..39f67b6a4 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -54,6 +54,8 @@ function newStrategySpace () { ['Trigger Off Event', 'support'], ['Take Position Event', 'compass'], ['Initial Definition', 'task'], + ['Open Execution', 'piggy-bank'], + ['Close Execution', 'piggy-bank'], ['Stop', 'pixel'], ['Take Profit', 'competition'], ['Phase', 'placeholder'], diff --git a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js index b486bd0ea..5b25d4bb5 100644 --- a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js @@ -82,6 +82,16 @@ function newAttachDetach () { completeDetachment(node, rootNodes) return } + case 'Open Execution': { + node.payload.parentNode.openExecution = undefined + completeDetachment(node, rootNodes) + return + } + case 'Close Execution': { + node.payload.parentNode.closeExecution = undefined + completeDetachment(node, rootNodes) + return + } case 'Stop': { node.payload.parentNode.stopLoss = undefined completeDetachment(node, rootNodes) @@ -224,6 +234,20 @@ function newAttachDetach () { completeAttachment(node, rootNodes) } break + case 'Open Execution': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.openExecution = node + completeAttachment(node, rootNodes) + } + break + case 'Close Execution': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.closeExecution = node + completeAttachment(node, rootNodes) + } + break case 'Trigger On Event': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index 85d1664d9..1dadb8006 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -41,6 +41,12 @@ function newNodeChildren () { case 'Initial Definition': { return countChildrenInitialDefinition(parentNode, childNode) } + case 'Open Execution': { + return countChildrenOpenExecution(parentNode, childNode) + } + case 'Close Execution': { + return countChildrenCloseExecution(parentNode, childNode) + } case 'Next Phase Event': { return countChildrenEvent(parentNode, childNode) } @@ -291,6 +297,22 @@ function newNodeChildren () { return response } + function countChildrenOpenExecution (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + + function countChildrenCloseExecution (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + function countChildrenEvent (parentNode, childNode) { let response = { childrenCount: 0, diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index 51f9d84da..6169a5eae 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -12,6 +12,8 @@ function newNodeDeleter () { deletePositionSize: deletePositionSize, deletePositionRate: deletePositionRate, deleteInitialDefinition: deleteInitialDefinition, + deleteOpenExecution: deleteOpenExecution, + deleteCloseExecution: deleteCloseExecution, deleteEvent: deleteEvent, deleteManagedItem: deleteManagedItem, deletePhase: deletePhase, @@ -76,6 +78,14 @@ function newNodeDeleter () { deleteInitialDefinition(rootNode, rootNodes) break } + case 'Open Execution': { + deleteOpenExecution(rootNode, rootNodes) + break + } + case 'Close Execution': { + deleteCloseExecution(rootNode, rootNodes) + break + } case 'Event': { deleteEvent(rootNode, rootNodes) break @@ -232,6 +242,11 @@ function newNodeDeleter () { if (node.initialDefinition !== undefined) { deleteInitialDefinition(node.initialDefinition, rootNodes) } + + if (node.openExecution !== undefined) { + deleteOpenExecution(node.openExecution, rootNodes) + } + destroyPart(node) cleanNode(node) } @@ -260,6 +275,9 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } + if (node.closeExecution !== undefined) { + deleteCloseExecution(node.closeExecution, rootNodes) + } destroyPart(node) cleanNode(node) } @@ -315,6 +333,28 @@ function newNodeDeleter () { cleanNode(node) } + function deleteOpenExecution (node, rootNodes) { + let payload = node.payload + if (payload.parentNode !== undefined) { + payload.parentNode.openExecution = undefined + } else { + completeDeletion(node, rootNodes) + } + destroyPart(node) + cleanNode(node) + } + + function deleteCloseExecution (node, rootNodes) { + let payload = node.payload + if (payload.parentNode !== undefined) { + payload.parentNode.closeExecution = undefined + } else { + completeDeletion(node, rootNodes) + } + destroyPart(node) + cleanNode(node) + } + function deleteEvent (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 9c5942813..73f429808 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -8,6 +8,8 @@ function newPartsFromNodes () { addMissingEvents: addMissingEvents, addMissingItems: addMissingItems, addInitialDefinition: addInitialDefinition, + addOpenExecution: addOpenExecution, + addCloseExecution: addCloseExecution, addPhase: addPhase, addFormula: addFormula, addNextPhaseEvent: addNextPhaseEvent, @@ -102,6 +104,16 @@ function newPartsFromNodes () { } return } + case 'Open Execution': + { + createPart('Open Execution', node.name, node, parentNode, chainParent, 'Open Execution') + return + } + case 'Close Execution': + { + createPart('Close Execution', node.name, node, parentNode, chainParent, 'Close Execution') + return + } case 'Initial Definition': { createPart('Initial Definition', node.name, node, parentNode, chainParent, 'Initial Definition') @@ -498,6 +510,20 @@ function newPartsFromNodes () { } } + function addOpenExecution (node) { + if (node.openExecution === undefined) { + node.openExecution = {} + createPart('Open Execution', '', node.openExecution, node, node) + } + } + + function addCloseExecution (node) { + if (node.closeExecution === undefined) { + node.closeExecution = {} + createPart('Open Execution', '', node.closeExecution, node, node) + } + } + function addFormula (node) { if (node.formula === undefined) { node.formula = { @@ -637,4 +663,3 @@ function newPartsFromNodes () { canvas.floatingSpace.strategyPartConstructor.createStrategyPart(payload) } } - diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index 5e665b21d..9eb6d1377 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -157,6 +157,22 @@ function newProtocolNode () { } return object } + case 'Open Execution': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + return object + } + case 'Close Execution': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + return object + } case 'Position Size': { let object = { type: node.type, diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index 05039cebc..eb75a7eb7 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -183,6 +183,26 @@ function newStringifyNode () { } return object } + case 'Open Execution': { + let object = { + id: node.id, + type: node.type, + subType: node.subType, + name: node.name, + savedPayload: getSavedPayload(node) + } + return object + } + case 'Close Execution': { + let object = { + id: node.id, + type: node.type, + subType: node.subType, + name: node.name, + savedPayload: getSavedPayload(node) + } + return object + } case 'Position Size': { let object = { id: node.id, diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 661f96ce0..b10fd119e 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -222,6 +222,16 @@ function newWorkspace () { functionLibraryPartsFromNodes.addInitialDefinition(payload.node) } break + case 'Add Open Execution': + { + functionLibraryPartsFromNodes.addOpenExecution(payload.node) + } + break + case 'Add Close Execution': + { + functionLibraryPartsFromNodes.addCloseExecution(payload.node) + } + break case 'Add Phase': { functionLibraryPartsFromNodes.addPhase(payload.node) From 5206f41fb434bda7609fec642106d80cef71e514 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 16 Jul 2019 20:06:36 +0200 Subject: [PATCH 03/27] Bug Fixing and missing stuff --- FloatingSpace/StrategyPartConstructor.js | 4 ++-- .../Workspace/FunctionLibraries/NodeChildren.js | 12 ++++++++++++ .../Workspace/FunctionLibraries/PartsFromNodes.js | 7 +++++++ .../Workspace/FunctionLibraries/ProtocolNode.js | 6 ++++-- .../Workspace/FunctionLibraries/StringifyNode.js | 2 ++ StrategySpace/Workspace/Workspace.js | 8 ++++++++ 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 16ee8683c..40269b3d0 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -970,7 +970,7 @@ function newStrategyPartConstructor () { askConfirmation: true, confirmationLabel: 'Confirm to Delete', actionFunction: payload.onMenuItemClick, - label: 'Delete This Definition', + label: 'Delete This', visible: false, iconPathOn: 'trash', iconPathOff: 'trash', @@ -1004,7 +1004,7 @@ function newStrategyPartConstructor () { askConfirmation: true, confirmationLabel: 'Confirm to Delete', actionFunction: payload.onMenuItemClick, - label: 'Delete This Definition', + label: 'Delete This', visible: false, iconPathOn: 'trash', iconPathOff: 'trash', diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index 1dadb8006..086b7237e 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -206,6 +206,12 @@ function newNodeChildren () { response.childIndex = response.childrenCount } } + if (parentNode.openExecution !== undefined) { + response.childrenCount++ + if (parentNode.openExecution.id === childNode.id) { + response.childIndex = response.childrenCount + } + } return response } @@ -234,6 +240,12 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } + if (parentNode.closeExecution !== undefined) { + response.childrenCount++ + if (parentNode.closeExecution.id === childNode.id) { + response.childIndex = response.childrenCount + } + } return response } diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 73f429808..6d0d52e2e 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -194,6 +194,9 @@ function newPartsFromNodes () { if (node.initialDefinition !== undefined) { createPartFromNode(node.initialDefinition, stage, stage) } + if (node.openExecution !== undefined) { + createPartFromNode(node.openExecution, stage, stage) + } return } case 'Manage Stage': { @@ -211,6 +214,10 @@ function newPartsFromNodes () { case 'Close Stage': { let stage = node createPart('Close Stage', stage.name, stage, parentNode, chainParent, 'Close Stage') + + if (node.closeExecution !== undefined) { + createPartFromNode(node.closeExecution, stage, stage) + } return } case 'Strategy': { diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index 9eb6d1377..b73b76179 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -207,7 +207,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: getProtocolNode(node.initialDefinition) + initialDefinition: getProtocolNode(node.initialDefinition), + openExecution: getProtocolNode(node.openExecution) } return stage } @@ -225,7 +226,8 @@ function newProtocolNode () { let stage = { type: node.type, subType: node.subType, - name: node.name + name: node.name, + closeExecution: getProtocolNode(node.closeExecution) } return stage } diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index eb75a7eb7..91cb154c3 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -245,6 +245,7 @@ function newStringifyNode () { subType: node.subType, name: node.name, initialDefinition: prepareForStringify(node.initialDefinition), + openExecution: prepareForStringify(node.openExecution), savedPayload: getSavedPayload(node) } return stage @@ -267,6 +268,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, + closeExecution: prepareForStringify(node.closeExecution), savedPayload: getSavedPayload(node) } return stage diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index b10fd119e..c46878fb7 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -306,6 +306,14 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteInitialDefinition(payload.node, workspaceNode.rootNodes) break } + case 'Delete Open Execution': { + functionLibraryNodeDeleter.deleteOpenExecution(payload.node, workspaceNode.rootNodes) + break + } + case 'Delete Close Execution': { + functionLibraryNodeDeleter.deleteCloseExecution(payload.node, workspaceNode.rootNodes) + break + } case 'Delete Event': { functionLibraryNodeDeleter.deleteEvent(payload.node, workspaceNode.rootNodes) break From 94a4584907b5e49c6ca6e6ee4017667c6ea2d147 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 16 Jul 2019 20:18:00 +0200 Subject: [PATCH 04/27] Buf Fixed Open for Close --- StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 6d0d52e2e..4e76603c4 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -527,7 +527,7 @@ function newPartsFromNodes () { function addCloseExecution (node) { if (node.closeExecution === undefined) { node.closeExecution = {} - createPart('Open Execution', '', node.closeExecution, node, node) + createPart('Close Execution', '', node.closeExecution, node, node) } } From 83a50f8d5db5901b1c537068f51962df3a5b216e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 20 Jul 2019 11:42:39 +0200 Subject: [PATCH 05/27] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 21ad13fcd..6c219fca0 100644 --- a/README.md +++ b/README.md @@ -311,3 +311,8 @@ In the example above, conditions A and B are mathematical comparison statements **periods:** +## Maintainers + +[![Luis-Fernando-Molina](https://avatars1.githubusercontent.com/u/9479367?s=460&v=4)](https://github.com/Luis-Fernando-Molina) | [![Luis-Fernando-Molina] + + From fb019e69483f51379975f4b46f855010f90756d7 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 20 Jul 2019 11:46:03 +0200 Subject: [PATCH 06/27] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c219fca0..b89bc7d0a 100644 --- a/README.md +++ b/README.md @@ -313,6 +313,8 @@ In the example above, conditions A and B are mathematical comparison statements ## Maintainers -[![Luis-Fernando-Molina](https://avatars1.githubusercontent.com/u/9479367?s=460&v=4)](https://github.com/Luis-Fernando-Molina) | [![Luis-Fernando-Molina] +[Luis-Fernando-Molina](https://avatars1.githubusercontent.com/u/9479367?s=460&v=4)](https://github.com/Luis-Fernando-Molina) + + From ac9ecf4baa30725a3a46c24a25d78ea55640e77d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 20 Jul 2019 11:46:48 +0200 Subject: [PATCH 07/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b89bc7d0a..a9232c68f 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,7 @@ In the example above, conditions A and B are mathematical comparison statements ## Maintainers -[Luis-Fernando-Molina](https://avatars1.githubusercontent.com/u/9479367?s=460&v=4)](https://github.com/Luis-Fernando-Molina) +[Luis-Fernando-Molina](https://avatars1.githubusercontent.com/u/9479367?s=460&v=4)[Luis Fernando Molina](https://github.com/Luis-Fernando-Molina) From 954e1722d6a3de335e3498d3a1aea3fc45c21531 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 20 Jul 2019 11:51:20 +0200 Subject: [PATCH 08/27] Update README.md --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a9232c68f..ec0209a30 100644 --- a/README.md +++ b/README.md @@ -311,10 +311,9 @@ In the example above, conditions A and B are mathematical comparison statements **periods:** -## Maintainers - -[Luis-Fernando-Molina](https://avatars1.githubusercontent.com/u/9479367?s=460&v=4)[Luis Fernando Molina](https://github.com/Luis-Fernando-Molina) - - +## Maintainer +[![Luis-Fernando-Molina](https://avatars1.githubusercontent.com/u/9479367?s=130&v=4)](https://github.com/Luis-Fernando-Molina) | +---| +[Luis-Fernando-Molina](https://github.com/jaredallard) | From b85dae58965a89ca7d3ae683bd351ecf4f4540f5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 26 Jul 2019 20:14:50 +0200 Subject: [PATCH 09/27] comenting out unused stuff --- ChartsSpace/PlottersManager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChartsSpace/PlottersManager.js b/ChartsSpace/PlottersManager.js index 16ffb3acf..9cfdd845f 100644 --- a/ChartsSpace/PlottersManager.js +++ b/ChartsSpace/PlottersManager.js @@ -214,7 +214,7 @@ function newPlottersManager () { let imageId = participant.devTeam + '.' + participant.profilePicture const TEAM = devTeam.codeName.toLowerCase() const BOT = bot.codeName.toLowerCase() - +/* let botAvatar = new Image() botAvatar.src = window.canvasApp.context.fbProfileImages.get(TEAM + '-' + BOT) competitionPlotter.plotter.payload[k].profile.title = bot.displayName @@ -225,6 +225,8 @@ function newPlottersManager () { function onProfileBallCreated (err, pProfileHandle) { competitionPlotter.plotter.payload[k].profile.handle = pProfileHandle } + +*/ } } callBack(GLOBAL.DEFAULT_OK_RESPONSE) From 474f7fa4f6390a64d890b4a0edfaf51b9b2b7f77 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 27 Jul 2019 18:11:56 +0200 Subject: [PATCH 10/27] Added Personal Data, Exchange Account, Asset and Key basic structure --- FloatingSpace/StrategyPart.js | 12 ++ FloatingSpace/StrategyPartConstructor.js | 203 +++++++++++++++++- FloatingSpace/StrategyPartTitle.js | 12 ++ Spaces/StrategySpace.js | 4 + .../FunctionLibraries/AttachDetach.js | 67 +++++- .../FunctionLibraries/NodeChildren.js | 68 ++++++ .../FunctionLibraries/NodeDeleter.js | 83 +++++++ .../FunctionLibraries/PartsFromNodes.js | 64 +++++- .../FunctionLibraries/ProtocolNode.js | 49 +++++ .../FunctionLibraries/StringifyNode.js | 58 +++++ StrategySpace/Workspace/Workspace.js | 31 ++- 11 files changed, 638 insertions(+), 13 deletions(-) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index e801de72d..9986c3647 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -196,6 +196,18 @@ function newStrategyPart () { let compatibleType let compatibleSubType switch (thisObject.payload.node.type) { + case 'Exchange Account': + compatibleType = '->' + 'Personal Data' + compatibleSubType = undefined + break + case 'Exchange Account Asset': + compatibleType = '->' + 'Exchange Account' + compatibleSubType = undefined + break + case 'Exchange Account Key': + compatibleType = '->' + 'Exchange Account' + compatibleSubType = undefined + break case 'Parameters': compatibleType = '->' + 'Trading System' compatibleSubType = undefined diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 40269b3d0..37c82ae39 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -153,6 +153,189 @@ function newStrategyPartConstructor () { function getMenuItemsInitialValues (strategyPart, floatingObject, payload) { let menuItemsInitialValues = [] switch (payload.node.type) { + case 'Personal Data': { + floatingObject.isPinned = true + floatingObject.positionLocked = true + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Personal Data', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Personal Data', + visible: false, + iconPathOn: 'trash', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -30 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Exchange Account', + actionFunction: payload.onMenuItemClick, + label: 'Add Exchange Account', + visible: false, + iconPathOn: 'approve', + iconPathOff: 'approve', + relatedStrategyPart: 'Exchange Account', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: +0 + } + ) + menuItemsInitialValues.push( + { + action: 'Download', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 30 + } + ) + break + } + case 'Exchange Account': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Exchange Account', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete This Account', + visible: false, + iconPathOn: 'trash', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Exchange Account Asset', + actionFunction: payload.onMenuItemClick, + label: 'Add Asset', + visible: false, + iconPathOn: 'paper-plane', + iconPathOff: 'paper-plane', + relatedStrategyPart: 'Exchange Account Asset', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Exchange Account Key', + actionFunction: payload.onMenuItemClick, + label: 'Add Key', + visible: false, + iconPathOn: 'login', + iconPathOff: 'login', + relatedStrategyPart: 'Exchange Account Key', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Download', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Exchange Account Asset': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Exchange Account Asset', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete This Asset', + visible: false, + iconPathOn: 'trash', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Download', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } + case 'Exchange Account Key': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Exchange Account Key', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete This Key', + visible: false, + iconPathOn: 'trash', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Download', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } case 'Workspace': { floatingObject.isPinned = true floatingObject.positionLocked = true @@ -238,9 +421,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'New Strategy', + action: 'Add Strategy', actionFunction: payload.onMenuItemClick, - label: 'New Strategy', + label: 'Add Strategy', visible: false, iconPathOn: 'quality', iconPathOff: 'quality', @@ -1464,6 +1647,22 @@ function newStrategyPartConstructor () { level_0() break } + case 'Exchange Account': { + level_1() + break + } + case 'Exchange Account Asset': { + level_3() + break + } + case 'Exchange Account Key': { + level_3() + break + } + case 'Personal Data': { + level_0() + break + } case 'Trading System': { level_0() break diff --git a/FloatingSpace/StrategyPartTitle.js b/FloatingSpace/StrategyPartTitle.js index 9a5209bc4..7ad6c9f90 100644 --- a/FloatingSpace/StrategyPartTitle.js +++ b/FloatingSpace/StrategyPartTitle.js @@ -48,6 +48,18 @@ function newStrategyPartTitle () { thisObject.payload = payload switch (payload.node.type) { + case 'Personal Data': { + break + } + case 'Exchange Account': { + break + } + case 'Exchange Account Asset': { + break + } + case 'Exchange Account Key': { + break + } case 'Workspace': { thisObject.allwaysVisible = true break diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index 39f67b6a4..30d47d29d 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -39,6 +39,10 @@ function newStrategySpace () { function buildIconByPartTypeMap () { const relationshipArray = [ + ['Personal Data', 'security'], + ['Exchange Account', 'approve'], + ['Exchange Account Asset', 'paper-plane'], + ['Exchange Account Key', 'login'], ['Workspace', 'design-tool'], ['Trading System', 'analysis'], ['Parameters', 'settings'], diff --git a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js index 5b25d4bb5..7e9af0cf0 100644 --- a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js @@ -8,14 +8,45 @@ function newAttachDetach () { function detachNode (node, rootNodes) { switch (node.type) { - case 'Trading System': { + case 'Personal Data': { return } - case 'Parameters': { - node.payload.parentNode.parameters = undefined + case 'Exchange Account': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.exchangeAccounts.length; i++) { + let strategy = payload.parentNode.exchangeAccounts[i] + if (strategy.id === node.id) { + payload.parentNode.exchangeAccounts.splice(i, 1) + } + } completeDetachment(node, rootNodes) return } + case 'Exchange Account Asset': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.assets.length; i++) { + let asset = payload.parentNode.assets[i] + if (asset.id === node.id) { + payload.parentNode.assets.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Exchange Account Key': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.keys.length; i++) { + let key = payload.parentNode.keys[i] + if (key.id === node.id) { + payload.parentNode.keys.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Trading System': { + return + } case 'Base Asset': { node.payload.parentNode.baseAsset = undefined completeDetachment(node, rootNodes) @@ -28,10 +59,10 @@ function newAttachDetach () { if (strategy.id === node.id) { payload.parentNode.strategies.splice(i, 1) } - completeDetachment(node, rootNodes) } + completeDetachment(node, rootNodes) + return } - break case 'Trigger Stage': { node.payload.parentNode.triggerStage = undefined completeDetachment(node, rootNodes) @@ -126,8 +157,8 @@ function newAttachDetach () { } } completeDetachment(node, rootNodes) + return } - break case 'Situation': { let payload = node.payload for (let i = 0; i < payload.parentNode.situations.length; i++) { @@ -137,8 +168,8 @@ function newAttachDetach () { } } completeDetachment(node, rootNodes) + return } - break case 'Phase': { let payload = node.payload for (let i = 0; i < payload.parentNode.phases.length; i++) { @@ -158,12 +189,34 @@ function newAttachDetach () { return } } + return } } } function attachNode (node, attachToNode, rootNodes) { switch (node.type) { + case 'Exchange Account': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.exchangeAccounts.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Exchange Account Asset': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.assets.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Exchange Account Key': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.keys.push(node) + completeAttachment(node, rootNodes) + } + break case 'Parameters': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index 086b7237e..e408852c1 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -8,6 +8,18 @@ function newNodeChildren () { function childrenCount (parentNode, childNode) { switch (parentNode.type) { + case 'Personal Data': { + return countChildrenPersonalData(parentNode, childNode) + } + case 'Exchange Account': { + return countChildrenExchangeAccount(parentNode, childNode) + } + case 'Exchange Account Asset': { + return countChildrenExchangeAccountAsset(parentNode, childNode) + } + case 'Exchange Account Key': { + return countChildrenExchangeAccountKey(parentNode, childNode) + } case 'Trading System': { return countChildrenTradingSystem(parentNode, childNode) } @@ -86,6 +98,62 @@ function newNodeChildren () { } } + function countChildrenPersonalData (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + + for (let i = 0; i < parentNode.exchangeAccounts.length; i++) { + let child = parentNode.exchangeAccounts[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + + function countChildrenExchangeAccount (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + + for (let i = 0; i < parentNode.assets.length; i++) { + let child = parentNode.assets[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + + for (let i = 0; i < parentNode.keys.length; i++) { + let child = parentNode.keys[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + + function countChildrenExchangeAccountAsset (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + + function countChildrenExchangeAccountKey (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + function countChildrenTradingSystem (parentNode, childNode) { let response = { childrenCount: 0, diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index 6169a5eae..6a4e00449 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -1,5 +1,9 @@ function newNodeDeleter () { thisObject = { + deletePersonalData: deletePersonalData, + deleteExchangeAccount: deleteExchangeAccount, + deleteExchangeAccountAsset: deleteExchangeAccountAsset, + deleteExchangeAccountKey: deleteExchangeAccountKey, deleteWorkspace: deleteWorkspace, deleteTradingSystem: deleteTradingSystem, deleteParameters: deleteParameters, @@ -34,6 +38,22 @@ function newNodeDeleter () { let rootNode = node.rootNodes[0] switch (rootNode.type) { + case 'Personal Data': { + deletePersonalData(rootNode, rootNodes, true) + break + } + case 'Exchange Account': { + deleteExchangeAccount(rootNode, rootNodes, true) + break + } + case 'Exchange Account Asset': { + deleteExchangeAccountAsset(rootNode, rootNodes, true) + break + } + case 'Exchange Account Key': { + deleteExchangeAccountKey(rootNode, rootNodes, true) + break + } case 'Trading System': { deleteTradingSystem(rootNode, rootNodes, true) break @@ -126,6 +146,69 @@ function newNodeDeleter () { cleanNode(node) } + function deletePersonalData (node, rootNodes) { + while (node.exchangeAccounts.length > 0) { + deleteStrategy(node.exchangeAccounts[0], rootNodes) + } + + completeDeletion(node, rootNodes) + destroyPart(node) + cleanNode(node) + } + + function deleteExchangeAccount (node, rootNodes) { + let payload = node.payload + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.exchangeAccounts.length; j++) { + let exchangeAccount = payload.parentNode.exchangeAccounts[j] + if (exchangeAccount.id === node.id) { + payload.parentNode.exchangeAccounts.splice(j, 1) + } + } + } + while (node.assets.length > 0) { + deleteExchangeAccountAsset(node.assets[0], rootNodes) + } + while (node.keys.length > 0) { + deleteExchangeAccountKey(node.keys[0], rootNodes) + } + completeDeletion(node, rootNodes) + destroyPart(node) + cleanNode(node) + } + + function deleteExchangeAccountAsset (node, rootNodes) { + let payload = node.payload + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.assets.length; j++) { + let asset = payload.parentNode.assets[j] + if (asset.id === node.id) { + payload.parentNode.assets.splice(j, 1) + } + } + } else { + completeDeletion(node, rootNodes) + } + destroyPart(node) + cleanNode(node) + } + + function deleteExchangeAccountKey (node, rootNodes) { + let payload = node.payload + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.keys.length; j++) { + let key = payload.parentNode.keys[j] + if (key.id === node.id) { + payload.parentNode.keys.splice(j, 1) + } + } + } else { + completeDeletion(node, rootNodes) + } + destroyPart(node) + cleanNode(node) + } + function deleteTradingSystem (node, rootNodes, forced) { if (forced !== true) { /* Can not delete if it is the last one */ diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 4e76603c4..411c4c038 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -1,7 +1,10 @@ function newPartsFromNodes () { thisObject = { createPartFromNode: createPartFromNode, - newStrategy: newStrategy, + addExchangeAccount: addExchangeAccount, + addExchangeAccountAsset: addExchangeAccountAsset, + addExchangeAccountKey: addExchangeAccountKey, + addStrategy: addStrategy, addParameters: addParameters, addMissingParameters: addMissingParameters, addMissingStages: addMissingStages, @@ -268,10 +271,67 @@ function newPartsFromNodes () { createPart('Workspace', workspace.name, workspace, parentNode, chainParent, 'Workspace') return } + case 'Personal Data': { + createPart('Personal Data', node.name, node, parentNode, chainParent, 'Personal Data') + for (let m = 0; m < node.exchangeAccounts.length; m++) { + let exchangeAccount = node.exchangeAccounts[m] + createPartFromNode(exchangeAccount, node, node) + } + return + } + case 'Exchange Account': { + createPart('Exchange Account', node.name, node, parentNode, chainParent, 'Exchange Account') + for (let m = 0; m < node.assets.length; m++) { + let asset = node.assets[m] + createPartFromNode(asset, node, node) + } + for (let m = 0; m < node.keys.length; m++) { + let key = node.keys[m] + createPartFromNode(key, node, node) + } + return + } + case 'Exchange Account Asset': { + createPart('Exchange Account Asset', node.name, node, parentNode, chainParent, 'Exchange Account Asset') + return + } + case 'Exchange Account Key': { + createPart('Exchange Account Key', node.name, node, parentNode, chainParent, 'Exchange Account Key') + return + } } } - function newStrategy (parentNode) { + function addExchangeAccount (parentNode) { + let personalData = parentNode + let exchangeAccount = { + name: 'New Account', + assets: [], + keys: [] + } + personalData.exchangeAccounts.push(exchangeAccount) + createPart('Exchange Account', exchangeAccount.name, exchangeAccount, personalData, personalData, 'Exchange Account') + } + + function addExchangeAccountAsset (parentNode) { + let exchangeAccount = parentNode + let asset = { + name: 'New Asset' + } + exchangeAccount.assets.push(asset) + createPart('Exchange Account Asset', asset.name, asset, exchangeAccount, exchangeAccount, 'Account Asset') + } + + function addExchangeAccountKey (parentNode) { + let exchangeAccount = parentNode + let key = { + name: 'New Key' + } + exchangeAccount.keys.push(key) + createPart('Exchange Account Key', key.name, key, exchangeAccount, exchangeAccount, 'Account Key') + } + + function addStrategy (parentNode) { let strategyParent = parentNode let strategy = { name: 'New Strategy', diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index b73b76179..e9f84014f 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -276,6 +276,55 @@ function newProtocolNode () { } return tradingSystem } + case 'Personal Data': { + let personalData = { + type: node.type, + subType: node.subType, + name: node.name, + exchangeAccounts: [] + } + + for (let m = 0; m < node.exchangeAccounts.length; m++) { + let exchangeAccount = getProtocolNode(node.exchangeAccounts[m]) + personalData.exchangeAccounts.push(exchangeAccount) + } + return personalData + } + case 'Exchange Account': { + let exchangeAccount = { + type: node.type, + subType: node.subType, + name: node.name, + assets: [], + keys: [] + } + + for (let m = 0; m < node.assets.length; m++) { + let asset = getProtocolNode(node.assets[m]) + exchangeAccount.assets.push(asset) + } + for (let m = 0; m < node.keys.length; m++) { + let key = getProtocolNode(node.keys[m]) + exchangeAccount.keys.push(key) + } + return exchangeAccount + } + case 'Exchange Account Asset': { + let asset = { + type: node.type, + subType: node.subType, + name: node.name + } + return asset + } + case 'Exchange Account Key': { + let key = { + type: node.type, + subType: node.subType, + name: node.name + } + return key + } } } } diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index 91cb154c3..f3e1a5cbd 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -326,6 +326,64 @@ function newStringifyNode () { } return tradingSystem } + case 'Personal Data': { + let personalData = { + id: node.id, + type: node.type, + subType: node.subType, + name: node.name, + exchangeAccounts: [], + savedPayload: getSavedPayload(node) + } + + for (let m = 0; m < node.exchangeAccounts.length; m++) { + let exchangeAccount = prepareForStringify(node.exchangeAccounts[m]) + personalData.exchangeAccounts.push(exchangeAccount) + } + return personalData + } + case 'Exchange Account': { + let exchangeAccount = { + id: node.id, + type: node.type, + subType: node.subType, + name: node.name, + assets: [], + keys: [], + savedPayload: getSavedPayload(node) + } + + for (let m = 0; m < node.assets.length; m++) { + let asset = prepareForStringify(node.assets[m]) + exchangeAccount.assets.push(asset) + } + + for (let m = 0; m < node.keys.length; m++) { + let key = prepareForStringify(node.keys[m]) + exchangeAccount.keys.push(key) + } + return exchangeAccount + } + case 'Exchange Account Asset': { + let asset = { + id: node.id, + type: node.type, + subType: node.subType, + name: node.name, + savedPayload: getSavedPayload(node) + } + return asset + } + case 'Exchange Account Key': { + let key = { + id: node.id, + type: node.type, + subType: node.subType, + name: node.name, + savedPayload: getSavedPayload(node) + } + return key + } } } diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index c46878fb7..9d8c36038 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -187,9 +187,9 @@ function newWorkspace () { break - case 'New Strategy': + case 'Add Strategy': { - functionLibraryPartsFromNodes.newStrategy(payload.node) + functionLibraryPartsFromNodes.addStrategy(payload.node) } break case 'Add Parameters': @@ -262,6 +262,21 @@ function newWorkspace () { functionLibraryPartsFromNodes.addCode(payload.node) } break + case 'Add Exchange Account': + { + functionLibraryPartsFromNodes.addExchangeAccount(payload.node) + } + break + case 'Add Exchange Account Asset': + { + functionLibraryPartsFromNodes.addExchangeAccountAsset(payload.node) + } + break + case 'Add Exchange Account Key': + { + functionLibraryPartsFromNodes.addExchangeAccountKey(payload.node) + } + break case 'Delete Trading System': { functionLibraryNodeDeleter.deleteTradingSystem(payload.node, workspaceNode.rootNodes) break @@ -342,6 +357,18 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteCode(payload.node, workspaceNode.rootNodes) break } + case 'Delete Exchange Account': { + functionLibraryNodeDeleter.deleteExchangeAccount(payload.node, workspaceNode.rootNodes) + break + } + case 'Delete Exchange Account Asset': { + functionLibraryNodeDeleter.deleteExchangeAccountAsset(payload.node, workspaceNode.rootNodes) + break + } + case 'Delete Exchange Account Key': { + functionLibraryNodeDeleter.deleteExchangeAccountKey(payload.node, workspaceNode.rootNodes) + break + } default: } From deb5327e42c2f93f1e63ed21ef944f2c04bbe292 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 27 Jul 2019 22:08:38 +0200 Subject: [PATCH 11/27] Definition Added, with Personal Data and Trading System as children --- FloatingSpace/StrategyPart.js | 10 ++ FloatingSpace/StrategyPartConstructor.js | 140 +++++++++++++----- FloatingSpace/StrategyPartTitle.js | 4 + Spaces/StrategySpace.js | 1 + .../FunctionLibraries/AttachDetach.js | 21 +++ .../FunctionLibraries/NodeChildren.js | 23 +++ .../FunctionLibraries/NodeDeleter.js | 71 ++++++--- .../FunctionLibraries/PartsFromNodes.js | 30 ++++ .../FunctionLibraries/ProtocolNode.js | 10 ++ .../FunctionLibraries/StringifyNode.js | 12 ++ StrategySpace/Workspace/Workspace.js | 18 +++ 11 files changed, 283 insertions(+), 57 deletions(-) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 9986c3647..ba474fdd6 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -196,6 +196,14 @@ function newStrategyPart () { let compatibleType let compatibleSubType switch (thisObject.payload.node.type) { + case 'Trading System': + compatibleType = '->' + 'Definition' + compatibleSubType = undefined + break + case 'Personal Data': + compatibleType = '->' + 'Definition' + compatibleSubType = undefined + break case 'Exchange Account': compatibleType = '->' + 'Personal Data' compatibleSubType = undefined @@ -314,6 +322,8 @@ function newStrategyPart () { let nearbyNode = floatingObject.payload.node if (compatibleType.indexOf('->' + nearbyNode.type) >= 0) { /* Discard objects with busy coonection ports */ + if (thisObject.payload.node.type === 'Trading System' && nearbyNode.tradingSystem !== undefined) { continue } + if (thisObject.payload.node.type === 'Personal Data' && nearbyNode.personalData !== undefined) { continue } if (thisObject.payload.node.type === 'Parameters' && nearbyNode.parameters !== undefined) { continue } if (thisObject.payload.node.type === 'Base Asset' && nearbyNode.baseAsset !== undefined) { continue } if (thisObject.payload.node.type === 'Trigger Stage' && nearbyNode.triggerStage !== undefined) { continue } diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 37c82ae39..c3c94205c 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -153,9 +153,105 @@ function newStrategyPartConstructor () { function getMenuItemsInitialValues (strategyPart, floatingObject, payload) { let menuItemsInitialValues = [] switch (payload.node.type) { - case 'Personal Data': { + case 'Workspace': { floatingObject.isPinned = true floatingObject.positionLocked = true + menuItemsInitialValues = [ + { + action: 'Pin / Unpin', + actionFunction: floatingObject.pinToggle, + actionStatus: floatingObject.getPinStatus, + currentStatus: true, + label: undefined, + visible: false, + iconPathOn: 'target', + iconPathOff: 'security', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -135 + }, + { + action: 'Download Workspace', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + }] + break + } + case 'Definition': { + floatingObject.isPinned = true + floatingObject.positionLocked = true + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Definition', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Definition', + visible: false, + iconPathOn: 'trash', + iconPathOff: 'trash', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Trading System', + actionFunction: payload.onMenuItemClick, + label: 'Add Trading System', + visible: false, + iconPathOn: 'approve', + iconPathOff: 'approve', + relatedStrategyPart: 'Trading System', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Personal Data', + actionFunction: payload.onMenuItemClick, + label: 'Add Personal Data', + visible: false, + iconPathOn: 'approve', + iconPathOff: 'approve', + relatedStrategyPart: 'Personal Data', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Download', + actionFunction: payload.onMenuItemClick, + label: 'Download', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Personal Data': { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { @@ -336,41 +432,7 @@ function newStrategyPartConstructor () { ) break } - case 'Workspace': { - floatingObject.isPinned = true - floatingObject.positionLocked = true - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Download Workspace', - actionFunction: payload.onMenuItemClick, - label: 'Download', - visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - }] - break - } case 'Trading System': { - floatingObject.isPinned = true - floatingObject.positionLocked = true addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { @@ -1647,6 +1709,10 @@ function newStrategyPartConstructor () { level_0() break } + case 'Definition': { + level_0() + break + } case 'Exchange Account': { level_1() break @@ -1660,11 +1726,11 @@ function newStrategyPartConstructor () { break } case 'Personal Data': { - level_0() + level_1() break } case 'Trading System': { - level_0() + level_1() break } case 'Parameters': { diff --git a/FloatingSpace/StrategyPartTitle.js b/FloatingSpace/StrategyPartTitle.js index 7ad6c9f90..a47ec5402 100644 --- a/FloatingSpace/StrategyPartTitle.js +++ b/FloatingSpace/StrategyPartTitle.js @@ -48,6 +48,10 @@ function newStrategyPartTitle () { thisObject.payload = payload switch (payload.node.type) { + case 'Definition': { + thisObject.allwaysVisible = true + break + } case 'Personal Data': { break } diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index 30d47d29d..8d78281af 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -39,6 +39,7 @@ function newStrategySpace () { function buildIconByPartTypeMap () { const relationshipArray = [ + ['Definition', 'text'], ['Personal Data', 'security'], ['Exchange Account', 'approve'], ['Exchange Account Asset', 'paper-plane'], diff --git a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js index 7e9af0cf0..107539f5f 100644 --- a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js @@ -8,7 +8,12 @@ function newAttachDetach () { function detachNode (node, rootNodes) { switch (node.type) { + case 'Definition': { + return + } case 'Personal Data': { + node.payload.parentNode.personalData = undefined + completeDetachment(node, rootNodes) return } case 'Exchange Account': { @@ -45,6 +50,8 @@ function newAttachDetach () { return } case 'Trading System': { + node.payload.parentNode.tradingSystem = undefined + completeDetachment(node, rootNodes) return } case 'Base Asset': { @@ -196,6 +203,13 @@ function newAttachDetach () { function attachNode (node, attachToNode, rootNodes) { switch (node.type) { + case 'Personal Data': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.personalData = node + completeAttachment(node, rootNodes) + } + break case 'Exchange Account': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode @@ -231,6 +245,13 @@ function newAttachDetach () { completeAttachment(node, rootNodes) } break + case 'Trading System': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.tradingSystem = node + completeAttachment(node, rootNodes) + } + break case 'Strategy': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index e408852c1..9d57b1a87 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -8,6 +8,9 @@ function newNodeChildren () { function childrenCount (parentNode, childNode) { switch (parentNode.type) { + case 'Definition': { + return countChildrenDefinition(parentNode, childNode) + } case 'Personal Data': { return countChildrenPersonalData(parentNode, childNode) } @@ -98,6 +101,26 @@ function newNodeChildren () { } } + function countChildrenDefinition (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.tradingSystem !== undefined) { + response.childrenCount++ + if (parentNode.tradingSystem.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.personalData !== undefined) { + response.childrenCount++ + if (parentNode.personalData.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + function countChildrenPersonalData (parentNode, childNode) { let response = { childrenCount: 0, diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index 6a4e00449..e4ded4e0b 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -1,5 +1,6 @@ function newNodeDeleter () { thisObject = { + deleteDefinition: deleteDefinition, deletePersonalData: deletePersonalData, deleteExchangeAccount: deleteExchangeAccount, deleteExchangeAccountAsset: deleteExchangeAccountAsset, @@ -38,24 +39,28 @@ function newNodeDeleter () { let rootNode = node.rootNodes[0] switch (rootNode.type) { + case 'Definition': { + deleteDefinition(rootNode, rootNodes, true) + break + } case 'Personal Data': { - deletePersonalData(rootNode, rootNodes, true) + deletePersonalData(rootNode, rootNodes) break } case 'Exchange Account': { - deleteExchangeAccount(rootNode, rootNodes, true) + deleteExchangeAccount(rootNode, rootNodes) break } case 'Exchange Account Asset': { - deleteExchangeAccountAsset(rootNode, rootNodes, true) + deleteExchangeAccountAsset(rootNode, rootNodes) break } case 'Exchange Account Key': { - deleteExchangeAccountKey(rootNode, rootNodes, true) + deleteExchangeAccountKey(rootNode, rootNodes) break } case 'Trading System': { - deleteTradingSystem(rootNode, rootNodes, true) + deleteTradingSystem(rootNode, rootNodes) break } case 'Parameters': { @@ -146,9 +151,45 @@ function newNodeDeleter () { cleanNode(node) } + function deleteDefinition (node, rootNodes, forced) { + let payload = node.payload + + if (forced !== true) { + /* Can not delete if it is the last one */ + let counter = 0 + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.type === node.type) { + counter++ + } + } + if (counter <= 1) { return } + } + + if (node.payload.uiObject.isRunning === true) { + node.payload.uiObject.setNotRunningStatus() + } + + if (node.tradingSystem !== undefined) { + deleteTradingSystem(node.tradingSystem, rootNodes) + } + if (node.personalData !== undefined) { + deletePersonalData(node.personalData, rootNodes) + } + completeDeletion(node, rootNodes) + destroyPart(node) + cleanNode(node) + } + function deletePersonalData (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.personalData = undefined + } + while (node.exchangeAccounts.length > 0) { - deleteStrategy(node.exchangeAccounts[0], rootNodes) + deleteExchangeAccount(node.exchangeAccounts[0], rootNodes) } completeDeletion(node, rootNodes) @@ -209,21 +250,11 @@ function newNodeDeleter () { cleanNode(node) } - function deleteTradingSystem (node, rootNodes, forced) { - if (forced !== true) { - /* Can not delete if it is the last one */ - let counter = 0 - for (let i = 0; i < rootNodes.length; i++) { - let rootNode = rootNodes[i] - if (rootNode.type === node.type) { - counter++ - } - } - if (counter <= 1) { return } - } + function deleteTradingSystem (node, rootNodes) { + let payload = node.payload - if (node.payload.uiObject.isRunning === true) { - node.payload.uiObject.setNotRunningStatus() + if (payload.parentNode !== undefined) { + payload.parentNode.tradingSystem = undefined } while (node.strategies.length > 0) { diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 411c4c038..717496d2d 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -1,6 +1,8 @@ function newPartsFromNodes () { thisObject = { createPartFromNode: createPartFromNode, + addTradingSystem: addTradingSystem, + addPersonalData: addPersonalData, addExchangeAccount: addExchangeAccount, addExchangeAccountAsset: addExchangeAccountAsset, addExchangeAccountKey: addExchangeAccountKey, @@ -299,6 +301,34 @@ function newPartsFromNodes () { createPart('Exchange Account Key', node.name, node, parentNode, chainParent, 'Exchange Account Key') return } + case 'Definition': { + createPart('Definition', node.name, node, parentNode, chainParent, 'Definition') + if (node.tradingSystem !== undefined) { + createPartFromNode(node.tradingSystem, node, node) + } + if (node.personalData !== undefined) { + createPartFromNode(node.personalData, node, node) + } + return + } + } + } + + function addTradingSystem (node) { + if (node.tradingSystem === undefined) { + node.tradingSystem = { + strategies: [] + } + createPart('Trading System', '', node.tradingSystem, node, node) + } + } + + function addPersonalData (node) { + if (node.personalData === undefined) { + node.personalData = { + exchangeAccounts: [] + } + createPart('Personal Data', '', node.personalData, node, node) } } diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index e9f84014f..7f569fc43 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -325,6 +325,16 @@ function newProtocolNode () { } return key } + case 'Definition': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + tradingSystem: getProtocolNode(node.tradingSystem), + personalData: getProtocolNode(node.personalData) + } + return object + } } } } diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index f3e1a5cbd..ffb8723cd 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -384,6 +384,18 @@ function newStringifyNode () { } return key } + case 'Definition': { + let object = { + id: node.id, + type: node.type, + subType: node.subType, + name: node.name, + tradingSystem: prepareForStringify(node.tradingSystem), + personalData: prepareForStringify(node.personalData), + savedPayload: getSavedPayload(node) + } + return object + } } } diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 9d8c36038..a75374aa5 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -277,6 +277,16 @@ function newWorkspace () { functionLibraryPartsFromNodes.addExchangeAccountKey(payload.node) } break + case 'Add Trading System': + { + functionLibraryPartsFromNodes.addTradingSystem(payload.node) + } + break + case 'Add Personal Data': + { + functionLibraryPartsFromNodes.addPersonalData(payload.node) + } + break case 'Delete Trading System': { functionLibraryNodeDeleter.deleteTradingSystem(payload.node, workspaceNode.rootNodes) break @@ -369,6 +379,14 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteExchangeAccountKey(payload.node, workspaceNode.rootNodes) break } + case 'Delete Personal Data': { + functionLibraryNodeDeleter.deletePersonalData(payload.node, workspaceNode.rootNodes) + break + } + case 'Delete Definition': { + functionLibraryNodeDeleter.deleteDefinition(payload.node, workspaceNode.rootNodes) + break + } default: } From b2f7ccbb1232528f1fc5b20e10bf9dc06117ce06 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 28 Jul 2019 08:52:53 +0200 Subject: [PATCH 12/27] Saving and Execution Focus from Definition --- FloatingSpace/StrategyPartConstructor.js | 78 ++++++++++++------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index c3c94205c..0f69d9e1f 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -189,6 +189,37 @@ function newStrategyPartConstructor () { floatingObject.isPinned = true floatingObject.positionLocked = true addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Run Trading System', + actionFunction: payload.uiObject.run, + label: 'Run', + visible: false, + iconPathOn: 'paper-plane', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -70 + } + ) + menuItemsInitialValues.push( + { + action: 'Save Trading System', + actionFunction: payload.onMenuItemClick, + label: 'Save Changes', + workingLabel: 'Saving...', + workDoneLabel: 'Saved', + workFailedLabel: 'Not Saved', + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) menuItemsInitialValues.push( { action: 'Delete Definition', @@ -202,7 +233,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -10 } ) menuItemsInitialValues.push( @@ -217,7 +248,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 10 } ) menuItemsInitialValues.push( @@ -232,7 +263,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 40 } ) menuItemsInitialValues.push( @@ -246,7 +277,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 70 } ) break @@ -434,37 +465,6 @@ function newStrategyPartConstructor () { } case 'Trading System': { addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Run Trading System', - actionFunction: payload.uiObject.run, - label: 'Run', - visible: false, - iconPathOn: 'paper-plane', - iconPathOff: 'upload', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -70 - } - ) - menuItemsInitialValues.push( - { - action: 'Save Trading System', - actionFunction: payload.onMenuItemClick, - label: 'Save Changes', - workingLabel: 'Saving...', - workDoneLabel: 'Saved', - workFailedLabel: 'Not Saved', - visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) menuItemsInitialValues.push( { action: 'Delete Trading System', @@ -478,7 +478,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: -60 } ) menuItemsInitialValues.push( @@ -493,7 +493,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: +10 + angle: -20 } ) menuItemsInitialValues.push( @@ -508,7 +508,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 20 } ) menuItemsInitialValues.push( @@ -522,7 +522,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 70 + angle: 60 } ) break From 9d7829d54edba305efee5efaa9347e6d80e4c37b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 28 Jul 2019 09:58:39 +0200 Subject: [PATCH 13/27] BUG with FullScreen fixed, Keys with code editor to put the key values. --- CockpitSpace/FullScreen.js | 2 ++ FloatingSpace/CircularMenuItem.js | 8 +++---- FloatingSpace/CodeEditor.js | 2 +- FloatingSpace/StrategyPartConstructor.js | 24 +++++++++++++++++-- Globals.js | 1 + .../FunctionLibraries/PartsFromNodes.js | 3 ++- .../FunctionLibraries/ProtocolNode.js | 3 ++- .../FunctionLibraries/StringifyNode.js | 1 + 8 files changed, 35 insertions(+), 9 deletions(-) diff --git a/CockpitSpace/FullScreen.js b/CockpitSpace/FullScreen.js index 2218de0c0..8f204e3b7 100644 --- a/CockpitSpace/FullScreen.js +++ b/CockpitSpace/FullScreen.js @@ -78,10 +78,12 @@ function newFullScreen () { thisObject.status = 'On' goFullscreen() CURRENT_TOP_MARGIN = 0 + AT_FULL_SCREEN_MODE = true } else { thisObject.status = 'Off' goOutFullscreen() CURRENT_TOP_MARGIN = window.canvasApp.topMargin + AT_FULL_SCREEN_MODE = false } } diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index d969cdb74..40f87bfa0 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -93,7 +93,7 @@ function newCircularMenuItem () { } function getContainer (point) { - if (thisObject.dontShowAtFullscreen === true && CURRENT_TOP_MARGIN === 0) { return } + if (thisObject.dontShowAtFullscreen === true && AT_FULL_SCREEN_MODE === true) { return } let container if (thisObject.isDeployed === true) { @@ -106,7 +106,7 @@ function newCircularMenuItem () { } function physics () { - if (thisObject.dontShowAtFullscreen === true && CURRENT_TOP_MARGIN === 0) { return } + if (thisObject.dontShowAtFullscreen === true && AT_FULL_SCREEN_MODE === true) { return } const INCREASE_STEP = 2 @@ -206,7 +206,7 @@ function newCircularMenuItem () { } function drawBackground () { - if (thisObject.dontShowAtFullscreen === true && CURRENT_TOP_MARGIN === 0) { return } + if (thisObject.dontShowAtFullscreen === true && AT_FULL_SCREEN_MODE === true) { return } if (thisObject.container.frame.position.x > 0 && thisObject.isDeployed === true && thisObject.currentRadius >= thisObject.targetRadius) { if (thisObject.type === 'Icon & Text') { @@ -231,7 +231,7 @@ function newCircularMenuItem () { } function drawForeground () { - if (thisObject.dontShowAtFullscreen === true && CURRENT_TOP_MARGIN === 0) { return } + if (thisObject.dontShowAtFullscreen === true && AT_FULL_SCREEN_MODE === true) { return } let menuPosition = { x: thisObject.currentRadius * 1.5, diff --git a/FloatingSpace/CodeEditor.js b/FloatingSpace/CodeEditor.js index 9b910f842..5bfa65232 100644 --- a/FloatingSpace/CodeEditor.js +++ b/FloatingSpace/CodeEditor.js @@ -133,7 +133,7 @@ function newCodeEditor () { let textAreaPosition = { x: 0 - thisObject.container.frame.width / 2, - y: 0 + thisObject.container.frame.height * 2 / 7 + y: 0 - thisObject.container.frame.height * 3 / 7 } textAreaPosition = thisObject.container.frame.frameThisPoint(textAreaPosition) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 0f69d9e1f..2646cdbe3 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -430,7 +430,27 @@ function newStrategyPartConstructor () { break } case 'Exchange Account Key': { + strategyPart.codeEditor = newCodeEditor() + strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction + strategyPart.codeEditor.initialize() + strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Key Value', + actionFunction: strategyPart.codeEditor.activate, + label: 'Edit Key Value', + visible: false, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Delete Exchange Account Key', @@ -444,7 +464,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 0 } ) menuItemsInitialValues.push( @@ -458,7 +478,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 40 } ) break diff --git a/Globals.js b/Globals.js index eebdfc073..564259e92 100644 --- a/Globals.js +++ b/Globals.js @@ -170,6 +170,7 @@ let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwrit let VERY_LARGE_NUMBER = 100000000000 let CURRENT_TOP_MARGIN = window.canvasApp.topMargin +let AT_FULL_SCREEN_MODE = false let maxDate = new Date(); maxDate.setMilliseconds(0); diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 717496d2d..b37cdf60a 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -355,7 +355,8 @@ function newPartsFromNodes () { function addExchangeAccountKey (parentNode) { let exchangeAccount = parentNode let key = { - name: 'New Key' + name: 'New Key', + code: 'Paste your exchange API secret key here. Secret keys are filtered out and NOT exported when using the SHARE menu option on any object at your workspace. Secret keys ARE downloaded when using the download button.' } exchangeAccount.keys.push(key) createPart('Exchange Account Key', key.name, key, exchangeAccount, exchangeAccount, 'Account Key') diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index 7f569fc43..45fec8e52 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -321,7 +321,8 @@ function newProtocolNode () { let key = { type: node.type, subType: node.subType, - name: node.name + name: node.name, + code: node.code } return key } diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index ffb8723cd..964775d6e 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -380,6 +380,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, savedPayload: getSavedPayload(node) } return key From 5018235d98a27ee55d83e80904d965fa5ca5ab29 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 28 Jul 2019 18:01:55 +0200 Subject: [PATCH 14/27] Dealing with Personal Data, NOT SHARING it implemented and tested. --- FloatingSpace/StrategyPartConstructor.js | 210 ++++++++---------- .../FunctionLibraries/ProtocolNode.js | 80 +++---- .../FunctionLibraries/StringifyNode.js | 78 ++++--- StrategySpace/Workspace/Workspace.js | 38 +++- 4 files changed, 202 insertions(+), 204 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 2646cdbe3..9115b62ae 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -97,7 +97,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -135 + angle: -130 } ) menuItemsInitialValues.push( @@ -113,7 +113,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -165 + angle: -155 } ) menuItemsInitialValues.push( @@ -129,7 +129,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 165 + angle: 180 } ) menuItemsInitialValues.push( @@ -145,7 +145,21 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 135 + angle: 155 + } + ) + menuItemsInitialValues.push( + { + action: 'Backup', + actionFunction: floatingObject.payload.onMenuItemClick, + label: undefined, + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 130 } ) } @@ -172,9 +186,21 @@ function newStrategyPartConstructor () { angle: -135 }, { - action: 'Download Workspace', + action: 'Backup Workspace', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: undefined, + visible: false, + iconPathOn: 'upload', + iconPathOff: 'upload', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 130 + }, + { + action: 'Share Workspace', + actionFunction: payload.onMenuItemClick, + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -268,9 +294,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -297,7 +323,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -30 + angle: -20 } ) menuItemsInitialValues.push( @@ -312,23 +338,9 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: +0 + angle: +20 } ) - menuItemsInitialValues.push( - { - action: 'Download', - actionFunction: payload.onMenuItemClick, - label: 'Download', - visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 30 - } - ) break } case 'Exchange Account': { @@ -346,7 +358,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -40 } ) menuItemsInitialValues.push( @@ -361,7 +373,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 0 } ) menuItemsInitialValues.push( @@ -376,23 +388,9 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 40 } ) - menuItemsInitialValues.push( - { - action: 'Download', - actionFunction: payload.onMenuItemClick, - label: 'Download', - visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 60 - } - ) break } case 'Exchange Account Asset': { @@ -410,23 +408,9 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 0 } ) - menuItemsInitialValues.push( - { - action: 'Download', - actionFunction: payload.onMenuItemClick, - label: 'Download', - visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20 - } - ) break } case 'Exchange Account Key': { @@ -447,7 +431,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40, + angle: -20, dontShowAtFullscreen: true } ) @@ -464,23 +448,9 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 0 + angle: 20 } ) - menuItemsInitialValues.push( - { - action: 'Download', - actionFunction: payload.onMenuItemClick, - label: 'Download', - visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 40 - } - ) break } case 'Trading System': { @@ -533,9 +503,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -581,9 +551,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -630,9 +600,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -678,9 +648,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -763,9 +733,9 @@ function newStrategyPartConstructor () { angle: 0 }, { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -824,9 +794,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -872,9 +842,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -920,9 +890,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -969,9 +939,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1018,9 +988,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1067,9 +1037,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1116,9 +1086,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1165,9 +1135,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1213,9 +1183,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1247,9 +1217,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1281,9 +1251,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1330,9 +1300,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1379,9 +1349,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1443,9 +1413,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1497,9 +1467,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1546,9 +1516,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1595,9 +1565,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1644,9 +1614,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', @@ -1698,9 +1668,9 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Download', + action: 'Share', actionFunction: payload.onMenuItemClick, - label: 'Download', + label: 'Share', visible: false, iconPathOn: 'upload', iconPathOff: 'upload', diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index 45fec8e52..c3eb4d943 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -4,7 +4,7 @@ function newProtocolNode () { } return thisObject - function getProtocolNode (node) { + function getProtocolNode (node, removePersonalData) { if (node === undefined) { return } switch (node.type) { case 'Code': @@ -23,7 +23,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code) + code: getProtocolNode(node.code, removePersonalData) } return condition } @@ -36,7 +36,7 @@ function newProtocolNode () { } for (let m = 0; m < node.conditions.length; m++) { - let condition = getProtocolNode(node.conditions[m]) + let condition = getProtocolNode(node.conditions[m], removePersonalData) situation.conditions.push(condition) } return situation @@ -60,7 +60,7 @@ function newProtocolNode () { situations: [] } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m]) + let situation = getProtocolNode(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -70,8 +70,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula), - nextPhaseEvent: getProtocolNode(node.nextPhaseEvent) + formula: getProtocolNode(node.formula, removePersonalData), + nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData) } return phase } @@ -84,7 +84,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m]) + let phase = getProtocolNode(node.phases[m], removePersonalData) stop.phases.push(phase) } return stop @@ -98,7 +98,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m]) + let phase = getProtocolNode(node.phases[m], removePersonalData) takeProfit.phases.push(phase) } return takeProfit @@ -112,7 +112,7 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m]) + let situation = getProtocolNode(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -126,7 +126,7 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m]) + let situation = getProtocolNode(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -140,7 +140,7 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m]) + let situation = getProtocolNode(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -150,10 +150,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss), - takeProfit: getProtocolNode(node.takeProfit), - positionSize: getProtocolNode(node.positionSize), - positionRate: getProtocolNode(node.positionRate) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData), + positionSize: getProtocolNode(node.positionSize, removePersonalData), + positionRate: getProtocolNode(node.positionRate, removePersonalData) } return object } @@ -178,7 +178,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula) + formula: getProtocolNode(node.formula, removePersonalData) } return object } @@ -187,7 +187,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula) + formula: getProtocolNode(node.formula, removePersonalData) } return object } @@ -196,9 +196,9 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerOn: getProtocolNode(node.triggerOn), - triggerOff: getProtocolNode(node.triggerOff), - takePosition: getProtocolNode(node.takePosition) + triggerOn: getProtocolNode(node.triggerOn, removePersonalData), + triggerOff: getProtocolNode(node.triggerOff, removePersonalData), + takePosition: getProtocolNode(node.takePosition, removePersonalData) } return stage } @@ -207,8 +207,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: getProtocolNode(node.initialDefinition), - openExecution: getProtocolNode(node.openExecution) + initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData), + openExecution: getProtocolNode(node.openExecution, removePersonalData) } return stage } @@ -217,8 +217,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss), - takeProfit: getProtocolNode(node.takeProfit) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData) } return stage } @@ -227,7 +227,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - closeExecution: getProtocolNode(node.closeExecution) + closeExecution: getProtocolNode(node.closeExecution, removePersonalData) } return stage } @@ -236,10 +236,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerStage: getProtocolNode(node.triggerStage), - openStage: getProtocolNode(node.openStage), - manageStage: getProtocolNode(node.manageStage), - closeStage: getProtocolNode(node.closeStage) + triggerStage: getProtocolNode(node.triggerStage, removePersonalData), + openStage: getProtocolNode(node.openStage, removePersonalData), + manageStage: getProtocolNode(node.manageStage, removePersonalData), + closeStage: getProtocolNode(node.closeStage, removePersonalData) } return strategy } @@ -248,7 +248,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula) + formula: getProtocolNode(node.formula, removePersonalData) } return object } @@ -257,7 +257,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - baseAsset: getProtocolNode(node.baseAsset) + baseAsset: getProtocolNode(node.baseAsset, removePersonalData) } return object } @@ -267,16 +267,17 @@ function newProtocolNode () { subType: node.subType, name: node.name, strategies: [], - parameters: getProtocolNode(node.parameters) + parameters: getProtocolNode(node.parameters, removePersonalData) } for (let m = 0; m < node.strategies.length; m++) { - let strategy = getProtocolNode(node.strategies[m]) + let strategy = getProtocolNode(node.strategies[m], removePersonalData) tradingSystem.strategies.push(strategy) } return tradingSystem } case 'Personal Data': { + if (removePersonalData === true) { return } let personalData = { type: node.type, subType: node.subType, @@ -285,12 +286,13 @@ function newProtocolNode () { } for (let m = 0; m < node.exchangeAccounts.length; m++) { - let exchangeAccount = getProtocolNode(node.exchangeAccounts[m]) + let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData) personalData.exchangeAccounts.push(exchangeAccount) } return personalData } case 'Exchange Account': { + if (removePersonalData === true) { return } let exchangeAccount = { type: node.type, subType: node.subType, @@ -300,16 +302,17 @@ function newProtocolNode () { } for (let m = 0; m < node.assets.length; m++) { - let asset = getProtocolNode(node.assets[m]) + let asset = getProtocolNode(node.assets[m], removePersonalData) exchangeAccount.assets.push(asset) } for (let m = 0; m < node.keys.length; m++) { - let key = getProtocolNode(node.keys[m]) + let key = getProtocolNode(node.keys[m], removePersonalData) exchangeAccount.keys.push(key) } return exchangeAccount } case 'Exchange Account Asset': { + if (removePersonalData === true) { return } let asset = { type: node.type, subType: node.subType, @@ -318,6 +321,7 @@ function newProtocolNode () { return asset } case 'Exchange Account Key': { + if (removePersonalData === true) { return } let key = { type: node.type, subType: node.subType, @@ -331,8 +335,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - tradingSystem: getProtocolNode(node.tradingSystem), - personalData: getProtocolNode(node.personalData) + tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData), + personalData: getProtocolNode(node.personalData, removePersonalData) } return object } diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index 964775d6e..4191cacd0 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -4,7 +4,7 @@ function newStringifyNode () { } return thisObject - function prepareForStringify (node) { + function prepareForStringify (node, removePersonalData) { if (node === undefined) { return } switch (node.type) { case 'Code': @@ -26,7 +26,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - code: prepareForStringify(node.code), + code: prepareForStringify(node.code, removePersonalData), savedPayload: getSavedPayload(node) } return condition @@ -42,7 +42,7 @@ function newStringifyNode () { } for (let m = 0; m < node.conditions.length; m++) { - let condition = prepareForStringify(node.conditions[m]) + let condition = prepareForStringify(node.conditions[m], removePersonalData) situation.conditions.push(condition) } return situation @@ -70,7 +70,7 @@ function newStringifyNode () { savedPayload: getSavedPayload(node) } for (let m = 0; m < node.situations.length; m++) { - let situation = prepareForStringify(node.situations[m]) + let situation = prepareForStringify(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -81,8 +81,8 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - formula: prepareForStringify(node.formula), - nextPhaseEvent: prepareForStringify(node.nextPhaseEvent), + formula: prepareForStringify(node.formula, removePersonalData), + nextPhaseEvent: prepareForStringify(node.nextPhaseEvent, removePersonalData), savedPayload: getSavedPayload(node) } return phase @@ -99,7 +99,7 @@ function newStringifyNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = prepareForStringify(node.phases[m]) + let phase = prepareForStringify(node.phases[m], removePersonalData) stop.phases.push(phase) } return stop @@ -116,7 +116,7 @@ function newStringifyNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = prepareForStringify(node.phases[m]) + let phase = prepareForStringify(node.phases[m], removePersonalData) takeProfit.phases.push(phase) } return takeProfit @@ -132,7 +132,7 @@ function newStringifyNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = prepareForStringify(node.situations[m]) + let situation = prepareForStringify(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -148,7 +148,7 @@ function newStringifyNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = prepareForStringify(node.situations[m]) + let situation = prepareForStringify(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -164,7 +164,7 @@ function newStringifyNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = prepareForStringify(node.situations[m]) + let situation = prepareForStringify(node.situations[m], removePersonalData) event.situations.push(situation) } return event @@ -175,10 +175,10 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: prepareForStringify(node.stopLoss), - takeProfit: prepareForStringify(node.takeProfit), - positionSize: prepareForStringify(node.positionSize), - positionRate: prepareForStringify(node.positionRate), + stopLoss: prepareForStringify(node.stopLoss, removePersonalData), + takeProfit: prepareForStringify(node.takeProfit, removePersonalData), + positionSize: prepareForStringify(node.positionSize, removePersonalData), + positionRate: prepareForStringify(node.positionRate, removePersonalData), savedPayload: getSavedPayload(node) } return object @@ -209,7 +209,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - formula: prepareForStringify(node.formula), + formula: prepareForStringify(node.formula, removePersonalData), savedPayload: getSavedPayload(node) } return object @@ -220,7 +220,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - formula: prepareForStringify(node.formula), + formula: prepareForStringify(node.formula, removePersonalData), savedPayload: getSavedPayload(node) } return object @@ -231,9 +231,9 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - triggerOn: prepareForStringify(node.triggerOn), - triggerOff: prepareForStringify(node.triggerOff), - takePosition: prepareForStringify(node.takePosition), + triggerOn: prepareForStringify(node.triggerOn, removePersonalData), + triggerOff: prepareForStringify(node.triggerOff, removePersonalData), + takePosition: prepareForStringify(node.takePosition, removePersonalData), savedPayload: getSavedPayload(node) } return stage @@ -244,8 +244,8 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: prepareForStringify(node.initialDefinition), - openExecution: prepareForStringify(node.openExecution), + initialDefinition: prepareForStringify(node.initialDefinition, removePersonalData), + openExecution: prepareForStringify(node.openExecution, removePersonalData), savedPayload: getSavedPayload(node) } return stage @@ -256,8 +256,8 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: prepareForStringify(node.stopLoss), - takeProfit: prepareForStringify(node.takeProfit), + stopLoss: prepareForStringify(node.stopLoss, removePersonalData), + takeProfit: prepareForStringify(node.takeProfit, removePersonalData), savedPayload: getSavedPayload(node) } return stage @@ -268,7 +268,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - closeExecution: prepareForStringify(node.closeExecution), + closeExecution: prepareForStringify(node.closeExecution, removePersonalData), savedPayload: getSavedPayload(node) } return stage @@ -279,10 +279,10 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - triggerStage: prepareForStringify(node.triggerStage), - openStage: prepareForStringify(node.openStage), - manageStage: prepareForStringify(node.manageStage), - closeStage: prepareForStringify(node.closeStage), + triggerStage: prepareForStringify(node.triggerStage, removePersonalData), + openStage: prepareForStringify(node.openStage, removePersonalData), + manageStage: prepareForStringify(node.manageStage, removePersonalData), + closeStage: prepareForStringify(node.closeStage, removePersonalData), savedPayload: getSavedPayload(node) } return strategy @@ -293,7 +293,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - formula: prepareForStringify(node.formula), + formula: prepareForStringify(node.formula, removePersonalData), savedPayload: getSavedPayload(node) } return object @@ -304,7 +304,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - baseAsset: prepareForStringify(node.baseAsset), + baseAsset: prepareForStringify(node.baseAsset, removePersonalData), savedPayload: getSavedPayload(node) } return object @@ -316,17 +316,18 @@ function newStringifyNode () { subType: node.subType, name: node.name, strategies: [], - parameters: prepareForStringify(node.parameters), + parameters: prepareForStringify(node.parameters, removePersonalData), savedPayload: getSavedPayload(node) } for (let m = 0; m < node.strategies.length; m++) { - let strategy = prepareForStringify(node.strategies[m]) + let strategy = prepareForStringify(node.strategies[m], removePersonalData) tradingSystem.strategies.push(strategy) } return tradingSystem } case 'Personal Data': { + if (removePersonalData === true) { return } let personalData = { id: node.id, type: node.type, @@ -343,6 +344,7 @@ function newStringifyNode () { return personalData } case 'Exchange Account': { + if (removePersonalData === true) { return } let exchangeAccount = { id: node.id, type: node.type, @@ -354,17 +356,18 @@ function newStringifyNode () { } for (let m = 0; m < node.assets.length; m++) { - let asset = prepareForStringify(node.assets[m]) + let asset = prepareForStringify(node.assets[m], removePersonalData) exchangeAccount.assets.push(asset) } for (let m = 0; m < node.keys.length; m++) { - let key = prepareForStringify(node.keys[m]) + let key = prepareForStringify(node.keys[m], removePersonalData) exchangeAccount.keys.push(key) } return exchangeAccount } case 'Exchange Account Asset': { + if (removePersonalData === true) { return } let asset = { id: node.id, type: node.type, @@ -375,6 +378,7 @@ function newStringifyNode () { return asset } case 'Exchange Account Key': { + if (removePersonalData === true) { return } let key = { id: node.id, type: node.type, @@ -391,8 +395,8 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - tradingSystem: prepareForStringify(node.tradingSystem), - personalData: prepareForStringify(node.personalData), + tradingSystem: prepareForStringify(node.tradingSystem, removePersonalData), + personalData: prepareForStringify(node.personalData, removePersonalData), savedPayload: getSavedPayload(node) } return object diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index a75374aa5..0c1e74d87 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -115,11 +115,11 @@ function newWorkspace () { window.localStorage.setItem(CANVAS_APP_NAME + '.' + 'Workspace' + '.' + user.alias, textToSave) } - function stringifyWorkspace () { + function stringifyWorkspace (removePersonalData) { let stringifyReadyNodes = [] for (let i = 0; i < workspaceNode.rootNodes.length; i++) { let rootNode = workspaceNode.rootNodes[i] - let workspace = functionLibraryWorkspaceNodes.prepareForStringify(rootNode) + let workspace = functionLibraryWorkspaceNodes.prepareForStringify(rootNode, removePersonalData) stringifyReadyNodes.push(workspace) } let workspace = { @@ -127,6 +127,7 @@ function newWorkspace () { name: workspaceNode.name, rootNodes: stringifyReadyNodes } + return JSON.stringify(workspace) } @@ -154,13 +155,19 @@ function newWorkspace () { async function onMenuItemClick (payload, action) { switch (action) { - case 'Download Workspace': + case 'Share Workspace': { - let text = stringifyWorkspace() - let fileName = payload.node.type + ' - ' + payload.node.name + '.json' + let text = stringifyWorkspace(true) + let fileName = 'Share - ' + payload.node.type + ' - ' + payload.node.name + '.json' + download(fileName, text) + } + break + case 'Backup Workspace': + { + let text = stringifyWorkspace(false) + let fileName = 'Backup - ' + payload.node.type + ' - ' + payload.node.name + '.json' download(fileName, text) } - break case 'Save Trading System': { @@ -172,21 +179,34 @@ function newWorkspace () { case 'Edit Code': break - case 'Download': + case 'Share': { - let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node)) + let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true)) let nodeName = payload.node.name if (nodeName === undefined) { nodeName = '' } else { nodeName = '.' + nodeName } - let fileName = payload.node.type + ' - ' + nodeName + '.json' + let fileName = 'Share - ' + payload.node.type + ' - ' + nodeName + '.json' download(fileName, text) } break + case 'Backup': + { + let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false)) + let nodeName = payload.node.name + if (nodeName === undefined) { + nodeName = '' + } else { + nodeName = '.' + nodeName + } + let fileName = 'Backup - ' + payload.node.type + ' - ' + nodeName + '.json' + download(fileName, text) + } + break case 'Add Strategy': { functionLibraryPartsFromNodes.addStrategy(payload.node) From fd4344e7933fc9de393dd46075fa0bfd064be595 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 29 Jul 2019 10:42:44 +0200 Subject: [PATCH 15/27] Changes to make it work Locally --- ChartsSpace/PlottersManager.js | 4 + Dashboard.js | 13 ++- StrategySpace/StrategizerGateway.js | 147 ++++++++++++++++------------ TopSpace/Login.js | 19 ++-- 4 files changed, 106 insertions(+), 77 deletions(-) diff --git a/ChartsSpace/PlottersManager.js b/ChartsSpace/PlottersManager.js index 9cfdd845f..ef59d597b 100644 --- a/ChartsSpace/PlottersManager.js +++ b/ChartsSpace/PlottersManager.js @@ -142,6 +142,10 @@ function newPlottersManager () { function initializeCompetitionPlotters (callBack) { try { + /* Disabling this functionality since it is not currently available */ + callBack(GLOBAL.DEFAULT_OK_RESPONSE) + return + /* At this current version of the platform, we will support only one competition with only one plotter. */ const COMPETITION_HOST = 'AAMasters' diff --git a/Dashboard.js b/Dashboard.js index 4e69b50cb..ccf9635d3 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -7,9 +7,9 @@ try { viewPort = newViewPort() } catch (e) { setTimeout(() => { - console.log("Loading deferred.") + console.log('Loading deferred.') viewPort = newViewPort() - }, 1000); + }, 1000) } function newDashboard () { @@ -36,6 +36,13 @@ function newDashboard () { if (canvas !== undefined) { canvas.finalize() } + /* Here we check where we are executing. In case we are Local we need to create a Local Dummy User and Team. */ + + if (window.canvasApp.executingAt === 'Local') { + window.localStorage.setItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY, 'Local Access Token') // Dummy Access Token + window.localStorage.setItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY, '{"authId":"x|x","alias":"user"}') // Dummy Local User + } + /* Here we will setup the global eventHandler that will enable the Canvas App to react to events happening outside its execution scope. */ window.canvasApp.eventHandler = newEventHandler() @@ -161,7 +168,7 @@ function newDashboard () { }) .then(response => { teams = response.data.teams_Teams - //window.localStorage.setItem('Teams', JSON.stringify(response.data.teams_Teams)) + // window.localStorage.setItem('Teams', JSON.stringify(response.data.teams_Teams)) resolve({ teams: response.data.teams_Teams }) }) .catch(err => { diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 589ff517e..442c335bc 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -45,41 +45,47 @@ function newStrategizerGateway () { return } - user = JSON.parse(user) - let fbSlug = 'simulator-bot-' + user.alias.replace('.', '') - - graphQLServer = await axios({ - url: window.canvasApp.graphQL.masterAppApiUrl, - method: 'post', - data: { - query: - ` - query($fbSlug: String!){ - strategizer_TradingSystemByFb(fbSlug: $fbSlug){ - id - fbSlug - data - } - } - `, - - variables: { - fbSlug: fbSlug - } - }, - headers: { - authorization: 'Bearer ' + accessToken - } - }) - - if (graphQLServer.data.errors) { - logger.write('[ERROR] loadFromStrategyzer -> GraphQL Error: ' + JSON.stringify(graphQLServer.data.errors)) - return false + if (window.canvasApp.executingAt === 'Local') { + window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, 'Local File') + thisObject.strategizerData = JSON.parse('{"type":"Definition"}') + thisObject.idAtStrategizer = 'Local File' } else { - thisObject.strategizerData = JSON.parse(JSON.stringify(graphQLServer.data.data.strategizer_TradingSystemByFb.data)) - thisObject.idAtStrategizer = graphQLServer.data.data.strategizer_TradingSystemByFb.id - window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, thisObject.idAtStrategizer) - return true + user = JSON.parse(user) + let fbSlug = 'simulator-bot-' + user.alias.replace('.', '') + + graphQLServer = await axios({ + url: window.canvasApp.graphQL.masterAppApiUrl, + method: 'post', + data: { + query: + ` + query($fbSlug: String!){ + strategizer_TradingSystemByFb(fbSlug: $fbSlug){ + id + fbSlug + data + } + } + `, + + variables: { + fbSlug: fbSlug + } + }, + headers: { + authorization: 'Bearer ' + accessToken + } + }) + + if (graphQLServer.data.errors) { + logger.write('[ERROR] loadFromStrategyzer -> GraphQL Error: ' + JSON.stringify(graphQLServer.data.errors)) + return false + } else { + thisObject.strategizerData = JSON.parse(JSON.stringify(graphQLServer.data.data.strategizer_TradingSystemByFb.data)) + thisObject.idAtStrategizer = graphQLServer.data.data.strategizer_TradingSystemByFb.id + window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, thisObject.idAtStrategizer) + return true + } } } catch (err) { logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack) @@ -100,10 +106,6 @@ function newStrategizerGateway () { return } - user = JSON.parse(user) - - /* See if we need to update or create a new record at the strategizer */ - let tradingSystem = canvas.strategySpace.workspace.getProtocolTradingSystem() if (tradingSystem === undefined || tradingSystem === null) { logger.write('[ERROR] saveToStrategyzer -> Can not save when tradingSystem is null or undefined.') @@ -115,37 +117,52 @@ function newStrategizerGateway () { logger.write('[ERROR] saveToStrategyzer -> Can not save when idAtStrategizer is null or undefined.') return } - graphQLServer = await axios({ - url: window.canvasApp.graphQL.masterAppApiUrl, - method: 'post', - data: { - query: ` - mutation strategizer_EditTradingSystem - ( - $id: ID!, $data: strategizer_JSON! - ) - { - strategizer_EditTradingSystem(id: $id, tradingSystem: { data: $data }) - { - id - } - } - `, - variables: { - id: idAtStrategizer, - data: tradingSystem + + if (window.canvasApp.executingAt === 'Local') { + callServer(tradingSystem, 'SaveDefinition', onSaved) + function onSaved (err) { + if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { + return true + } else { + logger.write('[ERROR] saveToStrategyzer -> Can not save definition to local server. err = ' + err.messsage) + return false } - }, - headers: { - authorization: 'Bearer ' + accessToken } - }) + } else { + user = JSON.parse(user) - if (graphQLServer.data.errors) { - logger.write('[ERROR] saveToStrategyzer -> GraphsQL Error -> graphQLServer.data.errors = ' + JSON.stringify(graphQLServer.data.errors)) + graphQLServer = await axios({ + url: window.canvasApp.graphQL.masterAppApiUrl, + method: 'post', + data: { + query: ` + mutation strategizer_EditTradingSystem + ( + $id: ID!, $data: strategizer_JSON! + ) + { + strategizer_EditTradingSystem(id: $id, tradingSystem: { data: $data }) + { + id + } + } + `, + variables: { + id: idAtStrategizer, + data: tradingSystem + } + }, + headers: { + authorization: 'Bearer ' + accessToken + } + }) + + if (graphQLServer.data.errors) { + logger.write('[ERROR] saveToStrategyzer -> GraphsQL Error -> graphQLServer.data.errors = ' + JSON.stringify(graphQLServer.data.errors)) + } + + return true } - - return true } catch (err) { logger.write('[ERROR] saveToStrategyzer -> err = ' + err.stack) } diff --git a/TopSpace/Login.js b/TopSpace/Login.js index b3964fbeb..79b09d25a 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -1,5 +1,5 @@ -function newLogin() { +function newLogin () { const MODULE_NAME = 'Login' const ERROR_LOG = true const logger = newWebDebugLog() @@ -27,8 +27,10 @@ function newLogin() { return thisObject - async function initialize(sharedStatus) { + async function initialize (sharedStatus) { try { + if (window.canvasApp.executingAt === 'Local') { return } + const accessToken = window.localStorage.getItem('access_token') if (accessToken) { @@ -37,14 +39,13 @@ function newLogin() { } thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick) - } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err) } if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err.stack = ' + err.stack) } } } - async function getEvents(accessToken, sharedStatus) { + async function getEvents (accessToken, sharedStatus) { var d = new Date() var nowSeconds = Math.round(d.getTime() / 1000) var twoWeeksAgoSeconds = nowSeconds - 1209600 @@ -72,7 +73,7 @@ function newLogin() { } } } - }`, + }` }, variables: { variables: { maxStartDate: nowSeconds, minEndDate: twoWeeksAgoSeconds } @@ -99,7 +100,7 @@ function newLogin() { } } - async function getClones(accessToken) { + async function getClones (accessToken) { let response = await axios({ url: window.canvasApp.graphQL.masterAppApiUrl, method: 'post', @@ -166,11 +167,11 @@ function newLogin() { } } - function onClick() { + function onClick () { } - function getContainer(point) { + function getContainer (point) { /* First we check if this point is inside this object UI. */ if (thisObject.container.frame.isThisPointHere(point, true) === true) { return this.container @@ -180,7 +181,7 @@ function newLogin() { } } - function draw() { + function draw () { return // nothing to show. } } From 92a4200c4ca0edf0241b53aa52af2ce56772e025 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 29 Jul 2019 11:18:42 +0200 Subject: [PATCH 16/27] BUG FIXES All working in local now --- StrategySpace/StrategizerGateway.js | 9 ++++++--- StrategySpace/Workspace/Workspace.js | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 442c335bc..414b04462 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -45,12 +45,14 @@ function newStrategizerGateway () { return } + user = JSON.parse(user) + if (window.canvasApp.executingAt === 'Local') { window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, 'Local File') thisObject.strategizerData = JSON.parse('{"type":"Definition"}') thisObject.idAtStrategizer = 'Local File' - } else { - user = JSON.parse(user) + return true + } else { let fbSlug = 'simulator-bot-' + user.alias.replace('.', '') graphQLServer = await axios({ @@ -119,7 +121,7 @@ function newStrategizerGateway () { } if (window.canvasApp.executingAt === 'Local') { - callServer(tradingSystem, 'SaveDefinition', onSaved) + callServer(JSON.stringify(tradingSystem), 'SaveDefinition', onSaved) function onSaved (err) { if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { return true @@ -128,6 +130,7 @@ function newStrategizerGateway () { return false } } + return true } else { user = JSON.parse(user) diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 143dac4a9..0c1e74d87 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -59,8 +59,8 @@ function newWorkspace () { } user = JSON.parse(user) - let idAtStrategizer = null - let savedWorkspace = null + let idAtStrategizer = window.localStorage.getItem(CANVAS_APP_NAME + '.' + 'Strategizer Gateway' + '.' + user.alias) + let savedWorkspace = window.localStorage.getItem(CANVAS_APP_NAME + '.' + 'Workspace' + '.' + user.alias) if (savedWorkspace === null || idAtStrategizer === null) { workspaceNode.type = 'Workspace' From 57f6fef84f0aa31417636ab4f7117d31f47c0fd3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 29 Jul 2019 11:50:07 +0200 Subject: [PATCH 17/27] Comment added --- StrategySpace/StrategizerGateway.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 414b04462..fa7fbfcad 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -130,7 +130,7 @@ function newStrategizerGateway () { return false } } - return true + return true // TODO: Here we will always show that the saving works even if it does not. We need to fix this at some point in time. } else { user = JSON.parse(user) From 2020087080117f2721db5b5e6dd8073ae0bf1124 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 29 Jul 2019 17:55:44 +0200 Subject: [PATCH 18/27] Better Logging --- WebDebugLog.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/WebDebugLog.js b/WebDebugLog.js index 3888b3b82..6a758304e 100644 --- a/WebDebugLog.js +++ b/WebDebugLog.js @@ -1,17 +1,21 @@ function newWebDebugLog () { - let thisObject = { - write: write, - fileName: 'undefined' - } + try { + let thisObject = { + write: write, + fileName: 'undefined' + } - return thisObject + return thisObject - function write (pText) { - console.log(spacePad(thisObject.fileName, 50) + ' : ' + pText) + function write (pText) { + console.log(spacePad(thisObject.fileName, 50) + ' : ' + pText) - function spacePad (str, max) { - str = str.toString() - return str.length < max ? spacePad(' ' + str, max) : str - } - } -} + function spacePad (str, max) { + str = str.toString() + return str.length < max ? spacePad(' ' + str, max) : str + } + } + } catch (err) { + console.log(spacePad(MODULE_NAME, 50) + ' : ' + '[ERROR] WebDebugLog --> err = ' + err.stack) + } + } From 95b4f107b43d8017f8f43a53e6fb96c062a0b599 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 29 Jul 2019 18:14:21 +0200 Subject: [PATCH 19/27] Removed dependency on Apollo and Teams Module --- Dashboard.js | 120 ++------------------------------------------------- 1 file changed, 4 insertions(+), 116 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index ccf9635d3..4811d2b5a 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -49,13 +49,12 @@ function newDashboard () { userProfileChangedEventSubscriptionId = window.canvasApp.eventHandler.listenToEvent('User Profile Changed', userProfileChanged) browserResizedEventSubscriptionId = window.canvasApp.eventHandler.listenToEvent('Browser Resized', browserResized) - loadImages(onImagesLoaded) + /* Here we used to have a call to the Teams Module to get the profile pictures. That was removed but to keep things working, we do this: */ - function onImagesLoaded () { - /* Next we start the App */ + window.canvasApp.context.teamProfileImages = new Map() + window.canvasApp.context.fbProfileImages = new Map() - setTimeout(delayedStart, DEBUG_START_UP_DELAY) - } + setTimeout(delayedStart, DEBUG_START_UP_DELAY) } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] start -> err = ' + err.stack) } } @@ -102,115 +101,4 @@ function newDashboard () { if (ERROR_LOG === true) { logger.write('[ERROR] browserResized -> err = ' + err.stack) } } } - - function loadImages (callBack) { - try { - const accessToken = '' - // Soon, we will need to get images from the Financial Beings Module. - - const networkInterfaceTeams = Apollo.lib.createNetworkInterface({ - uri: window.canvasApp.graphQL.masterAppApiUrl - }) - - networkInterfaceTeams.use([{ - applyMiddleware (req, next) { - req.options.headers = { - authorization: `Bearer ${accessToken}` - } - next() - } - }]) - - const apolloClientTeams = new Apollo.lib.ApolloClient({ - networkInterface: networkInterfaceTeams, - connectToDevTools: true - }) - - const ALL_TEAMS_QUERY = Apollo.gql` - { - teams_Teams{ - edges{ - node{ - id - name - slug - profile { - avatar - banner - description - motto - updatedAt - } - fb { - id - name - slug - avatar - kind - status { - status - reason - createdAt - } - } - } - } - } - } - ` - - let teams - - const getTeams = () => { - return new Promise((resolve, reject) => { - apolloClientTeams.query({ - query: ALL_TEAMS_QUERY - }) - .then(response => { - teams = response.data.teams_Teams - // window.localStorage.setItem('Teams', JSON.stringify(response.data.teams_Teams)) - resolve({ teams: response.data.teams_Teams }) - }) - .catch(err => { - if (ERROR_LOG === true) { logger.write('[ERROR] loadImages -> getTeams -> Error fetching data from Teams Module.') } - if (ERROR_LOG === true) { logger.write('[ERROR] loadImages -> getTeams -> err = ' + err.stack) } - reject(err) - }) - }) - } - - // To avoid race conditions, add asynchronous fetches to array - let fetchDataPromises = [] - - fetchDataPromises.push(/* getUser(), */ getTeams()) // <-- Here we must add the function calll to the Financial Beings module. - - // When all asynchronous fetches resolve, authenticate user or throw error. - Promise.all(fetchDataPromises).then(result => { - /* All good, we will go through the results creating a map with all the Images URLs */ - - let teamProfileImages = new Map() - let fbProfileImages = new Map() - - for (let i = 0; i < teams.edges.length; i++) { - let team = teams.edges[i].node - - teamProfileImages.set(team.slug, team.profile.avatar) - - if (team.fb.length > 0) { - fbProfileImages.set(team.slug + '-' + team.fb[0].slug, team.fb[0].avatar) - } - } - - window.canvasApp.context.teamProfileImages = teamProfileImages - window.canvasApp.context.fbProfileImages = fbProfileImages - - callBack() - }, err => { - if (ERROR_LOG === true) { logger.write('[ERROR] loadImages -> Error fetching data from Teams Module.') } - if (ERROR_LOG === true) { logger.write('[ERROR] loadImages -> err = ' + err.stack) } - }) - } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] loadImages -> err = ' + err.stack) } - } - } } From ac885fcc6fe936cb674a36df1685abd20a1a45fb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 29 Jul 2019 18:26:01 +0200 Subject: [PATCH 20/27] Less Splash screen --- SplashScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SplashScreen.js b/SplashScreen.js index da250bd39..a4c43f411 100644 --- a/SplashScreen.js +++ b/SplashScreen.js @@ -100,7 +100,7 @@ function newSplashScreen () { /* Second the % of Advance. */ let label = '' + Math.trunc(stepsInitializationCounter) + ' %' - stepsInitializationCounter = stepsInitializationCounter + 0.5 + stepsInitializationCounter = stepsInitializationCounter + 1.0 if (stepsInitializationCounter > 99) { splashScreenNeeded = false From c78e8b4550f12f788b51047994a2161d244a59d0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 30 Jul 2019 09:05:33 +0200 Subject: [PATCH 21/27] New icons added --- FloatingSpace/StrategyPartConstructor.js | 260 +++++++++++------------ Panels/ProductCard.js | 2 +- Spaces/StrategySpace.js | 15 +- 3 files changed, 143 insertions(+), 134 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 9115b62ae..7ae3e04b8 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -93,7 +93,7 @@ function newStrategyPartConstructor () { label: undefined, visible: false, iconPathOn: 'target', - iconPathOff: 'security', + iconPathOff: 'target-bw', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -109,7 +109,7 @@ function newStrategyPartConstructor () { label: undefined, visible: false, iconPathOn: 'compass', - iconPathOff: 'headphones', + iconPathOff: 'compass-bw', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -124,8 +124,8 @@ function newStrategyPartConstructor () { currentStatus: true, label: undefined, visible: false, - iconPathOn: 'broken-link', - iconPathOff: 'targeting', + iconPathOn: 'freeze', + iconPathOff: 'freeze-bw', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -140,8 +140,8 @@ function newStrategyPartConstructor () { currentStatus: false, label: undefined, visible: false, - iconPathOn: 'tap', - iconPathOff: 'layout', + iconPathOn: 'hide', + iconPathOff: 'hide-bw', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -154,8 +154,8 @@ function newStrategyPartConstructor () { actionFunction: floatingObject.payload.onMenuItemClick, label: undefined, visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'backup', + iconPathOff: 'backup', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -190,8 +190,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: undefined, visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -202,8 +202,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -222,7 +222,7 @@ function newStrategyPartConstructor () { label: 'Run', visible: false, iconPathOn: 'paper-plane', - iconPathOff: 'upload', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -238,8 +238,8 @@ function newStrategyPartConstructor () { workDoneLabel: 'Saved', workFailedLabel: 'Not Saved', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -254,8 +254,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete Definition', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -298,8 +298,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -318,8 +318,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete Personal Data', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -353,8 +353,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Account', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -403,8 +403,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Asset', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -443,8 +443,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Key', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -463,8 +463,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete Trading System', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -507,8 +507,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -527,8 +527,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete Parameters', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -555,8 +555,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -575,8 +575,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete Base Asset', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -604,8 +604,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -623,7 +623,7 @@ function newStrategyPartConstructor () { label: 'Add Missing Stages', visible: false, iconPathOn: 'target', - iconPathOff: 'trash', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -638,8 +638,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Strategy', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -652,8 +652,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -712,7 +712,7 @@ function newStrategyPartConstructor () { label: 'Add Missing Events', visible: false, iconPathOn: 'target', - iconPathOff: 'trash', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -725,8 +725,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Stage', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -737,8 +737,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -755,7 +755,7 @@ function newStrategyPartConstructor () { label: 'Add Initial Definition', visible: false, iconPathOn: 'target', - iconPathOff: 'trash', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -769,7 +769,7 @@ function newStrategyPartConstructor () { label: 'Add Open Execution', visible: false, iconPathOn: 'target', - iconPathOff: 'trash', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -784,8 +784,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Stage', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -798,8 +798,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -817,7 +817,7 @@ function newStrategyPartConstructor () { label: 'Add Missing Items', visible: false, iconPathOn: 'target', - iconPathOff: 'trash', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -832,8 +832,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Stage', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -846,8 +846,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -865,7 +865,7 @@ function newStrategyPartConstructor () { label: 'Add Close Execution', visible: false, iconPathOn: 'target', - iconPathOff: 'trash', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -880,8 +880,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Stage', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -894,8 +894,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -914,8 +914,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete Position Size', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -943,8 +943,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -963,8 +963,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete Position Rate', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -992,8 +992,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1027,8 +1027,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Event', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1041,8 +1041,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1076,8 +1076,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Event', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1090,8 +1090,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1125,8 +1125,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Event', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1139,8 +1139,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1158,7 +1158,7 @@ function newStrategyPartConstructor () { label: 'Add Missing Items', visible: false, iconPathOn: 'target', - iconPathOff: 'trash', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1173,8 +1173,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Definition', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1187,8 +1187,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1207,8 +1207,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1221,8 +1221,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1241,8 +1241,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1255,8 +1255,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1290,8 +1290,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Item', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1304,8 +1304,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1339,8 +1339,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Item', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1353,8 +1353,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1403,8 +1403,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Phase', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1417,8 +1417,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1457,8 +1457,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Formula', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1471,8 +1471,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1506,8 +1506,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Event', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1520,8 +1520,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1555,8 +1555,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Situation', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1569,8 +1569,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1604,8 +1604,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Condition', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1618,8 +1618,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1658,8 +1658,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Delete This Code', visible: false, - iconPathOn: 'trash', - iconPathOff: 'trash', + iconPathOn: 'delete', + iconPathOff: 'delete', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1672,8 +1672,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Share', visible: false, - iconPathOn: 'upload', - iconPathOff: 'upload', + iconPathOn: 'share', + iconPathOff: 'share', rawRadius: 8, targetRadius: 0, currentRadius: 0, diff --git a/Panels/ProductCard.js b/Panels/ProductCard.js index d25ca09d4..e66f90e3b 100644 --- a/Panels/ProductCard.js +++ b/Panels/ProductCard.js @@ -221,7 +221,7 @@ function newProductCard () { legacyBotAvatar.src = window.canvasApp.urlPrefix + 'Images/' + LEGACY_TEAM + '/' + REPO + '/' + PROFILE_PIC } else { /* - Here we will download the images of teams uploaded at the Teams Module. + Here we will download the images of teams shareed at the Teams Module. There might be Product Cards of bots beloging to teams not present currently at the Teams Module, in those cases nothing should happen. */ diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index 8d78281af..e9cfaea9e 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -61,7 +61,7 @@ function newStrategySpace () { ['Initial Definition', 'task'], ['Open Execution', 'piggy-bank'], ['Close Execution', 'piggy-bank'], - ['Stop', 'pixel'], + ['Stop', 'stop'], ['Take Profit', 'competition'], ['Phase', 'placeholder'], ['Formula', 'pipette'], @@ -91,6 +91,7 @@ function newStrategySpace () { 'chat', 'chronometer', 'compass', + 'compass-bw', 'competition', 'content', 'design-tool', @@ -122,16 +123,24 @@ function newStrategySpace () { 'support', 'tap', 'target', + 'target-bw', 'targeting', 'task', 'testing', 'text', 'timeline', 'tools', - 'trash', + 'delete', 'upload', 'vector', - 'video-player' + 'video-player', + 'freeze', + 'freeze-bw', + 'hide', + 'hide-bw', + 'backup', + 'share', + 'stop' ] for (let i = 0; i < iconsNames.length; i++) { From 578f76132b9548fe2b3546ab70fca1535f7a7a47 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 30 Jul 2019 09:21:16 +0200 Subject: [PATCH 22/27] Polishing Icon Issues --- FloatingSpace/StrategyPartConstructor.js | 124 ++++------------------- 1 file changed, 20 insertions(+), 104 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 7ae3e04b8..d22a3965d 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -190,8 +190,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: undefined, visible: false, - iconPathOn: 'share', - iconPathOff: 'share', + iconPathOn: 'backup', + iconPathOff: 'backup', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -268,8 +268,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Trading System', visible: false, - iconPathOn: 'approve', - iconPathOff: 'approve', relatedStrategyPart: 'Trading System', rawRadius: 8, targetRadius: 0, @@ -283,8 +281,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Personal Data', visible: false, - iconPathOn: 'approve', - iconPathOff: 'approve', relatedStrategyPart: 'Personal Data', rawRadius: 8, targetRadius: 0, @@ -332,8 +328,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Exchange Account', visible: false, - iconPathOn: 'approve', - iconPathOff: 'approve', relatedStrategyPart: 'Exchange Account', rawRadius: 8, targetRadius: 0, @@ -367,8 +361,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Asset', visible: false, - iconPathOn: 'paper-plane', - iconPathOff: 'paper-plane', relatedStrategyPart: 'Exchange Account Asset', rawRadius: 8, targetRadius: 0, @@ -382,8 +374,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Key', visible: false, - iconPathOn: 'login', - iconPathOff: 'login', relatedStrategyPart: 'Exchange Account Key', rawRadius: 8, targetRadius: 0, @@ -477,8 +467,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Strategy', visible: false, - iconPathOn: 'quality', - iconPathOff: 'quality', relatedStrategyPart: 'Strategy', rawRadius: 8, targetRadius: 0, @@ -492,8 +480,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Parameters', visible: false, - iconPathOn: 'quality', - iconPathOff: 'quality', relatedStrategyPart: 'Parameters', rawRadius: 8, targetRadius: 0, @@ -541,8 +527,7 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Params', visible: false, - iconPathOn: 'settings', - iconPathOff: 'settings', + relatedStrategyPart: 'Parameters', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -589,8 +574,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: false, - iconPathOn: 'pipette', - iconPathOff: 'pipette', relatedStrategyPart: 'Formula', rawRadius: 8, targetRadius: 0, @@ -622,8 +605,7 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Stages', visible: false, - iconPathOn: 'target', - iconPathOff: 'delete', + relatedStrategyPart: 'Strategy', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -663,61 +645,21 @@ function newStrategyPartConstructor () { break } case 'Trigger Stage': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Missing Events', actionFunction: payload.onMenuItemClick, label: 'Add Missing Events', visible: false, - iconPathOn: 'target', - iconPathOff: 'delete', + relatedStrategyPart: 'Trigger Stage', rawRadius: 8, targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Trigger Stage', askConfirmation: true, @@ -731,7 +673,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Share', actionFunction: payload.onMenuItemClick, @@ -743,7 +687,8 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Open Stage': { @@ -754,8 +699,7 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Initial Definition', visible: false, - iconPathOn: 'target', - iconPathOff: 'delete', + relatedStrategyPart: 'Initial Definition', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -768,8 +712,7 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Open Execution', visible: false, - iconPathOn: 'target', - iconPathOff: 'delete', + relatedStrategyPart: 'Open Execution', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -816,8 +759,7 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Items', visible: false, - iconPathOn: 'target', - iconPathOff: 'delete', + relatedStrategyPart: 'Manage Stage', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -864,8 +806,7 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Close Execution', visible: false, - iconPathOn: 'target', - iconPathOff: 'delete', + relatedStrategyPart: 'Close Execution', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -928,8 +869,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: false, - iconPathOn: 'pipette', - iconPathOff: 'pipette', relatedStrategyPart: 'Formula', rawRadius: 8, targetRadius: 0, @@ -977,8 +916,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: false, - iconPathOn: 'pipette', - iconPathOff: 'pipette', relatedStrategyPart: 'Formula', rawRadius: 8, targetRadius: 0, @@ -1010,8 +947,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: false, - iconPathOn: 'pyramid', - iconPathOff: 'pyramid', relatedStrategyPart: 'Situation', rawRadius: 8, targetRadius: 0, @@ -1059,8 +994,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: false, - iconPathOn: 'pyramid', - iconPathOff: 'pyramid', relatedStrategyPart: 'Situation', rawRadius: 8, targetRadius: 0, @@ -1108,8 +1041,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: false, - iconPathOn: 'pyramid', - iconPathOff: 'pyramid', relatedStrategyPart: 'Situation', rawRadius: 8, targetRadius: 0, @@ -1157,8 +1088,7 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Items', visible: false, - iconPathOn: 'target', - iconPathOff: 'delete', + relatedStrategyPart: 'Initial Definition', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1273,8 +1203,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Phase', visible: false, - iconPathOn: 'placeholder', - iconPathOff: 'placeholder', relatedStrategyPart: 'Phase', rawRadius: 8, targetRadius: 0, @@ -1322,8 +1250,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Phase', visible: false, - iconPathOn: 'placeholder', - iconPathOff: 'placeholder', relatedStrategyPart: 'Phase', rawRadius: 8, targetRadius: 0, @@ -1371,8 +1297,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: false, - iconPathOn: 'pipette', - iconPathOff: 'pipette', relatedStrategyPart: 'Formula', rawRadius: 8, targetRadius: 0, @@ -1386,8 +1310,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Next Phase Event', visible: false, - iconPathOn: 'pipette', - iconPathOff: 'pipette', relatedStrategyPart: 'Next Phase Event', rawRadius: 8, targetRadius: 0, @@ -1489,8 +1411,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: false, - iconPathOn: 'pyramid', - iconPathOff: 'pyramid', relatedStrategyPart: 'Situation', rawRadius: 8, targetRadius: 0, @@ -1538,8 +1458,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Condition', visible: false, - iconPathOn: 'testing', - iconPathOff: 'testing', relatedStrategyPart: 'Condition', rawRadius: 8, targetRadius: 0, @@ -1587,8 +1505,6 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Code', visible: false, - iconPathOn: 'html', - iconPathOff: 'html', relatedStrategyPart: 'Code', rawRadius: 8, targetRadius: 0, From 88977ddfbb4f580c420b3c57ad6ed5e081076cf4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 30 Jul 2019 21:47:15 +0200 Subject: [PATCH 23/27] Icon repared --- FloatingSpace/StrategyPartConstructor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index d22a3965d..1d237c102 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -238,8 +238,8 @@ function newStrategyPartConstructor () { workDoneLabel: 'Saved', workFailedLabel: 'Not Saved', visible: false, - iconPathOn: 'share', - iconPathOff: 'share', + iconPathOn: 'backup', + iconPathOff: 'backup', rawRadius: 8, targetRadius: 0, currentRadius: 0, From be8cefc117ddb73b089fecc9ef04a36f50f91f3e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 30 Jul 2019 22:11:29 +0200 Subject: [PATCH 24/27] trading system for definition --- CockpitSpace/RestartSimulation.js | 2 +- FloatingSpace/StrategyPart.js | 8 ++++---- FloatingSpace/StrategyPartConstructor.js | 2 +- StrategySpace/Workspace/Workspace.js | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CockpitSpace/RestartSimulation.js b/CockpitSpace/RestartSimulation.js index 927f82c75..15fbf7fa8 100644 --- a/CockpitSpace/RestartSimulation.js +++ b/CockpitSpace/RestartSimulation.js @@ -196,7 +196,7 @@ function newRestartSimulation () { } function executionFocusPhysics () { - if (canvas.strategySpace.workspace.tradingSystem !== undefined) { + if (canvas.strategySpace.workspace.definition !== undefined) { executionFocusExists = true } else { executionFocusExists = false diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index ba474fdd6..e8653f1ad 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -481,8 +481,8 @@ function newStrategyPart () { } function runningPhisycs () { - if (canvas.strategySpace.workspace.tradingSystem !== undefined) { - if (canvas.strategySpace.workspace.tradingSystem.id !== thisObject.payload.node.id) { + if (canvas.strategySpace.workspace.definition !== undefined) { + if (canvas.strategySpace.workspace.definition.id !== thisObject.payload.node.id) { runningCounter-- } } @@ -499,13 +499,13 @@ function newStrategyPart () { } function setRunningStatus () { - canvas.strategySpace.workspace.tradingSystem = thisObject.payload.node + canvas.strategySpace.workspace.definition = thisObject.payload.node thisObject.isRunning = true runningCounter = 30 } function setNotRunningStatus () { - canvas.strategySpace.workspace.tradingSystem = undefined + canvas.strategySpace.workspace.definition = undefined thisObject.isRunning = false } diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 1d237c102..a8bef3871 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -70,7 +70,7 @@ function newStrategyPartConstructor () { if (payload.node.savedPayload !== undefined) { if (payload.node.savedPayload.uiObject.isRunning === true) { strategyPart.setRunningStatus() - canvas.strategySpace.workspace.tradingSystem = payload.node + canvas.strategySpace.workspace.definition = payload.node } } diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 0c1e74d87..d850e3093 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -47,7 +47,7 @@ function newWorkspace () { return thisObject function finalize () { - thisObject.tradingSystem = undefined + thisObject.definition = undefined thisObject.container.finalize() thisObject.container = undefined } @@ -82,16 +82,16 @@ function newWorkspace () { async function initializeLoadingFromStrategizer () { let result = await canvas.strategySpace.strategizerGateway.loadFromStrategyzer() if (result === true) { - thisObject.tradingSystem = canvas.strategySpace.strategizerGateway.strategizerData - workspaceNode.rootNodes.push(thisObject.tradingSystem) - functionLibraryPartsFromNodes.createPartFromNode(thisObject.tradingSystem, undefined, undefined) - thisObject.tradingSystem.payload.uiObject.setRunningStatus() + thisObject.definition = canvas.strategySpace.strategizerGateway.strategizerData + workspaceNode.rootNodes.push(thisObject.definition) + functionLibraryPartsFromNodes.createPartFromNode(thisObject.definition, undefined, undefined) + thisObject.definition.payload.uiObject.setRunningStatus() thisObject.enabled = true } } function getProtocolTradingSystem () { - return functionLibraryProtocolNode.getProtocolNode(thisObject.tradingSystem) + return functionLibraryProtocolNode.getProtocolNode(thisObject.definition) } function detachNode (node) { From 4d2ca4aded933cacba99fbf50b5592f14934bcee Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 31 Jul 2019 14:00:38 +0200 Subject: [PATCH 25/27] Icons Improved --- FloatingSpace/StrategyPartConstructor.js | 20 ++++++++++---------- Spaces/StrategySpace.js | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index a8bef3871..f3344f342 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -124,8 +124,8 @@ function newStrategyPartConstructor () { currentStatus: true, label: undefined, visible: false, - iconPathOn: 'freeze', - iconPathOff: 'freeze-bw', + iconPathOn: 'menu-mobility-unfreeze', + iconPathOff: 'menu-mobility-freeze', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -140,8 +140,8 @@ function newStrategyPartConstructor () { currentStatus: false, label: undefined, visible: false, - iconPathOn: 'hide', - iconPathOff: 'hide-bw', + iconPathOn: 'menu-tree-minus', + iconPathOff: 'menu-tree-plus', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -154,8 +154,8 @@ function newStrategyPartConstructor () { actionFunction: floatingObject.payload.onMenuItemClick, label: undefined, visible: false, - iconPathOn: 'backup', - iconPathOff: 'backup', + iconPathOn: 'menu-backup', + iconPathOff: 'menu-backup', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -190,8 +190,8 @@ function newStrategyPartConstructor () { actionFunction: payload.onMenuItemClick, label: undefined, visible: false, - iconPathOn: 'backup', - iconPathOff: 'backup', + iconPathOn: 'menu-backup', + iconPathOff: 'menu-backup', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -238,8 +238,8 @@ function newStrategyPartConstructor () { workDoneLabel: 'Saved', workFailedLabel: 'Not Saved', visible: false, - iconPathOn: 'backup', - iconPathOff: 'backup', + iconPathOn: 'menu-backup', + iconPathOff: 'menu-backup', rawRadius: 8, targetRadius: 0, currentRadius: 0, diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index e9cfaea9e..cf89416c2 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -134,11 +134,11 @@ function newStrategySpace () { 'upload', 'vector', 'video-player', - 'freeze', - 'freeze-bw', - 'hide', - 'hide-bw', - 'backup', + 'menu-mobility-freeze', + 'menu-mobility-unfreeze', + 'menu-tree-minus', + 'menu-tree-plus', + 'menu-backup', 'share', 'stop' ] From 061e83757f3c50e1e49ac856e42e4a6039d80943 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 31 Jul 2019 14:11:33 +0200 Subject: [PATCH 26/27] More Icons Upgraded --- FloatingSpace/StrategyPartConstructor.js | 12 ++++++------ Spaces/StrategySpace.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index f3344f342..92288655f 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -92,8 +92,8 @@ function newStrategyPartConstructor () { currentStatus: false, label: undefined, visible: false, - iconPathOn: 'target', - iconPathOff: 'target-bw', + iconPathOn: 'menu-fix-pinned', + iconPathOff: 'menu-fix-unpinned', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -140,8 +140,8 @@ function newStrategyPartConstructor () { currentStatus: false, label: undefined, visible: false, - iconPathOn: 'menu-tree-minus', - iconPathOff: 'menu-tree-plus', + iconPathOn: 'menu-tree-plus', + iconPathOff: 'menu-tree-minus', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -178,8 +178,8 @@ function newStrategyPartConstructor () { currentStatus: true, label: undefined, visible: false, - iconPathOn: 'target', - iconPathOff: 'security', + iconPathOn: 'menu-fix-unpinned', + iconPathOff: 'menu-fix-pinned', rawRadius: 8, targetRadius: 0, currentRadius: 0, diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index cf89416c2..be9841d19 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -122,8 +122,8 @@ function newStrategySpace () { 'startup', 'support', 'tap', - 'target', - 'target-bw', + 'menu-fix-pinned', + 'menu-fix-unpinned', 'targeting', 'task', 'testing', From aca66390a6b31dec3d96e571a5f9ffffeaafedfe Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 31 Jul 2019 14:23:13 +0200 Subject: [PATCH 27/27] More Icons --- Spaces/StrategySpace.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index be9841d19..c7650827d 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -50,9 +50,9 @@ function newStrategySpace () { ['Base Asset', 'sitemap'], ['Strategy', 'quality'], ['Trigger Stage', 'chronometer'], - ['Open Stage', 'photo-camera'], + ['Open Stage', 'stage-open'], ['Manage Stage', 'video-player'], - ['Close Stage', 'timeline'], + ['Close Stage', 'stage-close'], ['Position Size', 'responsive'], ['Position Rate', 'promotion'], ['Trigger On Event', 'startup'], @@ -140,7 +140,9 @@ function newStrategySpace () { 'menu-tree-plus', 'menu-backup', 'share', - 'stop' + 'stop', + 'stage-open', + 'stage-close' ] for (let i = 0; i < iconsNames.length; i++) {