Trading System can be deleted

This commit is contained in:
Luis Fernando Molina committed 2019-05-28 10:45:44 +02:00
1 parent d7bed2430b
commit 8b741aeddc
4 files changed
+43 -6

No files matched your search

+8 -2
View File
@@ -20,6 +20,7 @@ function newStrategyPart () {
isRunning: undefined,
run: run,
setRunningStatus: setRunningStatus,
setNotRunningStatus: setNotRunningStatus,
getReadyToAttach: getReadyToAttach,
showAvailabilityToAttach: showAvailabilityToAttach,
highlight: highlight,
@@ -378,16 +379,21 @@ function newStrategyPart () {
}
function run () {
canvas.strategySpace.workspace.tradingSystem = thisObject.payload.node
canvas.cockpitSpace.restartSimulation.restart()
setRunningStatus()
canvas.cockpitSpace.restartSimulation.restart()
}
function setRunningStatus () {
canvas.strategySpace.workspace.tradingSystem = thisObject.payload.node
thisObject.isRunning = true
runningCounter = 30
}
function setNotRunningStatus () {
canvas.strategySpace.workspace.tradingSystem = undefined
thisObject.isRunning = false
}
function iconPhysics () {
icon = canvas.strategySpace.iconByPartType.get(thisObject.payload.node.type)
executingIcon = canvas.strategySpace.iconCollection.get('attractive')
+16 -4
View File
@@ -100,7 +100,7 @@ function newStrategyPartConstructor () {
rawRadius: 8,
targetRadius: 0,
currentRadius: 0,
angle: -60
angle: -80
},
{
action: 'Save Trading System',
@@ -115,7 +115,19 @@ function newStrategyPartConstructor () {
rawRadius: 8,
targetRadius: 0,
currentRadius: 0,
angle: -20
angle: -40
},
{
action: 'Delete Trading System',
actionFunction: payload.onMenuItemClick,
label: 'Delete Trading System',
visible: false,
iconPathOn: 'trash',
iconPathOff: 'trash',
rawRadius: 8,
targetRadius: 0,
currentRadius: 0,
angle: 0
},
{
action: 'New Strategy',
@@ -128,7 +140,7 @@ function newStrategyPartConstructor () {
rawRadius: 8,
targetRadius: 0,
currentRadius: 0,
angle: 20
angle: 40
},
{
action: 'Download',
@@ -140,7 +152,7 @@ function newStrategyPartConstructor () {
rawRadius: 8,
targetRadius: 0,
currentRadius: 0,
angle: 60
angle: 80
}]
break
}
@@ -1,5 +1,6 @@
function newNodeDeleter () {
thisObject = {
deleteTradingSystem: deleteTradingSystem,
deleteStrategy: deleteStrategy,
deleteTriggerStage: deleteTriggerStage,
deleteOpenStage: deleteOpenStage,
@@ -21,6 +22,20 @@ function newNodeDeleter () {
canvas.floatingSpace.strategyPartConstructor.destroyStrategyPart(node.payload)
}
function deleteTradingSystem (node, rootNodes) {
if (node.payload.uiObject.isRunning === true) {
strategyPart.setNotRunningStatus()
}
while (node.strategies.length > 0) {
deleteStrategy(node.strategies[0])
}
completeDeletion(node, rootNodes)
destroyPart(node)
cleanNode(node)
}
function deleteStrategy (node, rootNodes) {
let payload = node.payload
if (payload.parentNode !== undefined) {
+4
View File
@@ -204,6 +204,10 @@ function newWorkspace () {
functionLibraryPartsFromNodes.addCode(payload.node)
}
break
case 'Delete Trading System': {
functionLibraryNodeDeleter.deleteTradingSystem(payload.node, rootNodes)
break
}
case 'Delete Strategy': {
functionLibraryNodeDeleter.deleteStrategy(payload.node, rootNodes)
break