AddMissingStages Implemented
This commit is contained in:
1 parent
66a44f2c77
commit
f8e0e96c02
3 files changed
+134
-8
No files matched your search
@@ -160,6 +160,18 @@ function newStrategyPartConstructor () {
|
||||
currentRadius: 0,
|
||||
angle: -135
|
||||
},
|
||||
{
|
||||
action: 'Add Missing Stages',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Missing Stages',
|
||||
visible: false,
|
||||
iconPathOn: 'target',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -40
|
||||
},
|
||||
{
|
||||
action: 'Delete Strategy',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
@@ -170,7 +182,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
angle: 0
|
||||
},
|
||||
{
|
||||
action: 'Download',
|
||||
@@ -182,7 +194,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}]
|
||||
break
|
||||
}
|
||||
@@ -202,6 +214,18 @@ function newStrategyPartConstructor () {
|
||||
currentRadius: 0,
|
||||
angle: -135
|
||||
},
|
||||
{
|
||||
action: 'Add Missing Events',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Missing Events',
|
||||
visible: false,
|
||||
iconPathOn: 'target',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -40
|
||||
},
|
||||
{
|
||||
action: 'Delete Trigger Stage',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
@@ -212,7 +236,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
angle: 0
|
||||
},
|
||||
{
|
||||
action: 'Download',
|
||||
@@ -224,7 +248,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}]
|
||||
break
|
||||
}
|
||||
@@ -244,6 +268,18 @@ function newStrategyPartConstructor () {
|
||||
currentRadius: 0,
|
||||
angle: -135
|
||||
},
|
||||
{
|
||||
action: 'Add Initial Definition',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Initial Definition',
|
||||
visible: false,
|
||||
iconPathOn: 'target',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -40
|
||||
},
|
||||
{
|
||||
action: 'Delete Open Stage',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
@@ -254,7 +290,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
angle: 0
|
||||
},
|
||||
{
|
||||
action: 'Download',
|
||||
@@ -266,7 +302,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}]
|
||||
break
|
||||
}
|
||||
@@ -286,6 +322,18 @@ function newStrategyPartConstructor () {
|
||||
currentRadius: 0,
|
||||
angle: -135
|
||||
},
|
||||
{
|
||||
action: 'Add Missing Items',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Missing Items',
|
||||
visible: false,
|
||||
iconPathOn: 'target',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -40
|
||||
},
|
||||
{
|
||||
action: 'Delete Manage Stage',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
@@ -296,7 +344,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
angle: 0
|
||||
},
|
||||
{
|
||||
action: 'Download',
|
||||
@@ -308,7 +356,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}]
|
||||
break
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ function newPartsFromNodes () {
|
||||
thisObject = {
|
||||
createPartFromNode: createPartFromNode,
|
||||
newStrategy: newStrategy,
|
||||
addMissingStages: addMissingStages,
|
||||
addMissingEvents: addMissingEvents,
|
||||
addPhase: addPhase,
|
||||
addSituation: addSituation,
|
||||
addCondition: addCondition
|
||||
@@ -215,6 +217,62 @@ function newPartsFromNodes () {
|
||||
createPart('Take Profit', '', strategy.manageStage.buyOrder, strategy.manageStage, strategy.manageStage)
|
||||
}
|
||||
|
||||
function addMissingStages (node) {
|
||||
if (node.triggerStage === undefined) {
|
||||
node.triggerStage = {
|
||||
entryPoint: {
|
||||
situations: []
|
||||
},
|
||||
exitPoint: {
|
||||
situations: []
|
||||
},
|
||||
sellPoint: {
|
||||
situations: []
|
||||
}
|
||||
}
|
||||
createPart('Trigger Stage', '', node.triggerStage, node, node, 'Trigger Stage')
|
||||
createPart('Trigger On Event', '', node.triggerStage.entryPoint, node.triggerStage, node.triggerStage)
|
||||
createPart('Trigger Off Event', '', node.triggerStage.exitPoint, node.triggerStage, node.triggerStage)
|
||||
createPart('Take Position Event', '', node.triggerStage.sellPoint, node.triggerStage, node.triggerStage)
|
||||
}
|
||||
if (node.openStage === undefined) {
|
||||
node.openStage = {
|
||||
initialDefinition: {
|
||||
}
|
||||
}
|
||||
createPart('Open Stage', '', node.openStage, node, node, 'Open Stage')
|
||||
createPart('Initial Definition', '', node.openStage.initialDefinition, node.openStage, node.openStage)
|
||||
}
|
||||
if (node.manageStage === undefined) {
|
||||
node.manageStage = {
|
||||
stopLoss: {
|
||||
phases: []
|
||||
},
|
||||
buyOrder: {
|
||||
phases: []
|
||||
}
|
||||
}
|
||||
createPart('Manage Stage', '', node.manageStage, node, node, 'Manage Stage')
|
||||
createPart('Stop', '', node.manageStage.stopLoss, node.manageStage, node.manageStage)
|
||||
createPart('Take Profit', '', node.manageStage.buyOrder, node.manageStage, node.manageStage)
|
||||
}
|
||||
if (node.triggerStage === undefined) {
|
||||
createPart('Close Stage', '', node.closeStage, node, node, 'Close Stage')
|
||||
}
|
||||
}
|
||||
|
||||
function addMissingEvents () {
|
||||
if (node.entryPoint === undefined) {
|
||||
node.entryPoint = {
|
||||
situations: []
|
||||
}
|
||||
createPart('Trigger On Event', '', node.entryPoint, node, node)
|
||||
}
|
||||
|
||||
createPart('Trigger Off Event', '', node.triggerStage.exitPoint, node.triggerStage, node.triggerStage)
|
||||
createPart('Take Position Event', '', node.triggerStage.sellPoint, node.triggerStage, node.triggerStage)
|
||||
}
|
||||
|
||||
function addPhase (parentNode) {
|
||||
let phaseParent = parentNode
|
||||
let m = phaseParent.phases.length
|
||||
|
||||
@@ -159,6 +159,26 @@ function newWorkspace () {
|
||||
functionLibraryPartsFromNodes.newStrategy(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Missing Stages':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addMissingStages(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Missing Events':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addMissingEvents(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Missing Items':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addMissingItems(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Initial Definition':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addInitialDefinition(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Phase':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addPhase(payload.node)
|
||||
|
||||
Reference in new issue
Block a user