21 files changed
+3088
-923
No files matched your search
@@ -69,6 +69,8 @@ function newCanvas () {
|
||||
browserCanvas.removeEventListener('dragleave', onDragLeave, false)
|
||||
browserCanvas.removeEventListener('dragover', onDragOver, false)
|
||||
browserCanvas.removeEventListener('drop', onDragDrop, false)
|
||||
|
||||
browserCanvas.removeEventListener('keydown', onKeyDown, false)
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack) }
|
||||
}
|
||||
@@ -151,6 +153,11 @@ function newCanvas () {
|
||||
|
||||
function addCanvasEvents () {
|
||||
try {
|
||||
/* Keyboard events */
|
||||
window.addEventListener('keydown', onKeyDown, true)
|
||||
|
||||
/* Mouse Events */
|
||||
|
||||
browserCanvas.addEventListener('mousedown', onMouseDown, false)
|
||||
browserCanvas.addEventListener('mouseup', onMouseUp, false)
|
||||
browserCanvas.addEventListener('mousemove', onMouseMove, false)
|
||||
@@ -178,6 +185,118 @@ function newCanvas () {
|
||||
}
|
||||
}
|
||||
|
||||
function onKeyDown (event) {
|
||||
let nodeOnFocus = canvas.strategySpace.workspace.getNodeThatIsOnFocus()
|
||||
if (nodeOnFocus !== undefined) {
|
||||
if (nodeOnFocus.payload.uiObject.codeEditor !== undefined) {
|
||||
if (nodeOnFocus.payload.uiObject.codeEditor.visible === true) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (nodeOnFocus.payload.uiObject.partTitle !== undefined) {
|
||||
if (nodeOnFocus.payload.uiObject.partTitle.editMode === true) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.altKey === true && event.code === 'ArrowUp') {
|
||||
thisObject.cockpitSpace.toTop()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.altKey === true && event.code === 'ArrowDown') {
|
||||
thisObject.cockpitSpace.toBottom()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && event.code === 'ArrowLeft') {
|
||||
canvas.chartSpace.oneScreenLeft()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && event.code === 'ArrowRight') {
|
||||
canvas.chartSpace.oneScreenRight()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && event.code === 'ArrowUp') {
|
||||
canvas.chartSpace.oneScreenUp()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && event.code === 'ArrowDown') {
|
||||
canvas.chartSpace.oneScreenDown()
|
||||
return
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowLeft') {
|
||||
canvas.floatingSpace.oneScreenLeft()
|
||||
return
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowRight') {
|
||||
canvas.floatingSpace.oneScreenRight()
|
||||
return
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowUp') {
|
||||
canvas.floatingSpace.oneScreenUp()
|
||||
return
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowDown') {
|
||||
canvas.floatingSpace.oneScreenDown()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.code === 'Period') {
|
||||
if (nodeOnFocus !== undefined) {
|
||||
nodeOnFocus.payload.uiObject.setValue('Id: ' + nodeOnFocus.id)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true)) {
|
||||
if (event.keyCode >= 65 && event.keyCode <= 90) {
|
||||
/* From here we prevent the default behaviour */
|
||||
event.preventDefault()
|
||||
|
||||
let nodeUsingThisKey = canvas.strategySpace.workspace.getNodeByShortcutKey(event.key)
|
||||
|
||||
if (nodeOnFocus === undefined && nodeUsingThisKey !== undefined) {
|
||||
/* Then we displace the whole workspace to center it at the node using this key */
|
||||
nodeUsingThisKey = canvas.floatingSpace.positionAtNode(nodeUsingThisKey)
|
||||
return
|
||||
}
|
||||
|
||||
/* If there is a node in focus, we try to assign the key to it. */
|
||||
if (nodeUsingThisKey !== undefined && nodeOnFocus !== undefined) {
|
||||
if (nodeUsingThisKey.id === nodeOnFocus.id) {
|
||||
nodeOnFocus.payload.uiObject.shortcutKey = ''
|
||||
nodeOnFocus.payload.uiObject.setValue('Shortcut Key Removed ')
|
||||
return
|
||||
} else {
|
||||
nodeOnFocus.payload.uiObject.setErrorMessage('Key already in use by ' + nodeUsingThisKey.type + ' ' + nodeUsingThisKey.name)
|
||||
return
|
||||
}
|
||||
}
|
||||
/* If there is not node using this key and a node in focus, we assign this key to this node */
|
||||
if (nodeUsingThisKey === undefined && nodeOnFocus !== undefined) {
|
||||
nodeOnFocus.payload.uiObject.shortcutKey = event.key
|
||||
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + ' + event.key)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (event.ctrlKey === true && nodeOnFocus !== undefined) {
|
||||
if (nodeOnFocus.payload.uiObject.shortcutKey !== undefined && nodeOnFocus.payload.uiObject.shortcutKey !== '') {
|
||||
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + ' + nodeOnFocus.payload.uiObject.shortcutKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onDragEnter (event) {
|
||||
try {
|
||||
event.preventDefault()
|
||||
@@ -709,4 +828,3 @@ function newCanvas () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ function newPlottersManager () {
|
||||
panelCodeName: panelConfig.codeName
|
||||
}
|
||||
let panelOwner = exchange + ' ' + market.assetB + '/' + market.assetA
|
||||
let plotterPanelHandle = canvas.panelsSpace.createNewPanel('Plotter Panel', parameters, panelOwner)
|
||||
let plotterPanelHandle = canvas.panelsSpace.createNewPanel('Plotter Panel', parameters, panelOwner, pProductCard.session)
|
||||
let plotterPanel = canvas.panelsSpace.getPanel(plotterPanelHandle, panelOwner)
|
||||
/* Connect Panel to the Plotter via an Event. */
|
||||
if (panelConfig.event !== undefined) {
|
||||
|
||||
@@ -149,14 +149,15 @@ function newViewPort () {
|
||||
}
|
||||
}
|
||||
|
||||
function displace (displaceVector) {
|
||||
function displace (displaceVector, recalculate) {
|
||||
offset.x = offset.x + displaceVector.x
|
||||
offset.y = offset.y + displaceVector.y
|
||||
|
||||
saveObjectState()
|
||||
|
||||
let event = {
|
||||
newOffset: offset
|
||||
newOffset: offset,
|
||||
recalculate: recalculate
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Offset Changed', event)
|
||||
|
||||
@@ -19,6 +19,7 @@ function newStrategyPart () {
|
||||
circularProgressBar: undefined,
|
||||
isExecuting: undefined,
|
||||
isRunning: undefined,
|
||||
shortcutKey: undefined,
|
||||
run: run,
|
||||
stop: stop,
|
||||
getReadyToAttach: getReadyToAttach,
|
||||
@@ -223,7 +224,7 @@ function newStrategyPart () {
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Exchange Account Key':
|
||||
compatibleType = '->' + 'Exchange Account' + '->'
|
||||
compatibleType = '->' + 'Exchange Account' + '->' + 'Parameters' + '->'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Parameters':
|
||||
@@ -274,6 +275,18 @@ function newStrategyPart () {
|
||||
compatibleType = '->' + 'Layer Manager' + '->'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Social Bots':
|
||||
compatibleType = '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Telegram Bot':
|
||||
compatibleType = '->' + 'Social Bots' + '->'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Announcement':
|
||||
compatibleType = '->' + 'Telegram Bot' + '->' + 'Trigger On Event' + '->' + 'Trigger Off Event' + '->' + 'Take Position Event' + '->' + 'Next Phase Event' + '->' + '->' + 'Phase' + '->'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Task Manager':
|
||||
compatibleType = '->' + 'Network Node' + '->'
|
||||
compatibleSubType = undefined
|
||||
@@ -376,7 +389,7 @@ function newStrategyPart () {
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Formula':
|
||||
compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->'
|
||||
compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->' + 'Announcement' + '->'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Next Phase Event':
|
||||
|
||||
@@ -69,6 +69,11 @@ function newStrategyPartConstructor () {
|
||||
|
||||
setFloatingObjectBasicProperties(floatingObject, payload)
|
||||
|
||||
if (payload.node.savedPayload !== undefined) {
|
||||
if (payload.node.savedPayload.uiObject !== undefined) {
|
||||
payload.uiObject.shortcutKey = payload.node.savedPayload.uiObject.shortcutKey
|
||||
}
|
||||
}
|
||||
payload.node.savedPayload = undefined
|
||||
|
||||
floatingLayer.addFloatingObject(floatingObject)
|
||||
@@ -384,6 +389,186 @@ function newStrategyPartConstructor () {
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Social Bots': {
|
||||
addLeftIcons(menuItemsInitialValues, floatingObject)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Telegram Bot',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Telegram Bot',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Telegram Bot',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Social Bots',
|
||||
askConfirmation: true,
|
||||
confirmationLabel: 'Confirm to Delete',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Delete Social Bots',
|
||||
visible: true,
|
||||
iconPathOn: 'delete',
|
||||
iconPathOff: 'delete',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 0
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Share',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Share',
|
||||
visible: true,
|
||||
iconPathOn: 'menu-share',
|
||||
iconPathOff: 'menu-share',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 40
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
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: 'Add Announcement',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Announcement',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Announcement',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -60
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Edit Telegram Bot',
|
||||
actionFunction: strategyPart.codeEditor.activate,
|
||||
label: 'Edit Telegram Bot',
|
||||
visible: true,
|
||||
iconPathOn: 'html',
|
||||
iconPathOff: 'html',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20,
|
||||
dontShowAtFullscreen: true
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Social Bot',
|
||||
askConfirmation: true,
|
||||
confirmationLabel: 'Confirm to Delete',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Delete Telegram Bot',
|
||||
visible: true,
|
||||
iconPathOn: 'delete',
|
||||
iconPathOff: 'delete',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Share',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Share',
|
||||
visible: true,
|
||||
iconPathOn: 'menu-share',
|
||||
iconPathOff: 'menu-share',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 60
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Announcement': {
|
||||
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: 'Add Formula',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Formula',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Formula',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -60
|
||||
}
|
||||
)
|
||||
addLeftIcons(menuItemsInitialValues, floatingObject)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Edit Announcement',
|
||||
actionFunction: strategyPart.codeEditor.activate,
|
||||
label: 'Edit Announcement',
|
||||
visible: true,
|
||||
iconPathOn: 'html',
|
||||
iconPathOff: 'html',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20,
|
||||
dontShowAtFullscreen: true
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Announcement',
|
||||
askConfirmation: true,
|
||||
confirmationLabel: 'Confirm to Delete',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Delete Announcement',
|
||||
visible: true,
|
||||
iconPathOn: 'delete',
|
||||
iconPathOff: 'delete',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Share',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Share',
|
||||
visible: true,
|
||||
iconPathOn: 'menu-share',
|
||||
iconPathOff: 'menu-share',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 60
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
addLeftIcons(menuItemsInitialValues, floatingObject)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -581,7 +766,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -65
|
||||
angle: -75
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -594,7 +779,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -30
|
||||
angle: -35
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -607,7 +792,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -10
|
||||
angle: -12
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -620,7 +805,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 10
|
||||
angle: 12
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -636,7 +821,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: +30
|
||||
angle: +35
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -650,7 +835,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 65
|
||||
angle: 75
|
||||
}
|
||||
)
|
||||
break
|
||||
@@ -1017,6 +1202,11 @@ function newStrategyPartConstructor () {
|
||||
break
|
||||
}
|
||||
case 'Backtesting Session': {
|
||||
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(
|
||||
{
|
||||
@@ -1038,7 +1228,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -60
|
||||
angle: -75
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1051,7 +1241,48 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Parameters',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Parameters',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Parameters',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Social Bots',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Social Bots',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Social Bots',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 0
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Edit Session',
|
||||
actionFunction: strategyPart.codeEditor.activate,
|
||||
label: 'Edit Session',
|
||||
visible: true,
|
||||
iconPathOn: 'html',
|
||||
iconPathOff: 'html',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20,
|
||||
dontShowAtFullscreen: true
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1067,7 +1298,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1081,12 +1312,17 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 60
|
||||
angle: 75
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Live Trading Session': {
|
||||
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(
|
||||
{
|
||||
@@ -1108,7 +1344,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -60
|
||||
angle: -75
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1121,9 +1357,50 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
angle: -40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Parameters',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Parameters',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Parameters',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Social Bots',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Social Bots',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Social Bots',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 0
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Edit Session',
|
||||
actionFunction: strategyPart.codeEditor.activate,
|
||||
label: 'Edit Session',
|
||||
visible: true,
|
||||
iconPathOn: 'html',
|
||||
iconPathOff: 'html',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20,
|
||||
dontShowAtFullscreen: true
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Live Trading Session',
|
||||
@@ -1137,7 +1414,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1151,12 +1428,17 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 60
|
||||
angle: 75
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Fordward Testing Session': {
|
||||
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(
|
||||
{
|
||||
@@ -1178,7 +1460,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -60
|
||||
angle: -75
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1191,9 +1473,50 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
angle: -40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Parameters',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Parameters',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Parameters',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Social Bots',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Social Bots',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Social Bots',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 0
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Edit Session',
|
||||
actionFunction: strategyPart.codeEditor.activate,
|
||||
label: 'Edit Session',
|
||||
visible: true,
|
||||
iconPathOn: 'html',
|
||||
iconPathOff: 'html',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20,
|
||||
dontShowAtFullscreen: true
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Fordward Testing Session',
|
||||
@@ -1207,7 +1530,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1221,12 +1544,17 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 60
|
||||
angle: 75
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Paper Trading Session': {
|
||||
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(
|
||||
{
|
||||
@@ -1248,7 +1576,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -60
|
||||
angle: -75
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1261,9 +1589,50 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
angle: -40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Parameters',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Parameters',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Parameters',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Social Bots',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Social Bots',
|
||||
visible: true,
|
||||
relatedStrategyPart: 'Social Bots',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 0
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Edit Session',
|
||||
actionFunction: strategyPart.codeEditor.activate,
|
||||
label: 'Edit Session',
|
||||
visible: true,
|
||||
iconPathOn: 'html',
|
||||
iconPathOff: 'html',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20,
|
||||
dontShowAtFullscreen: true
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Paper Trading Session',
|
||||
@@ -1277,7 +1646,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
angle: 40
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
@@ -1291,7 +1660,7 @@ function newStrategyPartConstructor () {
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 60
|
||||
angle: 75
|
||||
}
|
||||
)
|
||||
break
|
||||
@@ -2837,6 +3206,18 @@ function newStrategyPartConstructor () {
|
||||
level_1()
|
||||
break
|
||||
}
|
||||
case 'Social Bots': {
|
||||
level_3()
|
||||
break
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Announcement': {
|
||||
level_4()
|
||||
break
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
level_3()
|
||||
break
|
||||
@@ -2870,19 +3251,19 @@ function newStrategyPartConstructor () {
|
||||
break
|
||||
}
|
||||
case 'Backtesting Session': {
|
||||
level_4()
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Live Trading Session': {
|
||||
level_4()
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Fordward Testing Session': {
|
||||
level_4()
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Paper Trading Session': {
|
||||
level_4()
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
|
||||
@@ -59,6 +59,16 @@ function newStrategyPartTitle () {
|
||||
case 'Network Node': {
|
||||
break
|
||||
}
|
||||
case 'Social Bots': {
|
||||
break
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
break
|
||||
}
|
||||
case 'Announcement': {
|
||||
thisObject.allwaysVisible = true
|
||||
break
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -648,8 +648,8 @@ function newProductCard () {
|
||||
label = thisObject.product.displayName
|
||||
|
||||
if (thisObject.session !== undefined) {
|
||||
const MAX_LABEL_LENGTH = 30
|
||||
if (thisObject.session.name > MAX_LABEL_LENGTH) {
|
||||
const MAX_LABEL_LENGTH = 20
|
||||
if (thisObject.session.name.length > MAX_LABEL_LENGTH) {
|
||||
label = thisObject.session.name.substring(0, MAX_LABEL_LENGTH) + '...' + ' - ' + label
|
||||
} else {
|
||||
label = thisObject.session.name + ' - ' + label
|
||||
|
||||
@@ -16,6 +16,10 @@ function newChartSpace () {
|
||||
visible: true,
|
||||
container: undefined,
|
||||
timeMachines: [],
|
||||
oneScreenUp: oneScreenUp,
|
||||
oneScreenDown: oneScreenDown,
|
||||
oneScreenLeft: oneScreenLeft,
|
||||
oneScreenRight: oneScreenRight,
|
||||
fitIntoVisibleArea: fitIntoVisibleArea,
|
||||
isThisPointVisible: isThisPointVisible,
|
||||
physics: physics,
|
||||
@@ -34,6 +38,7 @@ function newChartSpace () {
|
||||
|
||||
let canvasBrowserResizedEventSubscriptionId
|
||||
|
||||
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
@@ -112,6 +117,42 @@ function newChartSpace () {
|
||||
thisObject.container.frame.height = COCKPIT_SPACE_POSITION
|
||||
}
|
||||
|
||||
function oneScreenUp () {
|
||||
let displaceVector = {
|
||||
x: 0,
|
||||
y: +browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
|
||||
}
|
||||
|
||||
viewPort.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenDown () {
|
||||
let displaceVector = {
|
||||
x: 0,
|
||||
y: -browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
|
||||
}
|
||||
|
||||
viewPort.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenLeft () {
|
||||
let displaceVector = {
|
||||
x: browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
|
||||
y: 0
|
||||
}
|
||||
|
||||
viewPort.displace(displaceVector, true)
|
||||
}
|
||||
|
||||
function oneScreenRight () {
|
||||
let displaceVector = {
|
||||
x: -browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
|
||||
y: 0
|
||||
}
|
||||
|
||||
viewPort.displace(displaceVector, true)
|
||||
}
|
||||
|
||||
function fitIntoVisibleArea (point) {
|
||||
/* Here we check the boundaries of the resulting points, so they dont go out of the visible area. */
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ function newFloatingSpace () {
|
||||
strategyPartConstructor: undefined,
|
||||
noteSets: undefined,
|
||||
container: undefined,
|
||||
oneScreenUp: oneScreenUp,
|
||||
oneScreenDown: oneScreenDown,
|
||||
oneScreenLeft: oneScreenLeft,
|
||||
oneScreenRight: oneScreenRight,
|
||||
positionAtNode: positionAtNode,
|
||||
fitIntoVisibleArea: fitIntoVisibleArea,
|
||||
isThisPointVisible: isThisPointVisible,
|
||||
makeVisible: makeVisible,
|
||||
@@ -41,6 +46,8 @@ function newFloatingSpace () {
|
||||
thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2
|
||||
|
||||
let visible = false
|
||||
|
||||
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
@@ -93,6 +100,53 @@ function newFloatingSpace () {
|
||||
return returnPoint
|
||||
}
|
||||
|
||||
function oneScreenUp () {
|
||||
let displaceVector = {
|
||||
x: 0,
|
||||
y: browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenDown () {
|
||||
let displaceVector = {
|
||||
x: 0,
|
||||
y: -browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenLeft () {
|
||||
let displaceVector = {
|
||||
x: browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
|
||||
y: 0
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenRight () {
|
||||
let displaceVector = {
|
||||
x: -browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
|
||||
y: 0
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function positionAtNode (node) {
|
||||
let position = thisObject.container.frame.frameThisPoint(node.payload.position)
|
||||
|
||||
let displaceVector = {
|
||||
x: browserCanvas.width / 2 - position.x,
|
||||
y: (COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT) + (browserCanvas.height - (COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT)) / 2 - position.y
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function isThisPointVisible (point) {
|
||||
if (point.x > browserCanvas.width) {
|
||||
return false
|
||||
|
||||
@@ -35,7 +35,7 @@ function newPanelsSpace () {
|
||||
|
||||
}
|
||||
|
||||
function createNewPanel (pType, pParameters, pOwner) {
|
||||
function createNewPanel (pType, pParameters, pOwner, pSession) {
|
||||
let panel
|
||||
|
||||
switch (pType) {
|
||||
@@ -59,6 +59,7 @@ function newPanelsSpace () {
|
||||
panel = getNewPlotterPanel(pParameters.devTeam, pParameters.plotterCodeName, pParameters.moduleCodeName, pParameters.panelCodeName)
|
||||
panel.fitFunction = canvas.chartSpace.fitIntoVisibleArea
|
||||
panel.container.isVisibleFunction = canvas.chartSpace.isThisPointVisible
|
||||
panel.session = pSession
|
||||
panel.initialize()
|
||||
break
|
||||
}
|
||||
|
||||
+17
-8
@@ -42,14 +42,17 @@ function newStrategySpace () {
|
||||
['Definition', 'text'],
|
||||
['Network', 'network'],
|
||||
['Network Node', 'network-node'],
|
||||
['Layer Manager', 'video-player'],
|
||||
['Social Bots', 'support'],
|
||||
['Telegram Bot', 'paper-plane'],
|
||||
['Announcement', 'promotion'],
|
||||
['Layer Manager', 'layer-manager'],
|
||||
['Layer', 'attractive'],
|
||||
['Task Manager', 'task'],
|
||||
['Task', 'timeline'],
|
||||
['Sensor', 'pipette'],
|
||||
['Indicator', 'vector'],
|
||||
['Trading Engine', 'brainstorming'],
|
||||
['Process', 'grid'],
|
||||
['Sensor', 'bot-sensor'],
|
||||
['Indicator', 'bot-indicator'],
|
||||
['Trading Engine', 'trading-engine'],
|
||||
['Process', 'process'],
|
||||
['Backtesting Session', 'session-backtesting'],
|
||||
['Live Trading Session', 'session-live-trading'],
|
||||
['Fordward Testing Session', 'session-forward-testing'],
|
||||
@@ -62,8 +65,8 @@ function newStrategySpace () {
|
||||
['Trading System', 'analysis'],
|
||||
['Parameters', 'settings'],
|
||||
['Base Asset', 'loading'],
|
||||
['Time Range', 'chronometer'],
|
||||
['Time Period', 'schedule'],
|
||||
['Time Range', 'schedule'],
|
||||
['Time Period', 'time-period'],
|
||||
['Slippage', 'support'],
|
||||
['Fee Structure', 'sitemap'],
|
||||
['Strategy', 'quality'],
|
||||
@@ -174,7 +177,13 @@ function newStrategySpace () {
|
||||
'session-backtesting',
|
||||
'session-forward-testing',
|
||||
'network',
|
||||
'network-node'
|
||||
'network-node',
|
||||
'trading-engine',
|
||||
'layer-manager',
|
||||
'process',
|
||||
'bot-indicator',
|
||||
'bot-sensor',
|
||||
'time-period'
|
||||
]
|
||||
|
||||
for (let i = 0; i < iconsNames.length; i++) {
|
||||
|
||||
@@ -56,10 +56,42 @@ function newAttachDetach () {
|
||||
}
|
||||
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)
|
||||
if (payload.parentNode.keys !== undefined) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (payload.parentNode.key !== undefined) {
|
||||
payload.parentNode.key = undefined
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
case 'Social Bots': {
|
||||
node.payload.parentNode.socialBots = undefined
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
let payload = node.payload
|
||||
for (let i = 0; i < payload.parentNode.bots.length; i++) {
|
||||
let bot = payload.parentNode.bots[i]
|
||||
if (bot.id === node.id) {
|
||||
payload.parentNode.bots.splice(i, 1)
|
||||
}
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
case 'Announcement': {
|
||||
let payload = node.payload
|
||||
for (let i = 0; i < payload.parentNode.announcements.length; i++) {
|
||||
let announcement = payload.parentNode.announcements[i]
|
||||
if (announcement.id === node.id) {
|
||||
payload.parentNode.announcements.splice(i, 1)
|
||||
}
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
@@ -342,6 +374,27 @@ function newAttachDetach () {
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
case 'Social Bots': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
node.payload.parentNode.socialBots = node
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
case 'Telegram Bot': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
node.payload.parentNode.bots.push(node)
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
case 'Announcement': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
node.payload.parentNode.announcements.push(node)
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
case 'Layer Manager': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
@@ -450,7 +503,11 @@ function newAttachDetach () {
|
||||
case 'Exchange Account Key': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
node.payload.parentNode.keys.push(node)
|
||||
if (node.payload.parentNode.keys !== undefined) {
|
||||
node.payload.parentNode.keys.push(node)
|
||||
} else {
|
||||
node.payload.parentNode.key = node
|
||||
}
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
|
||||
@@ -17,6 +17,15 @@ function newNodeChildren () {
|
||||
case 'Network Node': {
|
||||
return countChildrenNetworkNode(parentNode, childNode)
|
||||
}
|
||||
case 'Social Bots': {
|
||||
return countChildrenSocialBots(parentNode, childNode)
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
return countChildrenTelegramBot(parentNode, childNode)
|
||||
}
|
||||
case 'Announcement': {
|
||||
return countChildrenAnnouncement(parentNode, childNode)
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
return countChildrenLayerManager(parentNode, childNode)
|
||||
}
|
||||
@@ -215,6 +224,52 @@ function newNodeChildren () {
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenSocialBots (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
|
||||
for (let i = 0; i < parentNode.bots.length; i++) {
|
||||
let child = parentNode.bots[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenTelegramBot (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
|
||||
for (let i = 0; i < parentNode.announcements.length; i++) {
|
||||
let child = parentNode.announcements[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenAnnouncement (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
if (parentNode.formula !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.formula.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenLayerManager (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
@@ -348,6 +403,12 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.socialBots !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.socialBots.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -368,6 +429,12 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.socialBots !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.socialBots.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -388,6 +455,12 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.socialBots !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.socialBots.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -408,6 +481,12 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.socialBots !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.socialBots.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -525,6 +604,12 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.key !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.key.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -768,6 +853,13 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < parentNode.announcements.length; i++) {
|
||||
let child = parentNode.announcements[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -828,6 +920,13 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < parentNode.announcements.length; i++) {
|
||||
let child = parentNode.announcements[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ function newNodeDeleter () {
|
||||
deleteDefinition: deleteDefinition,
|
||||
deleteNetwork: deleteNetwork,
|
||||
deleteNetworkNode: deleteNetworkNode,
|
||||
deleteSocialBots: deleteSocialBots,
|
||||
deleteSocialBot: deleteSocialBot,
|
||||
deleteAnnouncement: deleteAnnouncement,
|
||||
deleteLayerManager: deleteLayerManager,
|
||||
deleteLayer: deleteLayer,
|
||||
deleteTaskManager: deleteTaskManager,
|
||||
@@ -70,6 +73,18 @@ function newNodeDeleter () {
|
||||
deleteNetworkNode(rootNode, rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Social Bots': {
|
||||
deleteSocialBots(rootNode, rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
deleteSocialBot(rootNode, rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Announcement': {
|
||||
deleteAnnouncement(rootNode, rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
deleteLayerManager(rootNode, rootNodes)
|
||||
break
|
||||
@@ -326,6 +341,59 @@ function newNodeDeleter () {
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteSocialBots (node, rootNodes) {
|
||||
let payload = node.payload
|
||||
if (payload.parentNode !== undefined) {
|
||||
payload.parentNode.socialBots = undefined
|
||||
}
|
||||
if (node.bots !== undefined) {
|
||||
while (node.bots.length > 0) {
|
||||
deleteSocialBot(node.bots[0], rootNodes)
|
||||
}
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteSocialBot (node, rootNodes) {
|
||||
let payload = node.payload
|
||||
if (payload.parentNode !== undefined) {
|
||||
for (let j = 0; j < payload.parentNode.bots.length; j++) {
|
||||
let bot = payload.parentNode.bots[j]
|
||||
if (bot.id === node.id) {
|
||||
payload.parentNode.bots.splice(j, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.announcements !== undefined) {
|
||||
while (node.announcements.length > 0) {
|
||||
deleteAnnouncement(node.announcements[0], rootNodes)
|
||||
}
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteAnnouncement (node, rootNodes) {
|
||||
let payload = node.payload
|
||||
if (payload.parentNode !== undefined) {
|
||||
for (let j = 0; j < payload.parentNode.announcements.length; j++) {
|
||||
let announcement = payload.parentNode.announcements[j]
|
||||
if (announcement.id === node.id) {
|
||||
payload.parentNode.announcements.splice(j, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.formula !== undefined) {
|
||||
deleteFormula(node.formula, rootNodes)
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteLayerManager (node, rootNodes) {
|
||||
let payload = node.payload
|
||||
if (payload.parentNode !== undefined) {
|
||||
@@ -461,6 +529,10 @@ function newNodeDeleter () {
|
||||
if (node.layerManager !== undefined) {
|
||||
deleteLayerManager(node.layerManager, rootNodes)
|
||||
}
|
||||
|
||||
if (node.socialBots !== undefined) {
|
||||
deleteSocialBots(node.socialBots, rootNodes)
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
@@ -480,6 +552,10 @@ function newNodeDeleter () {
|
||||
if (node.layerManager !== undefined) {
|
||||
deleteLayerManager(node.layerManager, rootNodes)
|
||||
}
|
||||
|
||||
if (node.socialBots !== undefined) {
|
||||
deleteSocialBots(node.socialBots, rootNodes)
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
@@ -499,6 +575,10 @@ function newNodeDeleter () {
|
||||
if (node.layerManager !== undefined) {
|
||||
deleteLayerManager(node.layerManager, rootNodes)
|
||||
}
|
||||
|
||||
if (node.socialBots !== undefined) {
|
||||
deleteSocialBots(node.socialBots, rootNodes)
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
@@ -518,6 +598,10 @@ function newNodeDeleter () {
|
||||
if (node.layerManager !== undefined) {
|
||||
deleteLayerManager(node.layerManager, rootNodes)
|
||||
}
|
||||
|
||||
if (node.socialBots !== undefined) {
|
||||
deleteSocialBots(node.socialBots, rootNodes)
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
@@ -586,12 +670,17 @@ function newNodeDeleter () {
|
||||
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)
|
||||
if (payload.parentNode.keys !== 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (payload.parentNode.key !== undefined) {
|
||||
payload.parentNode.key = undefined
|
||||
}
|
||||
} else {
|
||||
completeDeletion(node, rootNodes)
|
||||
}
|
||||
@@ -643,6 +732,9 @@ function newNodeDeleter () {
|
||||
if (node.feeStructure !== undefined) {
|
||||
deleteFeeStructure(node.feeStructure, rootNodes)
|
||||
}
|
||||
if (node.key !== undefined) {
|
||||
deleteExchangeAccountKey(node.key, rootNodes)
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
@@ -904,6 +996,11 @@ function newNodeDeleter () {
|
||||
}
|
||||
}
|
||||
|
||||
if (node.announcements !== undefined) {
|
||||
while (node.announcements.length > 0) {
|
||||
deleteAnnouncement(node.announcements[0], rootNodes)
|
||||
}
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
@@ -960,6 +1057,12 @@ function newNodeDeleter () {
|
||||
if (node.nextPhaseEvent !== undefined) {
|
||||
deleteEvent(node.nextPhaseEvent, rootNodes)
|
||||
}
|
||||
|
||||
if (node.announcements !== undefined) {
|
||||
while (node.announcements.length > 0) {
|
||||
deleteAnnouncement(node.announcements[0], rootNodes)
|
||||
}
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,738 @@
|
||||
function newOnFocus () {
|
||||
thisObject = {
|
||||
getNodeThatIsOnFocus: getNodeThatIsOnFocus
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function getNodeThatIsOnFocus (node) {
|
||||
if (node === undefined) { return }
|
||||
switch (node.type) {
|
||||
case 'Code':
|
||||
{
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Condition':
|
||||
{
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.code)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Situation': {
|
||||
let child
|
||||
for (let m = 0; m < node.conditions.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.conditions[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Formula':
|
||||
{
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Next Phase Event':
|
||||
{
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.announcements[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Phase': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.formula)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.nextPhaseEvent)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.announcements[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Stop': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.phases[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Take Profit': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.phases[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Take Position Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.announcements[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger On Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.announcements[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger Off Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.announcements[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Initial Definition': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.stopLoss)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.takeProfit)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.positionSize)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.positionRate)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Open Execution': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Close Execution': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Position Size': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.formula)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Position Rate': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.formula)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.triggerOn)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.triggerOff)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.takePosition)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Open Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.initialDefinition)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.openExecution)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Manage Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.stopLoss)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.takeProfit)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Close Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.closeExecution)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Strategy': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.triggerStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.openStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.manageStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.closeStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Base Asset': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Time Range': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Time Period': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Slippage': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Fee Structure': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Parameters': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.baseAsset)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.timeRange)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.timePeriod)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.slippage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.feeStructure)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trading System': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.strategies.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.strategies[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Personal Data': {
|
||||
let child
|
||||
for (let m = 0; m < node.exchangeAccounts.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.exchangeAccounts[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
let child
|
||||
for (let m = 0; m < node.assets.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.assets[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.keys.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.keys[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Social Bots': {
|
||||
let child
|
||||
for (let m = 0; m < node.bots.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.bots[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
let child
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.announcements[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Announcement': {
|
||||
child = getNodeThatIsOnFocus(node.formula)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.layers.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.layers[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Layer': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Task Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.tasks.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.tasks[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Task': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.bot)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Sensor': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.processes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Indicator': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.processes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trading Engine': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.processes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Process': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.session)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Backtesting Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.socialBots)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Live Trading Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.socialBots)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Fordward Testing Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.socialBots)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Paper Trading Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.socialBots)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Network Node': {
|
||||
let child
|
||||
for (let m = 0; m < node.taskManagers.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.taskManagers[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Network': {
|
||||
let child
|
||||
for (let m = 0; m < node.networkNodes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.networkNodes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Definition': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.tradingSystem)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.personalData)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.network)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,9 @@ function newPartsFromNodes () {
|
||||
addDefinition: addDefinition,
|
||||
addNetwork: addNetwork,
|
||||
addNetworkNode: addNetworkNode,
|
||||
addSocialBots: addSocialBots,
|
||||
addTelegramBot: addTelegramBot,
|
||||
addAnnouncement: addAnnouncement,
|
||||
addLayerManager: addLayerManager,
|
||||
addLayer: addLayer,
|
||||
addTaskManager: addTaskManager,
|
||||
@@ -76,6 +79,13 @@ function newPartsFromNodes () {
|
||||
let situation = node.situations[m]
|
||||
createPartFromNode(situation, node, node)
|
||||
}
|
||||
if (node.announcements === undefined) {
|
||||
node.announcements = []
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
let announcement = node.announcements[m]
|
||||
createPartFromNode(announcement, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Phase': {
|
||||
@@ -88,6 +98,13 @@ function newPartsFromNodes () {
|
||||
if (node.nextPhaseEvent !== undefined) {
|
||||
createPartFromNode(node.nextPhaseEvent, phase, phase)
|
||||
}
|
||||
if (node.announcements === undefined) {
|
||||
node.announcements = []
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
let announcement = node.announcements[m]
|
||||
createPartFromNode(announcement, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Stop': {
|
||||
@@ -158,6 +175,13 @@ function newPartsFromNodes () {
|
||||
let situation = node.situations[m]
|
||||
createPartFromNode(situation, event, event)
|
||||
}
|
||||
if (node.announcements === undefined) {
|
||||
node.announcements = []
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
let announcement = node.announcements[m]
|
||||
createPartFromNode(announcement, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Trigger On Event': {
|
||||
@@ -167,6 +191,13 @@ function newPartsFromNodes () {
|
||||
let situation = node.situations[m]
|
||||
createPartFromNode(situation, event, event)
|
||||
}
|
||||
if (node.announcements === undefined) {
|
||||
node.announcements = []
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
let announcement = node.announcements[m]
|
||||
createPartFromNode(announcement, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Trigger Off Event': {
|
||||
@@ -176,6 +207,13 @@ function newPartsFromNodes () {
|
||||
let situation = node.situations[m]
|
||||
createPartFromNode(situation, event, event)
|
||||
}
|
||||
if (node.announcements === undefined) {
|
||||
node.announcements = []
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
let announcement = node.announcements[m]
|
||||
createPartFromNode(announcement, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Position Size': {
|
||||
@@ -294,6 +332,9 @@ function newPartsFromNodes () {
|
||||
if (node.feeStructure !== undefined) {
|
||||
createPartFromNode(node.feeStructure, node, node)
|
||||
}
|
||||
if (node.key !== undefined) {
|
||||
createPartFromNode(node.key, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Trading System': {
|
||||
@@ -374,6 +415,29 @@ function newPartsFromNodes () {
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Social Bots': {
|
||||
createPart('Social Bots', node.name, node, parentNode, chainParent, 'Social Bots')
|
||||
for (let m = 0; m < node.bots.length; m++) {
|
||||
let bot = node.bots[m]
|
||||
createPartFromNode(bot, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
createPart('Telegram Bot', node.name, node, parentNode, chainParent, 'Telegram Bot')
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
let announcement = node.announcements[m]
|
||||
createPartFromNode(announcement, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Announcement': {
|
||||
createPart('Announcement', node.name, node, parentNode, chainParent, 'Announcement')
|
||||
if (node.formula !== undefined) {
|
||||
createPartFromNode(node.formula, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
createPart('Layer Manager', node.name, node, parentNode, chainParent, 'Layer Manager')
|
||||
for (let m = 0; m < node.layers.length; m++) {
|
||||
@@ -456,6 +520,9 @@ function newPartsFromNodes () {
|
||||
if (node.layerManager !== undefined) {
|
||||
createPartFromNode(node.layerManager, node, node)
|
||||
}
|
||||
if (node.socialBots !== undefined) {
|
||||
createPartFromNode(node.socialBots, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Live Trading Session': {
|
||||
@@ -466,6 +533,9 @@ function newPartsFromNodes () {
|
||||
if (node.layerManager !== undefined) {
|
||||
createPartFromNode(node.layerManager, node, node)
|
||||
}
|
||||
if (node.socialBots !== undefined) {
|
||||
createPartFromNode(node.socialBots, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Fordward Testing Session': {
|
||||
@@ -476,6 +546,9 @@ function newPartsFromNodes () {
|
||||
if (node.layerManager !== undefined) {
|
||||
createPartFromNode(node.layerManager, node, node)
|
||||
}
|
||||
if (node.socialBots !== undefined) {
|
||||
createPartFromNode(node.socialBots, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Paper Trading Session': {
|
||||
@@ -486,6 +559,9 @@ function newPartsFromNodes () {
|
||||
if (node.layerManager !== undefined) {
|
||||
createPartFromNode(node.layerManager, node, node)
|
||||
}
|
||||
if (node.socialBots !== undefined) {
|
||||
createPartFromNode(node.socialBots, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -515,6 +591,41 @@ function newPartsFromNodes () {
|
||||
return networkNode
|
||||
}
|
||||
|
||||
function addSocialBots (node) {
|
||||
if (node.socialBots === undefined) {
|
||||
node.socialBots = {
|
||||
name: 'New Social Bots',
|
||||
bots: []
|
||||
}
|
||||
createPart('Social Bots', node.socialBots.name, node.socialBots, node, node, 'Social Bots')
|
||||
}
|
||||
|
||||
return node.socialBots
|
||||
}
|
||||
|
||||
function addTelegramBot (node) {
|
||||
let bot = {
|
||||
name: 'New Telegram Bot',
|
||||
code: '{ \n\"botToken\": \"Paste here the bot token obtained from Telegram Bot Father\",\n\"chatId\": Write here the chat or group id where the announcements are going to be sent to, as it is a number with no quotes please.\n}',
|
||||
announcements: []
|
||||
}
|
||||
node.bots.push(bot)
|
||||
createPart('Telegram Bot', bot.name, bot, node, node, 'Telegram Bot')
|
||||
|
||||
return bot
|
||||
}
|
||||
|
||||
function addAnnouncement (node) {
|
||||
let announcement = {
|
||||
name: 'Announcement via ' + node.type,
|
||||
code: '{ \n\"text\": \"Write here what you want to announce.\",\n\"botType\": \"' + node.type + '\",\n\"botId\": \"' + node.id + '\"\n}'
|
||||
}
|
||||
node.announcements.push(announcement)
|
||||
createPart('Announcement', announcement.name, announcement, node, node, 'Announcement')
|
||||
|
||||
return announcement
|
||||
}
|
||||
|
||||
function addLayerManager (node) {
|
||||
if (node.layerManager === undefined) {
|
||||
node.layerManager = {
|
||||
@@ -597,6 +708,7 @@ function newPartsFromNodes () {
|
||||
|
||||
function addProcess (node) {
|
||||
let process = {
|
||||
name: 'New Process',
|
||||
code: '{}'
|
||||
}
|
||||
|
||||
@@ -626,7 +738,8 @@ function newPartsFromNodes () {
|
||||
function addBacktestingSession (node) {
|
||||
if (node.session === undefined) {
|
||||
node.session = {
|
||||
name: 'New Backtesting Session'
|
||||
name: 'New Backtesting Session',
|
||||
code: '{}'
|
||||
}
|
||||
createPart('Backtesting Session', '', node.session, node, node)
|
||||
}
|
||||
@@ -637,7 +750,8 @@ function newPartsFromNodes () {
|
||||
function addLiveTradingSession (node) {
|
||||
if (node.session === undefined) {
|
||||
node.session = {
|
||||
name: 'New Live Trading Session'
|
||||
name: 'New Live Trading Session',
|
||||
code: '{}'
|
||||
}
|
||||
createPart('Live Trading Session', '', node.session, node, node)
|
||||
}
|
||||
@@ -648,7 +762,8 @@ function newPartsFromNodes () {
|
||||
function addFordwardTestingSession (node) {
|
||||
if (node.session === undefined) {
|
||||
node.session = {
|
||||
name: 'New Fordward Testing Session'
|
||||
name: 'New Fordward Testing Session',
|
||||
code: '{}'
|
||||
}
|
||||
createPart('Fordward Testing Session', '', node.session, node, node)
|
||||
}
|
||||
@@ -659,7 +774,8 @@ function newPartsFromNodes () {
|
||||
function addPaperTradingSession (node) {
|
||||
if (node.session === undefined) {
|
||||
node.session = {
|
||||
name: 'New Paper Trading Session'
|
||||
name: 'New Paper Trading Session',
|
||||
code: '{}'
|
||||
}
|
||||
createPart('Paper Trading Session', '', node.session, node, node)
|
||||
}
|
||||
@@ -917,19 +1033,22 @@ function newPartsFromNodes () {
|
||||
function addMissingEvents (node) {
|
||||
if (node.triggerOn === undefined) {
|
||||
node.triggerOn = {
|
||||
situations: []
|
||||
situations: [],
|
||||
announcements: []
|
||||
}
|
||||
createPart('Trigger On Event', '', node.triggerOn, node, node)
|
||||
}
|
||||
if (node.triggerOff === undefined) {
|
||||
node.triggerOff = {
|
||||
situations: []
|
||||
situations: [],
|
||||
announcements: []
|
||||
}
|
||||
createPart('Trigger Off Event', '', node.triggerOff, node, node)
|
||||
}
|
||||
if (node.takePosition === undefined) {
|
||||
node.takePosition = {
|
||||
situations: []
|
||||
situations: [],
|
||||
announcements: []
|
||||
}
|
||||
createPart('Take Position Event', '', node.takePosition, node, node)
|
||||
}
|
||||
@@ -1043,7 +1162,8 @@ function newPartsFromNodes () {
|
||||
function addNextPhaseEvent (node) {
|
||||
if (node.nextPhaseEvent === undefined) {
|
||||
node.nextPhaseEvent = {
|
||||
situations: []
|
||||
situations: [],
|
||||
announcements: []
|
||||
}
|
||||
createPart('Next Phase Event', '', node.nextPhaseEvent, node, node)
|
||||
}
|
||||
@@ -1077,6 +1197,7 @@ function newPartsFromNodes () {
|
||||
|
||||
let phase = {
|
||||
name: 'New Phase',
|
||||
announcements: [],
|
||||
formula: {
|
||||
code: DEFAULT_FORMULA_TEXT
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -27,7 +27,7 @@ function newSessionFunctions () {
|
||||
|
||||
/* Raise event to run the session */
|
||||
let event = {
|
||||
session: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, false, true)),
|
||||
session: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true)),
|
||||
definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(thisNodeDefinition, false, true, true)),
|
||||
uiCurrentValues: getUICurrentValues()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,723 @@
|
||||
function newShortcutKeys () {
|
||||
thisObject = {
|
||||
getNodeByShortcutKey: getNodeByShortcutKey
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function getNodeByShortcutKey (node, searchingKey) {
|
||||
if (node === undefined) { return }
|
||||
switch (node.type) {
|
||||
case 'Code':
|
||||
{
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Condition':
|
||||
{
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.code, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Situation': {
|
||||
let child
|
||||
for (let m = 0; m < node.conditions.length; m++) {
|
||||
child = getNodeByShortcutKey(node.conditions[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Formula':
|
||||
{
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Next Phase Event':
|
||||
{
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeByShortcutKey(node.announcements[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Phase': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.formula, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.nextPhaseEvent, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeByShortcutKey(node.announcements[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Stop': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getNodeByShortcutKey(node.phases[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Take Profit': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getNodeByShortcutKey(node.phases[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Take Position Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeByShortcutKey(node.announcements[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger On Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeByShortcutKey(node.announcements[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger Off Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeByShortcutKey(node.announcements[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Initial Definition': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.stopLoss, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.takeProfit, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.positionSize, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.positionRate, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Open Execution': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Close Execution': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Position Size': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.formula, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Position Rate': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.formula, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger Stage': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.triggerOn, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.triggerOff, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.takePosition, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Open Stage': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.initialDefinition, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.openExecution, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Manage Stage': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.stopLoss, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.takeProfit, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Close Stage': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.closeExecution, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Strategy': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.triggerStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.openStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.manageStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.closeStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Base Asset': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Time Range': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Time Period': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Slippage': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Fee Structure': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Parameters': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.baseAsset, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.timeRange, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.timePeriod, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.slippage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.feeStructure, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trading System': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.strategies.length; m++) {
|
||||
child = getNodeByShortcutKey(node.strategies[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Personal Data': {
|
||||
let child
|
||||
for (let m = 0; m < node.exchangeAccounts.length; m++) {
|
||||
child = getNodeByShortcutKey(node.exchangeAccounts[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
let child
|
||||
for (let m = 0; m < node.assets.length; m++) {
|
||||
child = getNodeByShortcutKey(node.assets[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.keys.length; m++) {
|
||||
child = getNodeByShortcutKey(node.keys[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Social Bots': {
|
||||
let child
|
||||
for (let m = 0; m < node.bots.length; m++) {
|
||||
child = getNodeByShortcutKey(node.bots[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
let child
|
||||
for (let m = 0; m < node.announcements.length; m++) {
|
||||
child = getNodeByShortcutKey(node.announcements[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Announcement': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.formula, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.layers.length; m++) {
|
||||
child = getNodeByShortcutKey(node.layers[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Layer': {
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Task Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.tasks.length; m++) {
|
||||
child = getNodeByShortcutKey(node.tasks[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Task': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.bot, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Sensor': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeByShortcutKey(node.processes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Indicator': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeByShortcutKey(node.processes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trading Engine': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeByShortcutKey(node.processes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Process': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.session, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Backtesting Session': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Live Trading Session': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Fordward Testing Session': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Paper Trading Session': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Network Node': {
|
||||
let child
|
||||
for (let m = 0; m < node.taskManagers.length; m++) {
|
||||
child = getNodeByShortcutKey(node.taskManagers[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Network': {
|
||||
let child
|
||||
for (let m = 0; m < node.networkNodes.length; m++) {
|
||||
child = getNodeByShortcutKey(node.networkNodes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Definition': {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node.tradingSystem, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.personalData, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.network, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,687 +0,0 @@
|
||||
function newStringifyNode () {
|
||||
thisObject = {
|
||||
prepareForStringify: prepareForStringify
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function prepareForStringify (node, removePersonalData) {
|
||||
if (node === undefined) { return }
|
||||
switch (node.type) {
|
||||
case 'Code':
|
||||
{
|
||||
let code = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return code
|
||||
}
|
||||
case 'Condition':
|
||||
{
|
||||
let condition = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: prepareForStringify(node.code, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return condition
|
||||
}
|
||||
case 'Situation': {
|
||||
let situation = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
conditions: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.conditions.length; m++) {
|
||||
let condition = prepareForStringify(node.conditions[m], removePersonalData)
|
||||
situation.conditions.push(condition)
|
||||
}
|
||||
return situation
|
||||
}
|
||||
case 'Formula':
|
||||
{
|
||||
let formula = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return formula
|
||||
}
|
||||
case 'Next Phase Event':
|
||||
{
|
||||
let event = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
situations: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
let situation = prepareForStringify(node.situations[m], removePersonalData)
|
||||
event.situations.push(situation)
|
||||
}
|
||||
return event
|
||||
}
|
||||
case 'Phase': {
|
||||
let phase = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
formula: prepareForStringify(node.formula, removePersonalData),
|
||||
nextPhaseEvent: prepareForStringify(node.nextPhaseEvent, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return phase
|
||||
}
|
||||
case 'Stop': {
|
||||
let stop = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
phases: [],
|
||||
maxPhases: node.maxPhases,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
let phase = prepareForStringify(node.phases[m], removePersonalData)
|
||||
stop.phases.push(phase)
|
||||
}
|
||||
return stop
|
||||
}
|
||||
case 'Take Profit': {
|
||||
let takeProfit = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
phases: [],
|
||||
maxPhases: node.maxPhases,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
let phase = prepareForStringify(node.phases[m], removePersonalData)
|
||||
takeProfit.phases.push(phase)
|
||||
}
|
||||
return takeProfit
|
||||
}
|
||||
case 'Take Position Event': {
|
||||
let event = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
situations: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
let situation = prepareForStringify(node.situations[m], removePersonalData)
|
||||
event.situations.push(situation)
|
||||
}
|
||||
return event
|
||||
}
|
||||
case 'Trigger On Event': {
|
||||
let event = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
situations: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
let situation = prepareForStringify(node.situations[m], removePersonalData)
|
||||
event.situations.push(situation)
|
||||
}
|
||||
return event
|
||||
}
|
||||
case 'Trigger Off Event': {
|
||||
let event = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
situations: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
let situation = prepareForStringify(node.situations[m], removePersonalData)
|
||||
event.situations.push(situation)
|
||||
}
|
||||
return event
|
||||
}
|
||||
case 'Initial Definition': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
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
|
||||
}
|
||||
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,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
formula: prepareForStringify(node.formula, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Position Rate': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
formula: prepareForStringify(node.formula, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Trigger Stage': {
|
||||
let stage = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
triggerOn: prepareForStringify(node.triggerOn, removePersonalData),
|
||||
triggerOff: prepareForStringify(node.triggerOff, removePersonalData),
|
||||
takePosition: prepareForStringify(node.takePosition, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return stage
|
||||
}
|
||||
case 'Open Stage': {
|
||||
let stage = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
initialDefinition: prepareForStringify(node.initialDefinition, removePersonalData),
|
||||
openExecution: prepareForStringify(node.openExecution, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return stage
|
||||
}
|
||||
case 'Manage Stage': {
|
||||
let stage = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
stopLoss: prepareForStringify(node.stopLoss, removePersonalData),
|
||||
takeProfit: prepareForStringify(node.takeProfit, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return stage
|
||||
}
|
||||
case 'Close Stage': {
|
||||
let stage = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
closeExecution: prepareForStringify(node.closeExecution, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return stage
|
||||
}
|
||||
case 'Strategy': {
|
||||
let strategy = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
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
|
||||
}
|
||||
case 'Base Asset': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Time Range': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Time Period': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Slippage': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Fee Structure': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Parameters': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
baseAsset: prepareForStringify(node.baseAsset, removePersonalData),
|
||||
timeRange: prepareForStringify(node.timeRange, removePersonalData),
|
||||
timePeriod: prepareForStringify(node.timePeriod, removePersonalData),
|
||||
slippage: prepareForStringify(node.slippage, removePersonalData),
|
||||
feeStructure: prepareForStringify(node.feeStructure, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Trading System': {
|
||||
let tradingSystem = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
strategies: [],
|
||||
parameters: prepareForStringify(node.parameters, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.strategies.length; 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,
|
||||
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': {
|
||||
if (removePersonalData === true) { return }
|
||||
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], removePersonalData)
|
||||
exchangeAccount.assets.push(asset)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.keys.length; 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,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return asset
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
if (removePersonalData === true) { return }
|
||||
let key = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return key
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
let layerManager = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
layers: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
if (node.layers !== undefined) {
|
||||
for (let m = 0; m < node.layers.length; m++) {
|
||||
let layer = prepareForStringify(node.layers[m], removePersonalData)
|
||||
layerManager.layers.push(layer)
|
||||
}
|
||||
}
|
||||
return layerManager
|
||||
}
|
||||
case 'Layer': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Task Manager': {
|
||||
let taskManager = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
tasks: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
if (node.tasks !== undefined) {
|
||||
for (let m = 0; m < node.tasks.length; m++) {
|
||||
let task = prepareForStringify(node.tasks[m], removePersonalData)
|
||||
taskManager.tasks.push(task)
|
||||
}
|
||||
}
|
||||
return taskManager
|
||||
}
|
||||
case 'Task': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
bot: prepareForStringify(node.bot, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Sensor': {
|
||||
let bot = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
processes: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
let process = prepareForStringify(node.processes[m], removePersonalData)
|
||||
bot.processes.push(process)
|
||||
}
|
||||
|
||||
return bot
|
||||
}
|
||||
case 'Indicator': {
|
||||
let bot = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
processes: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
let process = prepareForStringify(node.processes[m], removePersonalData)
|
||||
bot.processes.push(process)
|
||||
}
|
||||
|
||||
return bot
|
||||
}
|
||||
case 'Trading Engine': {
|
||||
let bot = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
processes: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
let process = prepareForStringify(node.processes[m], removePersonalData)
|
||||
bot.processes.push(process)
|
||||
}
|
||||
|
||||
return bot
|
||||
}
|
||||
case 'Process': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
code: node.code,
|
||||
session: prepareForStringify(node.session, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Backtesting Session': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
parameters: prepareForStringify(node.parameters, removePersonalData),
|
||||
layerManager: prepareForStringify(node.layerManager, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Live Trading Session': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
parameters: prepareForStringify(node.parameters, removePersonalData),
|
||||
layerManager: prepareForStringify(node.layerManager, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Fordward Testing Session': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
parameters: prepareForStringify(node.parameters, removePersonalData),
|
||||
layerManager: prepareForStringify(node.layerManager, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Paper Trading Session': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
parameters: prepareForStringify(node.parameters, removePersonalData),
|
||||
layerManager: prepareForStringify(node.layerManager, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Network Node': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
taskManagers: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
if (node.taskManagers !== undefined) {
|
||||
for (let m = 0; m < node.taskManagers.length; m++) {
|
||||
let taskManager = prepareForStringify(node.taskManagers[m], removePersonalData)
|
||||
object.taskManagers.push(taskManager)
|
||||
}
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Network': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
networkNodes: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
if (node.networkNodes !== undefined) {
|
||||
for (let m = 0; m < node.networkNodes.length; m++) {
|
||||
let networkNode = prepareForStringify(node.networkNodes[m], removePersonalData)
|
||||
object.networkNodes.push(networkNode)
|
||||
}
|
||||
}
|
||||
return object
|
||||
}
|
||||
case 'Definition': {
|
||||
let object = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
tradingSystem: prepareForStringify(node.tradingSystem, removePersonalData),
|
||||
personalData: prepareForStringify(node.personalData, removePersonalData),
|
||||
network: prepareForStringify(node.network, removePersonalData),
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return object
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSavedPayload (node) {
|
||||
if (node.payload === undefined) {
|
||||
console.log(node)
|
||||
}
|
||||
let savedPayload = {
|
||||
position: {
|
||||
x: node.payload.position.x,
|
||||
y: node.payload.position.y
|
||||
},
|
||||
targetPosition: {
|
||||
x: node.payload.targetPosition.x,
|
||||
y: node.payload.targetPosition.y
|
||||
},
|
||||
floatingObject: {
|
||||
isPinned: node.payload.floatingObject.isPinned,
|
||||
isFrozen: (node.payload.floatingObject.isFrozen && node.payload.floatingObject.frozenManually),
|
||||
isCollapsed: (node.payload.floatingObject.isCollapsed && node.payload.floatingObject.collapsedManually),
|
||||
isTensed: (node.payload.floatingObject.isTensed && node.payload.floatingObject.tensedManually)
|
||||
},
|
||||
uiObject: {
|
||||
isRunning: node.payload.uiObject.isRunning
|
||||
}
|
||||
}
|
||||
return savedPayload
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ function newWorkspace () {
|
||||
container: undefined,
|
||||
enabled: false,
|
||||
nodeChildren: undefined,
|
||||
getNodeThatIsOnFocus: getNodeThatIsOnFocus,
|
||||
getNodeByShortcutKey: getNodeByShortcutKey,
|
||||
getAllTradingEngines: getAllTradingEngines,
|
||||
stopAllRunningTasks: stopAllRunningTasks,
|
||||
onMenuItemClick: onMenuItemClick,
|
||||
@@ -46,9 +48,11 @@ function newWorkspace () {
|
||||
let functionLibraryNodeDeleter = newNodeDeleter()
|
||||
let functionLibraryPartsFromNodes = newPartsFromNodes()
|
||||
let functionLibraryProtocolNode = newProtocolNode()
|
||||
let functionLibraryWorkspaceNodes = newStringifyNode()
|
||||
let functionLibraryTaskFunctions = newTaskFunctions()
|
||||
let functionLibrarySessionFunctions = newSessionFunctions()
|
||||
let functionLibraryShortcutKeys = newShortcutKeys()
|
||||
let functionLibraryOnFocus = newOnFocus()
|
||||
|
||||
thisObject.nodeChildren = newNodeChildren()
|
||||
|
||||
return thisObject
|
||||
@@ -127,7 +131,7 @@ function newWorkspace () {
|
||||
let stringifyReadyNodes = []
|
||||
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
|
||||
let rootNode = thisObject.workspaceNode.rootNodes[i]
|
||||
let node = functionLibraryWorkspaceNodes.prepareForStringify(rootNode, removePersonalData)
|
||||
let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true)
|
||||
if (node) {
|
||||
stringifyReadyNodes.push(node)
|
||||
}
|
||||
@@ -188,6 +192,28 @@ function newWorkspace () {
|
||||
return tradingEngines
|
||||
}
|
||||
|
||||
function getNodeByShortcutKey (searchingKey) {
|
||||
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
|
||||
let rootNode = thisObject.workspaceNode.rootNodes[i]
|
||||
if (rootNode.type === 'Definition') {
|
||||
let definition = rootNode
|
||||
let node = functionLibraryShortcutKeys.getNodeByShortcutKey(rootNode, searchingKey)
|
||||
if (node !== undefined) { return node }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getNodeThatIsOnFocus () {
|
||||
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
|
||||
let rootNode = thisObject.workspaceNode.rootNodes[i]
|
||||
if (rootNode.type === 'Definition') {
|
||||
let definition = rootNode
|
||||
let node = functionLibraryOnFocus.getNodeThatIsOnFocus(rootNode)
|
||||
if (node !== undefined) { return node }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function spawn (nodeText, point) {
|
||||
try {
|
||||
point = canvas.floatingSpace.container.frame.unframeThisPoint(point)
|
||||
@@ -307,6 +333,21 @@ function newWorkspace () {
|
||||
functionLibraryPartsFromNodes.addNetworkNode(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Social Bots':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addSocialBots(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Telegram Bot':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addTelegramBot(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Announcement':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addAnnouncement(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Layer Manager':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addLayerManager(payload.node)
|
||||
@@ -475,6 +516,18 @@ function newWorkspace () {
|
||||
functionLibraryNodeDeleter.deleteNetworkNode(payload.node, thisObject.workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Delete Social Bots': {
|
||||
functionLibraryNodeDeleter.deleteSocialBots(payload.node, thisObject.workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Delete Social Bot': {
|
||||
functionLibraryNodeDeleter.deleteSocialBot(payload.node, thisObject.workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Delete Announcement': {
|
||||
functionLibraryNodeDeleter.deleteAnnouncement(payload.node, thisObject.workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Delete Layer Manager': {
|
||||
functionLibraryNodeDeleter.deleteLayerManager(payload.node, thisObject.workspaceNode.rootNodes)
|
||||
break
|
||||
|
||||
Reference in new issue
Block a user