Open Execution AND Close Execution objects implemented

This commit is contained in:
Luis Fernando Molina committed 2019-07-16 19:36:16 +02:00
1 parent 4ab1dfefd7
commit 02c471c44b
11 files changed
+285 -7

No files matched your search

+10 -1
View File
@@ -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 () {
}
}
}
+109 -5
View File
@@ -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
+6
View File
@@ -96,6 +96,12 @@ function newStrategyPartTitle () {
case 'Initial Definition': {
break
}
case 'Open Execution': {
break
}
case 'Close Execution': {
break
}
case 'Stop': {
break
}
+2
View File
@@ -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'],
@@ -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
@@ -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,
@@ -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) {
@@ -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)
}
}
@@ -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,
@@ -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,
+10
View File
@@ -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)