Merge pull request #103 from AAMasters/develop

Indicators From UI
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2019-11-22 20:32:20 +01:00
commit 699e84fe3b
31 files changed
+9248 -3367

No files matched your search

+50 -27
View File
@@ -37,7 +37,7 @@ function newCanvas () {
panelsSpace: undefined,
cockpitSpace: undefined,
bottomSpace: undefined,
strategySpace: undefined,
designerSpace: undefined,
animation: undefined,
initialize: initialize,
finalize: finalize
@@ -47,6 +47,7 @@ function newCanvas () {
let splashScreen
let lastContainerMouseOver
return thisObject
function finalize () {
@@ -71,6 +72,9 @@ function newCanvas () {
browserCanvas.removeEventListener('drop', onDragDrop, false)
browserCanvas.removeEventListener('keydown', onKeyDown, false)
splashScreen = undefined
lastContainerMouseOver = undefined
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack) }
}
@@ -90,8 +94,8 @@ function newCanvas () {
thisObject.topSpace = newTopSpace()
await thisObject.topSpace.initialize()
thisObject.strategySpace = newStrategySpace()
await thisObject.strategySpace.initialize()
thisObject.designerSpace = newDesignerSpace()
await thisObject.designerSpace.initialize()
thisObject.cockpitSpace = newCockpitSpace()
thisObject.cockpitSpace.initialize()
@@ -118,13 +122,17 @@ function newCanvas () {
animation.initialize()
thisObject.animation = animation
/* Low Level Infraestructure First */
animation.addCallBackFunction('System Event Handler Physics', systemEventHandler.physics)
/* Spcaces Physics */
animation.addCallBackFunction('Floating Space Physics', thisObject.floatingSpace.physics)
animation.addCallBackFunction('Chart Space Physics', thisObject.chartSpace.physics)
animation.addCallBackFunction('CockpitSpace Physics', thisObject.cockpitSpace.physics)
animation.addCallBackFunction('Strategy Space Physics', thisObject.strategySpace.physics)
animation.addCallBackFunction('Strategy Space Physics', thisObject.designerSpace.physics)
animation.addCallBackFunction('Panels Space Physics', thisObject.panelsSpace.physics)
/* Spcaces Drawing */
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw)
animation.addCallBackFunction('Chart Space Background', thisObject.chartSpace.drawBackground)
animation.addCallBackFunction('Chart Space Draw', thisObject.chartSpace.draw)
@@ -132,7 +140,7 @@ function newCanvas () {
animation.addCallBackFunction('ViewPort Animate', viewPort.animate)
animation.addCallBackFunction('CockpitSpace Draw', thisObject.cockpitSpace.draw)
animation.addCallBackFunction('Top Space Draw', thisObject.topSpace.draw)
animation.addCallBackFunction('Strategy Space Draw', thisObject.strategySpace.draw)
animation.addCallBackFunction('Strategy Space Draw', thisObject.designerSpace.draw)
animation.addCallBackFunction('Splash Screen Draw', splashScreen.draw)
animation.start()
} catch (err) {
@@ -186,20 +194,27 @@ function newCanvas () {
}
function onKeyDown (event) {
let nodeOnFocus = canvas.strategySpace.workspace.getNodeThatIsOnFocus()
let nodeOnFocus = canvas.designerSpace.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) {
if (nodeOnFocus.payload.uiObject.uiObjectTitle !== undefined) {
if (nodeOnFocus.payload.uiObject.uiObjectTitle.editMode === true) {
return
}
}
}
if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true && event.shiftKey === true && event.keyCode === 123) { // Dev Tool when used with F12
if (nodeOnFocus !== undefined) {
console.log(nodeOnFocus)
return
}
}
if (event.altKey === true && event.code === 'ArrowUp') {
thisObject.cockpitSpace.toTop()
return
@@ -231,22 +246,34 @@ function newCanvas () {
}
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowLeft') {
canvas.floatingSpace.oneScreenLeft()
let displaceVector = canvas.floatingSpace.oneScreenLeft()
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
checkDrag()
return
}
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowRight') {
canvas.floatingSpace.oneScreenRight()
let displaceVector = canvas.floatingSpace.oneScreenRight()
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
checkDrag()
return
}
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowUp') {
canvas.floatingSpace.oneScreenUp()
let displaceVector = canvas.floatingSpace.oneScreenUp()
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
checkDrag()
return
}
if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowDown') {
canvas.floatingSpace.oneScreenDown()
let displaceVector = canvas.floatingSpace.oneScreenDown()
dragVector.downX = dragVector.downX + displaceVector.x
dragVector.downY = dragVector.downY + displaceVector.y
checkDrag()
return
}
@@ -257,12 +284,12 @@ function newCanvas () {
}
}
if ((event.ctrlKey === true || event.metaKey === true)) {
if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === 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)
let nodeUsingThisKey = canvas.designerSpace.workspace.getNodeByShortcutKey(event.key)
if (nodeOnFocus === undefined && nodeUsingThisKey !== undefined) {
/* Then we displace the whole workspace to center it at the node using this key */
@@ -284,15 +311,15 @@ function newCanvas () {
/* 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)
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + Alt + ' + event.key)
}
return
}
}
if (event.ctrlKey === true && nodeOnFocus !== undefined) {
if (event.ctrlKey === true && event.altKey === true && nodeOnFocus !== undefined) {
if (nodeOnFocus.payload.uiObject.shortcutKey !== undefined && nodeOnFocus.payload.uiObject.shortcutKey !== '') {
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + ' + nodeOnFocus.payload.uiObject.shortcutKey)
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + Alt + ' + nodeOnFocus.payload.uiObject.shortcutKey)
}
}
}
@@ -345,7 +372,7 @@ function newCanvas () {
x: event.x,
y: event.y
}
thisObject.strategySpace.workspace.spawn(reader.result, mousePosition)
thisObject.designerSpace.workspace.spawn(reader.result, mousePosition)
}
}
} catch (err) {
@@ -368,7 +395,7 @@ function newCanvas () {
/* We check if the mouse is over an element of the Strategy Space / */
container = thisObject.strategySpace.getContainer(point)
container = thisObject.designerSpace.getContainer(point)
if (container !== undefined && container.isDraggeable === true) {
containerBeingDragged = container
@@ -474,7 +501,7 @@ function newCanvas () {
/* We check if the mouse is over an element of the Strategy Space / */
container = thisObject.strategySpace.getContainer(point)
container = thisObject.designerSpace.getContainer(point)
if (container !== undefined && container.isClickeable === true) {
container.eventHandler.raiseEvent('onMouseClick', point)
@@ -546,6 +573,7 @@ function newCanvas () {
function onMouseMove (event) {
try {
/* Processing the event */
let point = {
x: event.pageX,
y: event.pageY - CURRENT_TOP_MARGIN
@@ -603,8 +631,8 @@ function newCanvas () {
/* We check if the mouse is over an element of the Strategy Space / */
if (thisObject.strategySpace !== undefined) {
container = thisObject.strategySpace.getContainer(point)
if (thisObject.designerSpace !== undefined) {
container = thisObject.designerSpace.getContainer(point)
if (container !== undefined && container.detectMouseOver === true) {
containerFound()
@@ -773,11 +801,6 @@ function newCanvas () {
function checkDrag (event) {
try {
if (containerDragStarted === true || floatingObjectDragStarted === true || viewPortBeingDragged === true) {
let point = {
x: event.pageX,
y: event.pageY - CURRENT_TOP_MARGIN
}
browserCanvas.style.cursor = 'grabbing'
thisObject.eventHandler.raiseEvent('Dragging', undefined)
+1 -1
View File
@@ -106,7 +106,7 @@ function newDashboard () {
function setBrowserEvents () {
window.onbeforeunload = onBrowserClosed
function onBrowserClosed () {
canvas.strategySpace.workspace.stopAllRunningTasks()
canvas.designerSpace.workspace.stopAllRunningTasks()
}
}
}
@@ -1,95 +1,95 @@
function newStrategizerGateway () {
const MODULE_NAME = 'Strategizer Gateway'
const logger = newWebDebugLog()
logger.fileName = MODULE_NAME
let thisObject = {
idAtStrategizer: undefined,
strategizerData: undefined,
container: undefined,
loadFromStrategyzer: loadFromStrategyzer
}
let colletionItems = []
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
thisObject.container.frame.width = 0
thisObject.container.frame.height = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
thisObject.container.isDraggeable = false
thisObject.container.isClickeable = false
let graphQLServer
return thisObject
async function loadFromStrategyzer () {
try {
const accessToken = window.localStorage.getItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY)
if (accessToken === null) {
logger.write('[ERROR] loadFromStrategyzer -> Can load from strategizer because the accessToken is missing.')
return
}
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY)
if (user === null) {
logger.write('[ERROR] saveToStrategyzer -> Can not load from strategizer because user is not logged in. ')
return
}
user = JSON.parse(user)
if (window.canvasApp.executingAt === 'Local') {
window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, 'Local File')
thisObject.strategizerData = JSON.parse('{"type":"Definition"}')
thisObject.idAtStrategizer = 'Local File'
return true
} else {
let fbSlug = 'simulator-bot-' + user.alias.replace('.', '')
graphQLServer = await axios({
url: window.canvasApp.graphQL.masterAppApiUrl,
method: 'post',
data: {
query:
`
query($fbSlug: String!){
strategizer_TradingSystemByFb(fbSlug: $fbSlug){
id
fbSlug
data
}
}
`,
variables: {
fbSlug: fbSlug
}
},
headers: {
authorization: 'Bearer ' + accessToken
}
})
if (graphQLServer.data.errors) {
logger.write('[ERROR] loadFromStrategyzer -> GraphQL Error: ' + JSON.stringify(graphQLServer.data.errors))
return false
} else {
thisObject.strategizerData = JSON.parse(JSON.stringify(graphQLServer.data.data.strategizer_TradingSystemByFb.data))
thisObject.idAtStrategizer = graphQLServer.data.data.strategizer_TradingSystemByFb.id
window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, thisObject.idAtStrategizer)
return true
}
}
} catch (err) {
logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack)
}
function newStrategizerGateway () {
const MODULE_NAME = 'Strategizer Gateway'
const logger = newWebDebugLog()
logger.fileName = MODULE_NAME
let thisObject = {
idAtStrategizer: undefined,
strategizerData: undefined,
container: undefined,
loadFromStrategyzer: loadFromStrategyzer
}
}
let colletionItems = []
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
thisObject.container.frame.width = 0
thisObject.container.frame.height = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
thisObject.container.isDraggeable = false
thisObject.container.isClickeable = false
let graphQLServer
return thisObject
async function loadFromStrategyzer () {
try {
const accessToken = window.localStorage.getItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY)
if (accessToken === null) {
logger.write('[ERROR] loadFromStrategyzer -> Can load from strategizer because the accessToken is missing.')
return
}
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY)
if (user === null) {
logger.write('[ERROR] saveToStrategyzer -> Can not load from strategizer because user is not logged in. ')
return
}
user = JSON.parse(user)
if (window.canvasApp.executingAt === 'Local') {
window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, 'Local File')
thisObject.strategizerData = JSON.parse('{"type":"Definition"}')
thisObject.idAtStrategizer = 'Local File'
return true
} else {
let fbSlug = 'simulator-bot-' + user.alias.replace('.', '')
graphQLServer = await axios({
url: window.canvasApp.graphQL.masterAppApiUrl,
method: 'post',
data: {
query:
`
query($fbSlug: String!){
strategizer_TradingSystemByFb(fbSlug: $fbSlug){
id
fbSlug
data
}
}
`,
variables: {
fbSlug: fbSlug
}
},
headers: {
authorization: 'Bearer ' + accessToken
}
})
if (graphQLServer.data.errors) {
logger.write('[ERROR] loadFromStrategyzer -> GraphQL Error: ' + JSON.stringify(graphQLServer.data.errors))
return false
} else {
thisObject.strategizerData = JSON.parse(JSON.stringify(graphQLServer.data.data.strategizer_TradingSystemByFb.data))
thisObject.idAtStrategizer = graphQLServer.data.data.strategizer_TradingSystemByFb.id
window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, thisObject.idAtStrategizer)
return true
}
}
} catch (err) {
logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack)
}
}
}
@@ -1,18 +1,212 @@
function newAttachDetach () {
function newChainAttachDetach () {
thisObject = {
detachNode: detachNode,
attachNode: attachNode
chainDetachNode: chainDetachNode,
chainAttachNode: chainAttachNode
}
return thisObject
function detachNode (node, rootNodes) {
function chainDetachNode (node, rootNodes) {
switch (node.type) {
case 'Definition': {
return
}
case 'Network': {
node.payload.parentNode.network = undefined
return
}
case 'Team': {
return
}
case 'Sensor Bot': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.sensorBots.length; i++) {
let sensorBot = payload.parentNode.sensorBots[i]
if (sensorBot.id === node.id) {
payload.parentNode.sensorBots.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Indicator Bot': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.indicatorBots.length; i++) {
let indicatorBot = payload.parentNode.indicatorBots[i]
if (indicatorBot.id === node.id) {
payload.parentNode.indicatorBots.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Trading Bot': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.tradingBots.length; i++) {
let tradingBot = payload.parentNode.tradingBots[i]
if (tradingBot.id === node.id) {
payload.parentNode.tradingBots.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Process Definition': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.processes.length; i++) {
let process = payload.parentNode.processes[i]
if (process.id === node.id) {
payload.parentNode.processes.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Process Output': {
node.payload.parentNode.processOutput = undefined
completeDetachment(node, rootNodes)
return
}
case 'Process Dependencies': {
node.payload.parentNode.processDependencies = undefined
completeDetachment(node, rootNodes)
return
}
case 'Status Report': {
node.payload.parentNode.statusReport = undefined
completeDetachment(node, rootNodes)
return
}
case 'Execution Started Event': {
node.payload.parentNode.executionStartedEvent = undefined
completeDetachment(node, rootNodes)
return
}
case 'Execution Finished Event': {
node.payload.parentNode.executionFinishedEvent = undefined
completeDetachment(node, rootNodes)
return
}
case 'Calculations Procedure': {
node.payload.parentNode.calculations = undefined
completeDetachment(node, rootNodes)
return
}
case 'Data Building Procedure': {
node.payload.parentNode.dataBuilding = undefined
completeDetachment(node, rootNodes)
return
}
case 'Procedure Initialization': {
node.payload.parentNode.initialization = undefined
completeDetachment(node, rootNodes)
return
}
case 'Procedure Loop': {
node.payload.parentNode.loop = undefined
completeDetachment(node, rootNodes)
return
}
case 'Output Dataset': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.outputDatasets.length; i++) {
let outputDataset = payload.parentNode.outputDatasets[i]
if (outputDataset.id === node.id) {
payload.parentNode.outputDatasets.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Status Dependency': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.statusDependencies.length; i++) {
let statusDependency = payload.parentNode.statusDependencies[i]
if (statusDependency.id === node.id) {
payload.parentNode.statusDependencies.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Data Dependency': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.dataDependencies.length; i++) {
let dataDependency = payload.parentNode.dataDependencies[i]
if (dataDependency.id === node.id) {
payload.parentNode.dataDependencies.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Product Definition': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.products.length; i++) {
let product = payload.parentNode.products[i]
if (product.id === node.id) {
payload.parentNode.products.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Record Definition': {
node.payload.parentNode.record = undefined
completeDetachment(node, rootNodes)
return
}
case 'Record Property': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.properties.length; i++) {
let property = payload.parentNode.properties[i]
if (property.id === node.id) {
payload.parentNode.properties.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Dataset Definition': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.datasets.length; i++) {
let dataset = payload.parentNode.datasets[i]
if (dataset.id === node.id) {
payload.parentNode.datasets.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Plotter': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.plotters.length; i++) {
let plotter = payload.parentNode.plotters[i]
if (plotter.id === node.id) {
payload.parentNode.plotters.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Plotter Module': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.modules.length; i++) {
let module = payload.parentNode.modules[i]
if (module.id === node.id) {
payload.parentNode.modules.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
case 'Plotter Panel': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.panels.length; i++) {
let panel = payload.parentNode.panels[i]
if (panel.id === node.id) {
payload.parentNode.panels.splice(i, 1)
}
}
completeDetachment(node, rootNodes)
return
}
@@ -135,17 +329,17 @@ function newAttachDetach () {
completeDetachment(node, rootNodes)
return
}
case 'Sensor': {
case 'Sensor Bot Instance': {
node.payload.parentNode.bot = undefined
completeDetachment(node, rootNodes)
return
}
case 'Indicator': {
case 'Indicator Bot Instance': {
node.payload.parentNode.bot = undefined
completeDetachment(node, rootNodes)
return
}
case 'Trading Engine': {
case 'Trading Bot Instance': {
node.payload.parentNode.bot = undefined
completeDetachment(node, rootNodes)
return
@@ -170,7 +364,7 @@ function newAttachDetach () {
completeDetachment(node, rootNodes)
return
}
case 'Process': {
case 'Process Instance': {
let payload = node.payload
for (let i = 0; i < payload.parentNode.processes.length; i++) {
let process = payload.parentNode.processes[i]
@@ -358,12 +552,166 @@ function newAttachDetach () {
}
}
function attachNode (node, attachToNode, rootNodes) {
function chainAttachNode (node, attachToNode, rootNodes) {
switch (node.type) {
case 'Network': {
case 'Sensor Bot': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.network = node
node.payload.parentNode.sensorBots.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Indicator Bot': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.indicatorBots.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Trading Bot': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.tradingBots.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Process Definition': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.processes.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Process Output': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.processOutput = node
completeAttachment(node, rootNodes)
}
break
case 'Process Dependencies': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.processDependencies = node
completeAttachment(node, rootNodes)
}
break
case 'Status Report': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.statusReport = node
completeAttachment(node, rootNodes)
}
break
case 'Execution Started Event': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.executionStartedEvent = node
completeAttachment(node, rootNodes)
}
break
case 'Execution Finished Event': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.executionFinishedEvent = node
completeAttachment(node, rootNodes)
}
break
case 'Calculations Procedure': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.calculations = node
completeAttachment(node, rootNodes)
}
break
case 'Data Building Procedure': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.dataBuilding = node
completeAttachment(node, rootNodes)
}
break
case 'Procedure Initialization': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.initialization = node
completeAttachment(node, rootNodes)
}
break
case 'Procedure Loop': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.loop = node
completeAttachment(node, rootNodes)
}
break
case 'Output Dataset': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.outputDatasets.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Status Dependency': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.statusDependencies.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Data Dependency': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.dataDependencies.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Product Definition': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.products.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Record Definition': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.record = node
completeAttachment(node, rootNodes)
}
break
case 'Record Property': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.properties.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Dataset Definition': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.datasets.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Plotter': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.plotters.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Plotter Module': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.modules.push(node)
completeAttachment(node, rootNodes)
}
break
case 'Plotter Panel': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.panels.push(node)
completeAttachment(node, rootNodes)
}
break
@@ -423,28 +771,28 @@ function newAttachDetach () {
completeAttachment(node, rootNodes)
}
break
case 'Sensor': {
case 'Sensor Bot Instance': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.bot = node
completeAttachment(node, rootNodes)
}
break
case 'Indicator': {
case 'Indicator Bot Instance': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.bot = node
completeAttachment(node, rootNodes)
}
break
case 'Trading Engine': {
case 'Trading Bot Instance': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.bot = node
completeAttachment(node, rootNodes)
}
break
case 'Process': {
case 'Process Instance': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.processes.push(node)
@@ -14,6 +14,78 @@ function newNodeChildren () {
case 'Network': {
return countChildrenNetwork(parentNode, childNode)
}
case 'Team': {
return countChildrenTeam(parentNode, childNode)
}
case 'Sensor Bot': {
return countChildrenSensorBot(parentNode, childNode)
}
case 'Indicator Bot': {
return countChildrenIndicatorBot(parentNode, childNode)
}
case 'Trading Bot': {
return countChildrenTradingBot(parentNode, childNode)
}
case 'Process Definition': {
return countChildrenProcessDefinition(parentNode, childNode)
}
case 'Process Output': {
return countChildrenProcessOutput(parentNode, childNode)
}
case 'Process Dependencies': {
return countChildrenProcessDependencies(parentNode, childNode)
}
case 'Status Rerport': {
return countChildrenStatusRerport(parentNode, childNode)
}
case 'Execution Started Event': {
return countChildrenExecutionStartedEvent(parentNode, childNode)
}
case 'Execution Finished Event': {
return countChildrenExecutionFinishedEvent(parentNode, childNode)
}
case 'Calculations Procedure': {
return countChildrenCalculationsProcedure(parentNode, childNode)
}
case 'Data Building Procedure': {
return countChildrenDataBuildingProcedure(parentNode, childNode)
}
case 'Procedure Initialization': {
return countChildrenProcedureInitialization(parentNode, childNode)
}
case 'Procedure Loop': {
return countChildrenProcedureLoop(parentNode, childNode)
}
case 'Output Dataset': {
return countChildrenOutputDataset(parentNode, childNode)
}
case 'Status Dependency': {
return countChildrenStatusDependency(parentNode, childNode)
}
case 'Data Dependency': {
return countChildrenDataDependency(parentNode, childNode)
}
case 'Product Definition': {
return countChildrenProductDefinition(parentNode, childNode)
}
case 'Record Definition': {
return countChildrenRecordDefinition(parentNode, childNode)
}
case 'Record Property': {
return countChildrenRecordProperty(parentNode, childNode)
}
case 'Dataset Definition': {
return countChildrenDatasetDefinition(parentNode, childNode)
}
case 'Plotter': {
return countChildrenPlotter(parentNode, childNode)
}
case 'Plotter Module': {
return countChildrenPlotterModule(parentNode, childNode)
}
case 'Plotter Panel': {
return countChildrenPlotterPanel(parentNode, childNode)
}
case 'Network Node': {
return countChildrenNetworkNode(parentNode, childNode)
}
@@ -38,17 +110,17 @@ function newNodeChildren () {
case 'Task': {
return countChildrenTask(parentNode, childNode)
}
case 'Sensor': {
return countChildrenSensor(parentNode, childNode)
case 'Sensor Bot Instance': {
return countChildrenSensorBotInstance(parentNode, childNode)
}
case 'Indicator': {
return countChildrenIndicator(parentNode, childNode)
case 'Indicator Bot Instance': {
return countChildrenIndicatorBotInstance(parentNode, childNode)
}
case 'Trading Engine': {
return countChildrenTradingEngine(parentNode, childNode)
case 'Trading Bot Instance': {
return countChildrenTradingBotInstance(parentNode, childNode)
}
case 'Process': {
return countChildrenProcess(parentNode, childNode)
case 'Process Instance': {
return countChildrenProcessInstance(parentNode, childNode)
}
case 'Backtesting Session': {
return countBacktestingSession(parentNode, childNode)
@@ -181,12 +253,6 @@ function newNodeChildren () {
response.childIndex = response.childrenCount
}
}
if (parentNode.network !== undefined) {
response.childrenCount++
if (parentNode.network.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
@@ -207,6 +273,456 @@ function newNodeChildren () {
return response
}
function countChildrenTeam (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.sensorBots !== undefined) {
for (let i = 0; i < parentNode.sensorBots.length; i++) {
let child = parentNode.sensorBots[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.indicatorBots !== undefined) {
for (let i = 0; i < parentNode.indicatorBots.length; i++) {
let child = parentNode.indicatorBots[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.tradingBots !== undefined) {
for (let i = 0; i < parentNode.tradingBots.length; i++) {
let child = parentNode.tradingBots[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.plotters !== undefined) {
for (let i = 0; i < parentNode.plotters.length; i++) {
let child = parentNode.plotters[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenSensorBot (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.processes !== undefined) {
for (let i = 0; i < parentNode.processes.length; i++) {
let child = parentNode.processes[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.products !== undefined) {
for (let i = 0; i < parentNode.products.length; i++) {
let child = parentNode.products[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenIndicatorBot (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.processes !== undefined) {
for (let i = 0; i < parentNode.processes.length; i++) {
let child = parentNode.processes[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.products !== undefined) {
for (let i = 0; i < parentNode.products.length; i++) {
let child = parentNode.products[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenTradingBot (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.processes !== undefined) {
for (let i = 0; i < parentNode.processes.length; i++) {
let child = parentNode.processes[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.products !== undefined) {
for (let i = 0; i < parentNode.products.length; i++) {
let child = parentNode.products[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenProcessDefinition (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.processOutput !== undefined) {
response.childrenCount++
if (parentNode.processOutput.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.processDependencies !== undefined) {
response.childrenCount++
if (parentNode.processDependencies.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.statusReport !== undefined) {
response.childrenCount++
if (parentNode.statusReport.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.executionStartedEvent !== undefined) {
response.childrenCount++
if (parentNode.executionStartedEvent.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.executionFinishedEvent !== undefined) {
response.childrenCount++
if (parentNode.executionFinishedEvent.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
function countChildrenProcessOutput (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.outputDatasets !== undefined) {
for (let i = 0; i < parentNode.outputDatasets.length; i++) {
let child = parentNode.outputDatasets[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenProcessDependencies (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.statusDependencies !== undefined) {
for (let i = 0; i < parentNode.statusDependencies.length; i++) {
let child = parentNode.statusDependencies[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.dataDependencies !== undefined) {
for (let i = 0; i < parentNode.dataDependencies.length; i++) {
let child = parentNode.dataDependencies[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenStatusRerport (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenExecutionStartedEvent (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenExecutionFinishedEvent (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenCalculationsProcedure (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.initialization !== undefined) {
response.childrenCount++
if (parentNode.initialization.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.loop !== undefined) {
response.childrenCount++
if (parentNode.loop.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
function countChildrenDataBuildingProcedure (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.initialization !== undefined) {
response.childrenCount++
if (parentNode.initialization.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.loop !== undefined) {
response.childrenCount++
if (parentNode.loop.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
function countChildrenProcedureInitialization (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.code !== undefined) {
response.childrenCount++
if (parentNode.code.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
function countChildrenProcedureLoop (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.code !== undefined) {
response.childrenCount++
if (parentNode.code.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
function countChildrenOutputDataset (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenStatusDependency (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenDataDependency (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenProductDefinition (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.record !== undefined) {
response.childrenCount++
if (parentNode.record.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.datasets !== undefined) {
for (let i = 0; i < parentNode.datasets.length; i++) {
let child = parentNode.datasets[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
if (parentNode.calculations !== undefined) {
response.childrenCount++
if (parentNode.calculations.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.dataBuilding !== undefined) {
response.childrenCount++
if (parentNode.dataBuilding.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
function countChildrenRecordDefinition (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.properties !== undefined) {
for (let i = 0; i < parentNode.properties.length; i++) {
let child = parentNode.properties[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenRecordProperty (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 countChildrenDatasetDefinition (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenPlotter (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.modules !== undefined) {
for (let i = 0; i < parentNode.modules.length; i++) {
let child = parentNode.modules[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenPlotterModule (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.code !== undefined) {
response.childrenCount++
if (parentNode.code.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
if (parentNode.panels !== undefined) {
for (let i = 0; i < parentNode.panels.length; i++) {
let child = parentNode.panels[i]
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
return response
}
function countChildrenPlotterPanel (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
if (parentNode.code !== undefined) {
response.childrenCount++
if (parentNode.code.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
return response
}
function countChildrenNetworkNode (parentNode, childNode) {
let response = {
childrenCount: 0,
@@ -324,7 +840,7 @@ function newNodeChildren () {
return response
}
function countChildrenSensor (parentNode, childNode) {
function countChildrenSensorBotInstance (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
@@ -340,7 +856,7 @@ function newNodeChildren () {
return response
}
function countChildrenIndicator (parentNode, childNode) {
function countChildrenIndicatorBotInstance (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
@@ -356,7 +872,7 @@ function newNodeChildren () {
return response
}
function countChildrenTradingEngine (parentNode, childNode) {
function countChildrenTradingBotInstance (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
@@ -372,7 +888,7 @@ function newNodeChildren () {
return response
}
function countChildrenProcess (parentNode, childNode) {
function countChildrenProcessInstance (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
@@ -546,7 +546,7 @@ function newOnFocus () {
return
}
}
case 'Sensor': {
case 'Sensor Bot Instance': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeThatIsOnFocus(node.processes[m])
@@ -560,7 +560,7 @@ function newOnFocus () {
return
}
}
case 'Indicator': {
case 'Indicator Bot Instance': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeThatIsOnFocus(node.processes[m])
@@ -574,7 +574,7 @@ function newOnFocus () {
return
}
}
case 'Trading Engine': {
case 'Trading Bot Instance': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeThatIsOnFocus(node.processes[m])
@@ -588,7 +588,7 @@ function newOnFocus () {
return
}
}
case 'Process': {
case 'Process Instance': {
let child
child = getNodeThatIsOnFocus(node.session)
if (child !== undefined) {
@@ -723,7 +723,359 @@ function newOnFocus () {
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.network)
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Team': {
let child
for (let m = 0; m < node.sensorBots.length; m++) {
child = getNodeThatIsOnFocus(node.sensorBots[m])
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.indicatorBots.length; m++) {
child = getNodeThatIsOnFocus(node.indicatorBots[m])
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.tradingBots.length; m++) {
child = getNodeThatIsOnFocus(node.tradingBots[m])
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.plotters.length; m++) {
child = getNodeThatIsOnFocus(node.plotters[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Sensor Bot': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeThatIsOnFocus(node.processes[m])
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.products.length; m++) {
child = getNodeThatIsOnFocus(node.products[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Indicator Bot': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeThatIsOnFocus(node.processes[m])
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.products.length; m++) {
child = getNodeThatIsOnFocus(node.products[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Trading Bot': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeThatIsOnFocus(node.processes[m])
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.products.length; m++) {
child = getNodeThatIsOnFocus(node.products[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Process Definition': {
let child
child = getNodeThatIsOnFocus(node.processOutput)
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.processDependencies)
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.statusReport)
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.executionStartedEvent)
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.executionFinishedEvent)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Process Output': {
let child
for (let m = 0; m < node.outputDatasets.length; m++) {
child = getNodeThatIsOnFocus(node.outputDatasets[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Process Dependencies': {
let child
for (let m = 0; m < node.statusDependencies.length; m++) {
child = getNodeThatIsOnFocus(node.statusDependencies[m])
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.dataDependencies.length; m++) {
child = getNodeThatIsOnFocus(node.dataDependencies[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Status Report': {
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Execution Started Event': {
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Execution Finished Event': {
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Calculations Procedure': {
let child
child = getNodeThatIsOnFocus(node.initialization)
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.loop)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Data Building Procedure': {
let child
child = getNodeThatIsOnFocus(node.initialization)
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.loop)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Procedure Initialization': {
let child
child = getNodeThatIsOnFocus(node.code)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Procedure Loop': {
let child
child = getNodeThatIsOnFocus(node.code)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Output Dataset': {
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Status Dependency': {
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Data Dependency': {
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Product Definition': {
let child
child = getNodeThatIsOnFocus(node.record)
if (child !== undefined) {
return child
}
for (let m = 0; m < node.datasets.length; m++) {
child = getNodeThatIsOnFocus(node.datasets[m])
if (child !== undefined) {
return child
}
}
child = getNodeThatIsOnFocus(node.calculations)
if (child !== undefined) {
return child
}
child = getNodeThatIsOnFocus(node.dataBuilding)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Record Definition': {
let child
for (let m = 0; m < node.properties.length; m++) {
child = getNodeThatIsOnFocus(node.properties[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Record Property': {
let child
child = getNodeThatIsOnFocus(node.formula)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Dataset Definition': {
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Plotter': {
let child
for (let m = 0; m < node.modules.length; m++) {
child = getNodeThatIsOnFocus(node.modules[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Plotter Module': {
let child
child = getNodeThatIsOnFocus(node.code)
if (child !== undefined) {
return child
}
for (let m = 0; m < node.panels.length; m++) {
child = getNodeThatIsOnFocus(node.panels[m])
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.isOnFocus === true) {
return node
} else {
return
}
}
case 'Plotter Panel': {
let child
child = getNodeThatIsOnFocus(node.code)
if (child !== undefined) {
return child
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,106 @@
function newReferenceAttachDetach () {
thisObject = {
referenceDetachNode: referenceDetachNode,
referenceAttachNode: referenceAttachNode
}
return thisObject
function referenceDetachNode (node) {
switch (node.type) {
case 'Backtesting Session': {
completeDetachment(node)
return
}
case 'Live Trading Session': {
completeDetachment(node)
return
}
case 'Fordward Testing Session': {
completeDetachment(node)
return
}
case 'Paper Trading Session': {
completeDetachment(node)
return
}
case 'Output Dataset': {
completeDetachment(node)
return
}
case 'Data Dependency': {
completeDetachment(node)
return
}
case 'Status Dependency': {
completeDetachment(node)
return
}
case 'Execution Started Event': {
completeDetachment(node)
return
}
case 'Process Instance': {
completeDetachment(node)
return
}
}
}
function referenceAttachNode (node, attachToNode, rootNodes) {
switch (node.type) {
case 'Backtesting Session': {
completeAttachment(node, attachToNode)
}
break
case 'Live Trading Session': {
completeAttachment(node, attachToNode)
}
break
case 'Fordward Testing Session': {
completeAttachment(node, attachToNode)
}
break
case 'Paper Trading Session': {
completeAttachment(node, attachToNode)
}
break
case 'Output Dataset': {
completeAttachment(node, attachToNode)
}
break
case 'Data Dependency': {
completeAttachment(node, attachToNode)
}
break
case 'Status Dependency': {
completeAttachment(node, attachToNode)
}
break
case 'Execution Started Event': {
completeAttachment(node, attachToNode)
}
break
case 'Process Instance': {
completeAttachment(node, attachToNode)
}
break
}
}
function completeAttachment (node, attachToNode) {
node.payload.referenceParent = attachToNode
attachToNode.referenceChildren.push(node)
}
function completeDetachment (node) {
for (let i = 0; i < node.payload.referenceParent.referenceChildren.length; i++) {
let child = node.payload.referenceParent.referenceChildren[i]
if (child.id === node.id) {
node.payload.referenceParent.referenceChildren.splice(i, 1)
return
}
}
node.payload.referenceParent = undefined
}
}
@@ -9,11 +9,19 @@ function newSessionFunctions () {
function runSession (node, functionLibraryProtocolNode, callBackFunction) {
/* We can not run a sessionif its parent process is not running. Less if it does not have a parent. */
if (node.payload.parentNode === undefined) {
node.payload.uiObject.setErrorMessage('Session needs a Process Instance parent to be able to run.')
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
return
}
if (node.payload.parentNode.payload.uiObject.isRunning !== true) {
node.payload.uiObject.setErrorMessage('Session needs a Process Instance parent to be running to be able to run.')
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
return
}
if (node.payload.referenceParent === undefined) {
node.payload.uiObject.setErrorMessage('Parent Process Instance need to reference a Process Definition.')
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
return
}
@@ -22,8 +30,7 @@ function newSessionFunctions () {
let key = node.name + '-' + node.type + '-' + node.id
let thisNodeDefinition = getDefinition(node)
if (thisNodeDefinition === undefined) { return }
let thisNodeDefinition = node.payload.referenceParent
/* Raise event to run the session */
let event = {
@@ -34,18 +41,6 @@ function newSessionFunctions () {
systemEventHandler.raiseEvent(key, 'Run Session', event)
function getDefinition (node) {
if (node.type === 'Definition') {
return node
}
if (node.payload.parentNode !== undefined) {
return getDefinition(node.payload.parentNode)
} else {
return
}
}
function getUICurrentValues () {
let dateAtScreenCorner = new Date(window.localStorage.getItem('Date @ Screen Corner'))
let currentTimePeriod = JSON.parse(window.localStorage.getItem('Current Time Period'))
@@ -547,7 +547,7 @@ function newShortcutKeys () {
return
}
}
case 'Sensor': {
case 'Sensor Bot Instance': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeByShortcutKey(node.processes[m], searchingKey)
@@ -561,7 +561,7 @@ function newShortcutKeys () {
return
}
}
case 'Indicator': {
case 'Indicator Bot Instance': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeByShortcutKey(node.processes[m], searchingKey)
@@ -575,7 +575,7 @@ function newShortcutKeys () {
return
}
}
case 'Trading Engine': {
case 'Trading Bot Instance': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeByShortcutKey(node.processes[m], searchingKey)
@@ -589,7 +589,7 @@ function newShortcutKeys () {
return
}
}
case 'Process': {
case 'Process Instance': {
let child
child = getNodeByShortcutKey(node.session, searchingKey)
if (child !== undefined) {
@@ -708,7 +708,123 @@ function newShortcutKeys () {
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.network, searchingKey)
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Team': {
let child
for (let m = 0; m < node.sensorBots.length; m++) {
child = getNodeByShortcutKey(node.sensorBots[m], searchingKey)
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.indicatorBots.length; m++) {
child = getNodeByShortcutKey(node.indicatorBots[m], searchingKey)
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.tradingBots.length; m++) {
child = getNodeByShortcutKey(node.tradingBots[m], searchingKey)
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.plotters.length; m++) {
child = getNodeByShortcutKey(node.plotters[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Sensor Bot': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeByShortcutKey(node.processes[m], searchingKey)
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.products.length; m++) {
child = getNodeByShortcutKey(node.products[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Indicator Bot': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeByShortcutKey(node.processes[m], searchingKey)
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.products.length; m++) {
child = getNodeByShortcutKey(node.products[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Trading Bot': {
let child
for (let m = 0; m < node.processes.length; m++) {
child = getNodeByShortcutKey(node.processes[m], searchingKey)
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.products.length; m++) {
child = getNodeByShortcutKey(node.products[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Process Definition': {
let child
child = getNodeByShortcutKey(node.processOutput, searchingKey)
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.processDependencies, searchingKey)
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.statusReport, searchingKey)
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.executionStartedEvent, searchingKey)
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.executionFinishedEvent, searchingKey)
if (child !== undefined) {
return child
}
@@ -718,6 +834,235 @@ function newShortcutKeys () {
return
}
}
case 'Process Output': {
let child
for (let m = 0; m < node.outputDatasets.length; m++) {
child = getNodeByShortcutKey(node.outputDatasets[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Process Dependencies': {
let child
for (let m = 0; m < node.statusDependencies.length; m++) {
child = getNodeByShortcutKey(node.statusDependencies[m], searchingKey)
if (child !== undefined) {
return child
}
}
for (let m = 0; m < node.dataDependencies.length; m++) {
child = getNodeByShortcutKey(node.dataDependencies[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Status Report': {
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Execution Finished Procedure': {
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Calculations Procedure': {
let child
child = getNodeByShortcutKey(node.initialization, searchingKey)
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.loop, searchingKey)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Data Building Procedure': {
let child
child = getNodeByShortcutKey(node.initialization, searchingKey)
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.loop, searchingKey)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Procedure Initialization': {
let child
child = getNodeByShortcutKey(node.code, searchingKey)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Procedure Loop': {
let child
child = getNodeByShortcutKey(node.code, searchingKey)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Output Dataset': {
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Status Dependency': {
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Data Dependency': {
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Product Definition': {
let child
child = getNodeByShortcutKey(node.record, searchingKey)
if (child !== undefined) {
return child
}
for (let m = 0; m < node.datasets.length; m++) {
child = getNodeByShortcutKey(node.datasets[m], searchingKey)
if (child !== undefined) {
return child
}
}
child = getNodeByShortcutKey(node.calculations, searchingKey)
if (child !== undefined) {
return child
}
child = getNodeByShortcutKey(node.dataBuilding, searchingKey)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Record Definition': {
let child
for (let m = 0; m < node.properties.length; m++) {
child = getNodeByShortcutKey(node.properties[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Record Property': {
let child
child = getNodeByShortcutKey(node.formula, searchingKey)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Dataset Definition': {
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Plotter': {
let child
for (let m = 0; m < node.modules.length; m++) {
child = getNodeByShortcutKey(node.modules[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Plotter Module': {
let child
child = getNodeByShortcutKey(node.code, searchingKey)
if (child !== undefined) {
return child
}
for (let m = 0; m < node.panels.length; m++) {
child = getNodeByShortcutKey(node.panels[m], searchingKey)
if (child !== undefined) {
return child
}
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
case 'Plotter Panel': {
let child
child = getNodeByShortcutKey(node.code, searchingKey)
if (child !== undefined) {
return child
}
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
} else {
return
}
}
}
}
}
@@ -24,13 +24,19 @@ function newTaskFunctions () {
process.payload.uiObject.run()
}
node.payload.uiObject.run(callBackFunction)
let event = {
taskId: node.id,
taskName: node.name,
definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager.
definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, true, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager.
}
if (node.payload.parentNode === undefined) {
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
systemEventHandler.raiseEvent('Task Server', 'Debug Task Started', event)
return
}
node.payload.uiObject.run(callBackFunction)
systemEventHandler.raiseEvent('Task Manager', 'Run Task', event)
}
File diff suppressed because it is too large. Load diff
@@ -13,13 +13,15 @@ function newWorkspace () {
nodeChildren: undefined,
getNodeThatIsOnFocus: getNodeThatIsOnFocus,
getNodeByShortcutKey: getNodeByShortcutKey,
getAllTradingEngines: getAllTradingEngines,
getAllTradingBotInstances: getAllTradingBotInstances,
stopAllRunningTasks: stopAllRunningTasks,
onMenuItemClick: onMenuItemClick,
physics: physics,
spawn: spawn,
detachNode: detachNode,
attachNode: attachNode,
chainDetachNode: chainDetachNode,
chainAttachNode: chainAttachNode,
referenceDetachNode: referenceDetachNode,
referenceAttachNode: referenceAttachNode,
initialize: initialize,
finalize: finalize
}
@@ -44,9 +46,10 @@ function newWorkspace () {
thisObject.workspaceNode = {}
thisObject.workspaceNode.rootNodes = []
let functionLibraryAttachDetach = newAttachDetach()
let functionLibraryReferenceAttachDetach = newReferenceAttachDetach()
let functionLibraryChainAttachDetach = newChainAttachDetach()
let functionLibraryNodeDeleter = newNodeDeleter()
let functionLibraryPartsFromNodes = newPartsFromNodes()
let functionLibraryUiObjectsFromNodes = newUiObjectsFromNodes()
let functionLibraryProtocolNode = newProtocolNode()
let functionLibraryTaskFunctions = newTaskFunctions()
let functionLibrarySessionFunctions = newSessionFunctions()
@@ -78,16 +81,12 @@ function newWorkspace () {
if (savedWorkspace === null || idAtStrategizer === null) {
thisObject.workspaceNode.type = 'Workspace'
thisObject.workspaceNode.name = 'My Workspace'
functionLibraryPartsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined)
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined)
spawnPosition.y = spawnPosition.y + 250
initializeLoadingFromStrategizer()
} else {
thisObject.workspaceNode = JSON.parse(savedWorkspace)
functionLibraryPartsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined)
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined)
}
functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode)
thisObject.enabled = true
}
} catch (err) {
@@ -96,22 +95,30 @@ function newWorkspace () {
}
async function initializeLoadingFromStrategizer () {
let result = await canvas.strategySpace.strategizerGateway.loadFromStrategyzer()
let result = await canvas.designerSpace.strategizerGateway.loadFromStrategyzer()
if (result === true) {
thisObject.definition = canvas.strategySpace.strategizerGateway.strategizerData
thisObject.definition = canvas.designerSpace.strategizerGateway.strategizerData
thisObject.workspaceNode.rootNodes.push(thisObject.definition)
functionLibraryPartsFromNodes.createPartFromNode(thisObject.definition, undefined, undefined)
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.definition, undefined, undefined)
thisObject.enabled = true
}
}
function detachNode (node) {
functionLibraryAttachDetach.detachNode(node, thisObject.workspaceNode.rootNodes)
function chainDetachNode (node) {
functionLibraryChainAttachDetach.chainDetachNode(node, thisObject.workspaceNode.rootNodes)
}
function attachNode (node, attachToNode) {
functionLibraryAttachDetach.attachNode(node, attachToNode, thisObject.workspaceNode.rootNodes)
function chainAttachNode (node, attachToNode) {
functionLibraryChainAttachDetach.chainAttachNode(node, attachToNode, thisObject.workspaceNode.rootNodes)
}
function referenceDetachNode (node) {
functionLibraryReferenceAttachDetach.referenceDetachNode(node)
}
function referenceAttachNode (node, attachToNode) {
functionLibraryReferenceAttachDetach.referenceAttachNode(node, attachToNode, thisObject.workspaceNode.rootNodes)
}
function physics () {
@@ -131,7 +138,7 @@ function newWorkspace () {
let stringifyReadyNodes = []
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true)
let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true)
if (node) {
stringifyReadyNodes.push(node)
}
@@ -148,16 +155,13 @@ function newWorkspace () {
function stopAllRunningTasks () {
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
if (rootNode.type === 'Definition') {
let definition = rootNode
if (definition.network !== undefined) {
if (definition.network.networkNodes !== undefined) {
for (let j = 0; j < definition.network.networkNodes.length; j++) {
let networkNode = definition.network.networkNodes[j]
for (let i = 0; i < networkNode.taskManagers.length; i++) {
let taskManager = networkNode.taskManagers[i]
taskManager.payload.uiObject.menu.internalClick('Stop All Tasks')
}
if (rootNode.type === 'Network') {
if (rootNode.networkNodes !== undefined) {
for (let j = 0; j < rootNode.networkNodes.length; j++) {
let networkNode = rootNode.networkNodes[j]
for (let i = 0; i < networkNode.taskManagers.length; i++) {
let taskManager = networkNode.taskManagers[i]
taskManager.payload.uiObject.menu.internalClick('Stop All Tasks')
}
}
}
@@ -165,23 +169,20 @@ function newWorkspace () {
}
}
function getAllTradingEngines () {
let tradingEngines = []
function getAllTradingBotInstances () {
let tradingBotInstances = []
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
if (rootNode.type === 'Definition') {
let definition = rootNode
if (definition.network !== undefined) {
if (definition.network.networkNodes !== undefined) {
for (let j = 0; j < definition.network.networkNodes.length; j++) {
let networkNode = definition.network.networkNodes[j]
for (let i = 0; i < networkNode.taskManagers.length; i++) {
let taskManager = networkNode.taskManagers[i]
for (k = 0; k < taskManager.tasks.length; k++) {
let task = taskManager.tasks[k]
if (task.bot.type === 'Trading Engine') {
tradingEngines.push(task.bot)
}
if (rootNode.type === 'Network') {
if (rootNode.networkNodes !== undefined) {
for (let j = 0; j < rootNode.networkNodes.length; j++) {
let networkNode = rootNode.networkNodes[j]
for (let i = 0; i < networkNode.taskManagers.length; i++) {
let taskManager = networkNode.taskManagers[i]
for (k = 0; k < taskManager.tasks.length; k++) {
let task = taskManager.tasks[k]
if (task.bot.type === 'Trading Bot Instance') {
tradingBotInstances.push(task.bot)
}
}
}
@@ -189,28 +190,24 @@ function newWorkspace () {
}
}
}
return tradingEngines
return tradingBotInstances
}
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 }
}
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 }
}
let definition = rootNode
let node = functionLibraryOnFocus.getNodeThatIsOnFocus(rootNode)
if (node !== undefined) { return node }
}
}
@@ -226,16 +223,40 @@ function newWorkspace () {
stopAllRunningTasks()
functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes)
thisObject.workspaceNode = droppedNode
functionLibraryPartsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined)
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined)
}
functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode)
return
} else {
let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode)
thisObject.workspaceNode.rootNodes.push(rootNode)
functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined)
if (
droppedNode.type === 'Definition' ||
droppedNode.type === 'Network' ||
droppedNode.type === 'Team'
) {
/* We will only respect the state of each object on these structures, if the structure does not yet exist inside the workspace */
let alreadyExists = false
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
if (droppedNode.id === rootNode.id) {
alreadyExists = true
}
}
if (alreadyExists === false) {
/* It does not exist, so we recreeate it respecting the inner state of each object. */
let positionOffset = {
x: spawnPosition.x - droppedNode.savedPayload.targetPosition.x,
y: spawnPosition.y - droppedNode.savedPayload.targetPosition.y
}
thisObject.workspaceNode.rootNodes.push(droppedNode)
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(droppedNode, undefined, undefined, positionOffset)
return
}
}
}
/* This is the default behaviour, which consists of cleaning all nodes that are not supported and then creating the UIObjects that remains on the data structure. */
let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode)
thisObject.workspaceNode.rootNodes.push(rootNode)
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined)
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] spawn -> err = ' + err.stack) }
}
@@ -262,7 +283,17 @@ function newWorkspace () {
break
case 'Share':
{
let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true))
let text
if (
payload.node.type === 'Definition' ||
payload.node.type === 'Network' ||
payload.node.type === 'Team'
) {
text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true, false, true, true, true))
} else {
text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true))
}
let nodeName = payload.node.name
if (nodeName === undefined) {
nodeName = ''
@@ -276,7 +307,17 @@ function newWorkspace () {
break
case 'Backup':
{
let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false))
let text
if (
payload.node.type === 'Definition' ||
payload.node.type === 'Network' ||
payload.node.type === 'Team'
) {
text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true))
} else {
text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false))
}
let nodeName = payload.node.name
if (nodeName === undefined) {
nodeName = ''
@@ -320,194 +361,420 @@ function newWorkspace () {
break
case 'Add Definition':
{
functionLibraryPartsFromNodes.addDefinition(payload.node)
functionLibraryUiObjectsFromNodes.addDefinition(payload.node)
}
break
case 'Add Team':
{
functionLibraryUiObjectsFromNodes.addTeam(payload.node)
}
break
case 'Add Sensor Bot':
{
functionLibraryUiObjectsFromNodes.addSensorBot(payload.node)
}
break
case 'Add Indicator Bot':
{
functionLibraryUiObjectsFromNodes.addIndicatorBot(payload.node)
}
break
case 'Add Trading Bot':
{
functionLibraryUiObjectsFromNodes.addTradingBot(payload.node)
}
break
case 'Add Process Definition':
{
functionLibraryUiObjectsFromNodes.addProcessDefinition(payload.node)
}
break
case 'Add Missing Process Definition Items':
{
functionLibraryUiObjectsFromNodes.addMissingProcessDefinitionItems(payload.node)
}
break
case 'Add Missing Product Definition Items':
{
functionLibraryUiObjectsFromNodes.addMissingProductDefinitionItems(payload.node)
}
break
case 'Add Process Output':
{
functionLibraryUiObjectsFromNodes.addProcessOutput(payload.node)
}
break
case 'Add Process Dependencies':
{
functionLibraryUiObjectsFromNodes.addProcessDependencies(payload.node)
}
break
case 'Add Status Report':
{
functionLibraryUiObjectsFromNodes.addStatusReport(payload.node)
}
break
case 'Add Execution Started Event':
{
functionLibraryUiObjectsFromNodes.addExecutionStartedEvent(payload.node)
}
break
case 'Add Execution Finished Event':
{
functionLibraryUiObjectsFromNodes.addExecutionFinishedEvent(payload.node)
}
break
case 'Add Calculations Procedure':
{
functionLibraryUiObjectsFromNodes.addCalculationsProcedure(payload.node)
}
break
case 'Add Data Building Procedure':
{
functionLibraryUiObjectsFromNodes.addDataBuildingProcedure(payload.node)
}
break
case 'Add Procedure Initialization':
{
functionLibraryUiObjectsFromNodes.addProcedureInitialization(payload.node)
}
break
case 'Add Procedure Loop':
{
functionLibraryUiObjectsFromNodes.addProcedureLoop(payload.node)
}
break
case 'Add Output Dataset':
{
functionLibraryUiObjectsFromNodes.addOutputDataset(payload.node)
}
break
case 'Add Status Dependency':
{
functionLibraryUiObjectsFromNodes.addStatusDependency(payload.node)
}
break
case 'Add Data Dependency':
{
functionLibraryUiObjectsFromNodes.addDataDependency(payload.node)
}
break
case 'Add Product Definition':
{
functionLibraryUiObjectsFromNodes.addProductDefinition(payload.node)
}
break
case 'Add Record Definition':
{
functionLibraryUiObjectsFromNodes.addRecordDefinition(payload.node)
}
break
case 'Add Record Property':
{
functionLibraryUiObjectsFromNodes.addRecordProperty(payload.node)
}
break
case 'Add Dataset Definition':
{
functionLibraryUiObjectsFromNodes.addDatasetDefinition(payload.node)
}
break
case 'Add Plotter':
{
functionLibraryUiObjectsFromNodes.addPlotter(payload.node)
}
break
case 'Add Plotter Module':
{
functionLibraryUiObjectsFromNodes.addPlotterModule(payload.node)
}
break
case 'Add Plotter Panel':
{
functionLibraryUiObjectsFromNodes.addPlotterPanel(payload.node)
}
break
case 'Add Network':
{
functionLibraryPartsFromNodes.addNetwork(payload.node)
functionLibraryUiObjectsFromNodes.addNetwork(payload.node)
}
break
case 'Add Network Node':
{
functionLibraryPartsFromNodes.addNetworkNode(payload.node)
functionLibraryUiObjectsFromNodes.addNetworkNode(payload.node)
}
break
case 'Add Social Bots':
{
functionLibraryPartsFromNodes.addSocialBots(payload.node)
functionLibraryUiObjectsFromNodes.addSocialBots(payload.node)
}
break
case 'Add Telegram Bot':
{
functionLibraryPartsFromNodes.addTelegramBot(payload.node)
functionLibraryUiObjectsFromNodes.addTelegramBot(payload.node)
}
break
case 'Add Announcement':
{
functionLibraryPartsFromNodes.addAnnouncement(payload.node)
functionLibraryUiObjectsFromNodes.addAnnouncement(payload.node)
}
break
case 'Add Layer Manager':
{
functionLibraryPartsFromNodes.addLayerManager(payload.node)
functionLibraryUiObjectsFromNodes.addLayerManager(payload.node)
}
break
case 'Add Layer':
{
functionLibraryPartsFromNodes.addLayer(payload.node)
functionLibraryUiObjectsFromNodes.addLayer(payload.node)
}
break
case 'Add Task Manager':
{
functionLibraryPartsFromNodes.addTaskManager(payload.node)
functionLibraryUiObjectsFromNodes.addTaskManager(payload.node)
}
break
case 'Add Task':
{
functionLibraryPartsFromNodes.addTask(payload.node)
functionLibraryUiObjectsFromNodes.addTask(payload.node)
}
break
case 'Add Sensor':
case 'Add Sensor Bot Instance':
{
functionLibraryPartsFromNodes.addSensor(payload.node)
functionLibraryUiObjectsFromNodes.addSensorBotInstance(payload.node)
}
break
case 'Add Indicator':
case 'Add Indicator Bot Instance':
{
functionLibraryPartsFromNodes.addIndicator(payload.node)
functionLibraryUiObjectsFromNodes.addIndicatorBotInstance(payload.node)
}
break
case 'Add Trading Engine':
case 'Add Trading Bot Instance':
{
functionLibraryPartsFromNodes.addTradingEngine(payload.node)
functionLibraryUiObjectsFromNodes.addTradingBotInstance(payload.node)
}
break
case 'Add Process':
case 'Add Process Instance':
{
functionLibraryPartsFromNodes.addProcess(payload.node)
functionLibraryUiObjectsFromNodes.addProcessInstance(payload.node)
}
break
case 'Add Backtesting Session':
{
functionLibraryPartsFromNodes.addBacktestingSession(payload.node)
functionLibraryUiObjectsFromNodes.addBacktestingSession(payload.node)
}
break
case 'Add Live Trading Session':
{
functionLibraryPartsFromNodes.addLiveTradingSession(payload.node)
functionLibraryUiObjectsFromNodes.addLiveTradingSession(payload.node)
}
break
case 'Add Fordward Testing Session':
{
functionLibraryPartsFromNodes.addFordwardTestingSession(payload.node)
functionLibraryUiObjectsFromNodes.addFordwardTestingSession(payload.node)
}
break
case 'Add Paper Trading Session':
{
functionLibraryPartsFromNodes.addPaperTradingSession(payload.node)
functionLibraryUiObjectsFromNodes.addPaperTradingSession(payload.node)
}
break
case 'Add Strategy':
{
functionLibraryPartsFromNodes.addStrategy(payload.node)
functionLibraryUiObjectsFromNodes.addStrategy(payload.node)
}
break
case 'Add Parameters':
{
functionLibraryPartsFromNodes.addParameters(payload.node)
functionLibraryUiObjectsFromNodes.addParameters(payload.node)
}
break
case 'Add Missing Parameters':
{
functionLibraryPartsFromNodes.addMissingParameters(payload.node)
functionLibraryUiObjectsFromNodes.addMissingParameters(payload.node)
}
break
case 'Add Missing Stages':
{
functionLibraryPartsFromNodes.addMissingStages(payload.node)
functionLibraryUiObjectsFromNodes.addMissingStages(payload.node)
}
break
case 'Add Missing Events':
{
functionLibraryPartsFromNodes.addMissingEvents(payload.node)
functionLibraryUiObjectsFromNodes.addMissingEvents(payload.node)
}
break
case 'Add Missing Items':
{
functionLibraryPartsFromNodes.addMissingItems(payload.node)
functionLibraryUiObjectsFromNodes.addMissingItems(payload.node)
}
break
case 'Add Initial Definition':
{
functionLibraryPartsFromNodes.addInitialDefinition(payload.node)
functionLibraryUiObjectsFromNodes.addInitialDefinition(payload.node)
}
break
case 'Add Open Execution':
{
functionLibraryPartsFromNodes.addOpenExecution(payload.node)
functionLibraryUiObjectsFromNodes.addOpenExecution(payload.node)
}
break
case 'Add Close Execution':
{
functionLibraryPartsFromNodes.addCloseExecution(payload.node)
functionLibraryUiObjectsFromNodes.addCloseExecution(payload.node)
}
break
case 'Add Phase':
{
functionLibraryPartsFromNodes.addPhase(payload.node)
functionLibraryUiObjectsFromNodes.addPhase(payload.node)
}
break
case 'Add Formula':
{
functionLibraryPartsFromNodes.addFormula(payload.node)
functionLibraryUiObjectsFromNodes.addFormula(payload.node)
}
break
case 'Add Next Phase Event':
{
functionLibraryPartsFromNodes.addNextPhaseEvent(payload.node)
functionLibraryUiObjectsFromNodes.addNextPhaseEvent(payload.node)
}
break
case 'Add Situation':
{
functionLibraryPartsFromNodes.addSituation(payload.node)
functionLibraryUiObjectsFromNodes.addSituation(payload.node)
}
break
case 'Add Condition':
{
functionLibraryPartsFromNodes.addCondition(payload.node)
functionLibraryUiObjectsFromNodes.addCondition(payload.node)
}
break
case 'Add Code':
{
functionLibraryPartsFromNodes.addCode(payload.node)
functionLibraryUiObjectsFromNodes.addCode(payload.node)
}
break
case 'Add Exchange Account':
{
functionLibraryPartsFromNodes.addExchangeAccount(payload.node)
functionLibraryUiObjectsFromNodes.addExchangeAccount(payload.node)
}
break
case 'Add Exchange Account Asset':
{
functionLibraryPartsFromNodes.addExchangeAccountAsset(payload.node)
functionLibraryUiObjectsFromNodes.addExchangeAccountAsset(payload.node)
}
break
case 'Add Exchange Account Key':
{
functionLibraryPartsFromNodes.addExchangeAccountKey(payload.node)
functionLibraryUiObjectsFromNodes.addExchangeAccountKey(payload.node)
}
break
case 'Add Trading System':
{
functionLibraryPartsFromNodes.addTradingSystem(payload.node)
functionLibraryUiObjectsFromNodes.addTradingSystem(payload.node)
}
break
case 'Add Personal Data':
{
functionLibraryPartsFromNodes.addPersonalData(payload.node)
functionLibraryUiObjectsFromNodes.addPersonalData(payload.node)
}
break
case 'Delete Team': {
functionLibraryNodeDeleter.deleteTeam(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Sensor Bot': {
functionLibraryNodeDeleter.deleteSensorBot(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Indicator Bot': {
functionLibraryNodeDeleter.deleteIndicatorBot(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Trading Bot': {
functionLibraryNodeDeleter.deleteTradingBot(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Process Definition': {
functionLibraryNodeDeleter.deleteProcessDefinition(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Process Output': {
functionLibraryNodeDeleter.deleteProcessOutput(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Process Dependencies': {
functionLibraryNodeDeleter.deleteProcessDependencies(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Status Report': {
functionLibraryNodeDeleter.deleteStatusReport(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Execution Started Event': {
functionLibraryNodeDeleter.deleteExecutionStartedEvent(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Execution Finished Event': {
functionLibraryNodeDeleter.deleteExecutionFinishedEvent(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Calculations Procedure': {
functionLibraryNodeDeleter.deleteCalculationsProcedure(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Data Building Procedure': {
functionLibraryNodeDeleter.deleteDataBuildingProcedure(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Procedure Initialization': {
functionLibraryNodeDeleter.deleteProcedureInitialization(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Procedure Loop': {
functionLibraryNodeDeleter.deleteProcedureLoop(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Output Dataset': {
functionLibraryNodeDeleter.deleteOutputDataset(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Status Dependency': {
functionLibraryNodeDeleter.deleteStatusDependency(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Data Dependency': {
functionLibraryNodeDeleter.deleteDataDependency(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Product Definition': {
functionLibraryNodeDeleter.deleteProductDefinition(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Record Definition': {
functionLibraryNodeDeleter.deleteRecordDefinition(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Record Property': {
functionLibraryNodeDeleter.deleteRecordProperty(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Dataset Definition': {
functionLibraryNodeDeleter.deleteDatasetDefinition(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Plotter': {
functionLibraryNodeDeleter.deletePlotter(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Plotter Module': {
functionLibraryNodeDeleter.deletePlotterModule(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Plotter Panel': {
functionLibraryNodeDeleter.deletePlotterPanel(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Network': {
functionLibraryNodeDeleter.deleteNetwork(payload.node, thisObject.workspaceNode.rootNodes)
break
@@ -544,20 +811,20 @@ function newWorkspace () {
functionLibraryNodeDeleter.deleteTask(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Sensor': {
functionLibraryNodeDeleter.deleteSensor(payload.node, thisObject.workspaceNode.rootNodes)
case 'Delete Sensor Bot Instance': {
functionLibraryNodeDeleter.deleteSensorBotInstance(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Indicator': {
functionLibraryNodeDeleter.deleteIndicator(payload.node, thisObject.workspaceNode.rootNodes)
case 'Delete Indicator Bot Instance': {
functionLibraryNodeDeleter.deleteIndicatorBotInstance(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Trading Engine': {
functionLibraryNodeDeleter.deleteTradingEngine(payload.node, thisObject.workspaceNode.rootNodes)
case 'Delete Trading Bot Instance': {
functionLibraryNodeDeleter.deleteTradingBotInstance(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Process': {
functionLibraryNodeDeleter.deleteProcess(payload.node, thisObject.workspaceNode.rootNodes)
case 'Delete Process Instance': {
functionLibraryNodeDeleter.deleteProcessInstance(payload.node, thisObject.workspaceNode.rootNodes)
break
}
case 'Delete Backtesting Session': {
+1 -1
View File
@@ -72,7 +72,7 @@ function newCircularMenu () {
menuItem.currentRadius = menuItemInitialValue.currentRadius
menuItem.angle = menuItemInitialValue.angle
menuItem.currentStatus = menuItemInitialValue.currentStatus
menuItem.relatedStrategyPart = menuItemInitialValue.relatedStrategyPart
menuItem.relatedUiObject = menuItemInitialValue.relatedUiObject
menuItem.dontShowAtFullscreen = menuItemInitialValue.dontShowAtFullscreen
menuItem.askConfirmation = menuItemInitialValue.askConfirmation
menuItem.confirmationLabel = menuItemInitialValue.confirmationLabel
+13 -11
View File
@@ -33,7 +33,7 @@ function newCircularMenuItem () {
angle: undefined,
container: undefined,
payload: undefined,
relatedStrategyPart: undefined,
relatedUiObject: undefined,
dontShowAtFullscreen: undefined,
internalClick: internalClick,
physics: physics,
@@ -105,7 +105,7 @@ function newCircularMenuItem () {
selfMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
if (thisObject.type === 'Icon & Text') {
thisObject.container.frame.width = 150
thisObject.container.frame.width = 185
} else {
thisObject.container.frame.width = 50
}
@@ -167,15 +167,15 @@ function newCircularMenuItem () {
temporaryStatus === STATUS_SECONDARY_WORK_FAILED
) && thisObject.secondaryAction !== undefined
) {
thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon)
thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon)
thisObject.iconOn = canvas.designerSpace.iconCollection.get(thisObject.secondaryIcon)
thisObject.iconOff = canvas.designerSpace.iconCollection.get(thisObject.secondaryIcon)
} else {
if (thisObject.relatedStrategyPart !== undefined) {
thisObject.iconOn = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
thisObject.iconOff = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart)
if (thisObject.relatedUiObject !== undefined) {
thisObject.iconOn = canvas.designerSpace.iconByUiObjectType.get(thisObject.relatedUiObject)
thisObject.iconOff = canvas.designerSpace.iconByUiObjectType.get(thisObject.relatedUiObject)
} else {
thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.iconPathOn)
thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.iconPathOff)
thisObject.iconOn = canvas.designerSpace.iconCollection.get(thisObject.iconPathOn)
thisObject.iconOff = canvas.designerSpace.iconCollection.get(thisObject.iconPathOff)
}
}
@@ -328,7 +328,8 @@ function newCircularMenuItem () {
container: thisObject.container,
borderColor: UI_COLOR.DARK,
backgroundColor: backgroundColorToUse,
castShadow: false
castShadow: false,
xOffset: 40
}
if (isMouseOver === true) {
@@ -374,7 +375,7 @@ function newCircularMenuItem () {
if (thisObject.currentRadius >= thisObject.targetRadius) {
labelPoint = {
x: menuPosition.x + thisObject.currentRadius + 10,
x: menuPosition.x + thisObject.currentRadius + 20,
y: menuPosition.y + fontSize * FONT_ASPECT_RATIO
}
@@ -386,3 +387,4 @@ function newCircularMenuItem () {
}
}
}
+2 -1
View File
@@ -28,7 +28,8 @@ function newCircularProgressBar () {
return thisObject
function finalize () {
systemEventHandler.stopListening('Jason-Heartbeat-Period', eventSubscriptionHeartbeat)
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
systemEventHandler.stopListening(key, eventSubscriptionHeartbeat)
thisObject.container = undefined
thisObject.payload = undefined
+3 -3
View File
@@ -128,8 +128,8 @@ function newCodeEditor () {
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
thisObject.container.frame.width = thisObject.container.frame.radius * 1.8
thisObject.container.frame.height = thisObject.container.frame.radius * 1
thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 * 2
thisObject.container.frame.height = thisObject.container.frame.radius * 1 * 2
let textAreaPosition = {
x: 0 - thisObject.container.frame.width / 2,
@@ -161,7 +161,7 @@ function newCodeEditor () {
position = thisObject.container.frame.frameThisPoint(position)
let radius = thisObject.container.frame.radius
let radius = thisObject.container.frame.radius * 2
if (radius > 0.5) {
browserCanvasContext.beginPath()
+5 -5
View File
@@ -10,7 +10,7 @@
2. Notes: Notes are a rectangular area where some text is posted. It has a subject and a body.
3. Strategy Parts: These are small balls that represent parts of an strategy.
3. UI Objects: These are small balls that represent parts of an strategy.
*/
function newFloatingLayer () {
@@ -203,7 +203,7 @@ function newFloatingLayer () {
for (let i = 0; i < invisibleFloatingObjects.length; i++) {
let floatingObject = invisibleFloatingObjects[i]
if (floatingObject.isFrozen === false) {
if (floatingObject.isFrozen === false && floatingObject.isParentCollapsed === false) {
visibleFloatingObjects.push(floatingObject)
invisibleFloatingObjects.splice(i, 1) // Delete item from array.
return // Only one at the time.
@@ -215,7 +215,7 @@ function newFloatingLayer () {
for (let i = 0; i < visibleFloatingObjects.length; i++) {
let floatingObject = visibleFloatingObjects[i]
if (floatingObject.isFrozen === true) {
if (floatingObject.isFrozen === true || floatingObject.isParentCollapsed === true) {
invisibleFloatingObjects.push(floatingObject)
visibleFloatingObjects.splice(i, 1) // Delete item from array.
return // Only one at the time.
@@ -293,7 +293,7 @@ function newFloatingLayer () {
break
}
case 'Strategy Part': {
case 'UI Object': {
payload.targetPosition = floatingObject.payload.targetPosition
payload.visible = floatingObject.payload.visible
break
@@ -563,7 +563,7 @@ function newFloatingLayer () {
payload.targetPosition = floatingObject2.payload.notes[floatingObject2.payloadNoteIndex].position
break
}
case 'Strategy Part': {
case 'UI Object': {
payload.targetPosition = floatingObject2.payload.targetPosition
break
}
+2 -2
View File
@@ -186,7 +186,7 @@ function newFloatingObject () {
function frozenPhysics () {
if (thisObject.frozenManually === false) {
let parent = thisObject.payload.chainParent
if (parent !== undefined) {
if (parent !== undefined && parent.payload !== undefined) {
thisObject.isFrozen = parent.payload.floatingObject.isFrozen
}
}
@@ -208,7 +208,7 @@ function newFloatingObject () {
let parent = thisObject.payload.chainParent
if (parent !== undefined) {
let distanceToChainParent = Math.sqrt(Math.pow(parent.payload.position.x - thisObject.container.frame.position.x, 2) + Math.pow(parent.payload.position.y - thisObject.container.frame.position.y, 2)) // ... we calculate the distance ...
let parentChildren = canvas.strategySpace.workspace.nodeChildren.childrenCount(parent, thisObject.payload.node)
let parentChildren = canvas.designerSpace.workspace.nodeChildren.childrenCount(parent, thisObject.payload.node)
let axisCount = parentChildren.childrenCount
let axisIndex = parentChildren.childIndex
let baseAngle = 0
@@ -1,6 +1,6 @@
function newStrategyPart () {
const MODULE_NAME = 'Strategy Part'
function newUiObject () {
const MODULE_NAME = 'UI Object'
const ERROR_LOG = true
const logger = newWebDebugLog()
@@ -15,15 +15,17 @@ function newStrategyPart () {
container: undefined,
payload: undefined,
codeEditor: undefined,
partTitle: undefined,
uiObjectTitle: undefined,
circularProgressBar: undefined,
isExecuting: undefined,
isRunning: undefined,
shortcutKey: undefined,
run: run,
stop: stop,
getReadyToAttach: getReadyToAttach,
showAvailabilityToAttach: showAvailabilityToAttach,
getReadyToChainAttach: getReadyToChainAttach,
showAvailabilityToChainAttach: showAvailabilityToChainAttach,
getReadyToReferenceAttach: getReadyToReferenceAttach,
showAvailabilityToReferenceAttach: showAvailabilityToReferenceAttach,
highlight: highlight,
setErrorMessage: setErrorMessage,
setValue: setValue,
@@ -63,19 +65,27 @@ function newStrategyPart () {
let hasValue
let valueCounter = 0
let previousDistance
let previousDistanceToChainParent
let readyToChainAttachDisplayCounter = 5
let readyToChainAttachDisplayIncrement = 0.1
let readyToChainAttachCounter = 0
let isReadyToChainAttach
let availableToChainAttachCounter = 0
let isAvailableToChainAttach
let isChainAttaching = false
let chainAttachToNode
let readyToAttachDisplayCounter = 5
let readyToAttachDisplayIncrement = 0.1
let previousDistanceToReferenceParent
let readyToReferenceAttachDisplayCounter = 5
let readyToReferenceAttachDisplayIncrement = 0.1
let readyToReferenceAttachCounter = 0
let isReadyToReferenceAttach
let availableToReferenceAttachCounter = 0
let isAvailableToReferenceAttach
let isReferenceAttaching = false
let referenceAttachToNode
let readyToAttachCounter = 0
let isReadyToAttach
let availableToAttachCounter = 0
let isAvailableToAttach
let isAttaching = false
let isDragging = false
let attachToNode
let errorMessage = ''
let currentValue = 0
@@ -95,8 +105,8 @@ function newStrategyPart () {
thisObject.payload = undefined
thisObject.menu.finalize()
thisObject.menu = undefined
thisObject.partTitle.finalize()
thisObject.partTitle = undefined
thisObject.uiObjectTitle.finalize()
thisObject.uiObjectTitle = undefined
thisObject.fitFunction = undefined
thisObject.isVisibleFunction = undefined
@@ -106,7 +116,8 @@ function newStrategyPart () {
}
icon = undefined
attachToNode = undefined
chainAttachToNode = undefined
referenceAttachToNode = undefined
}
function initialize (payload, menuItemsInitialValues) {
@@ -118,14 +129,14 @@ function newStrategyPart () {
thisObject.menu.initialize(menuItemsInitialValues, thisObject.payload)
thisObject.menu.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true)
/* Initialize Part Title */
/* Initialize UI Object Title */
thisObject.partTitle = newStrategyPartTitle()
thisObject.partTitle.isVisibleFunction = thisObject.isVisibleFunction
thisObject.partTitle.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true)
thisObject.partTitle.initialize(thisObject.payload)
thisObject.uiObjectTitle = newUiObjectTitle()
thisObject.uiObjectTitle.isVisibleFunction = thisObject.isVisibleFunction
thisObject.uiObjectTitle.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true)
thisObject.uiObjectTitle.initialize(thisObject.payload)
/* Load Part Image */
/* Load UI Object Image */
iconPhysics()
@@ -145,7 +156,7 @@ function newStrategyPart () {
if (container !== undefined) { return container }
}
container = thisObject.partTitle.getContainer(point)
container = thisObject.uiObjectTitle.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.menu.getContainer(point)
@@ -161,7 +172,7 @@ function newStrategyPart () {
function physics () {
thisObject.menu.physics()
thisObject.partTitle.physics()
thisObject.uiObjectTitle.physics()
if (thisObject.codeEditor !== undefined) {
thisObject.codeEditor.physics()
@@ -183,12 +194,14 @@ function newStrategyPart () {
highlightPhisycs()
errorMessagePhisycs()
valuePhisycs()
detachingPhysics()
attachingPhysics()
chainDetachingPhysics()
chainAttachingPhysics()
referenceDetachingPhysics()
referenceAttachingPhysics()
}
function attachingPhysics () {
attacchingCounters()
function chainAttachingPhysics () {
chainAttacchingCounters()
if (thisObject.isOnFocus !== true) { return }
if (isDragging !== true) { return }
@@ -199,6 +212,98 @@ function newStrategyPart () {
let compatibleType
let compatibleSubType
switch (thisObject.payload.node.type) {
case 'Sensor Bot':
compatibleType = '->' + 'Team' + '->'
compatibleSubType = undefined
break
case 'Indicator Bot':
compatibleType = '->' + 'Team' + '->'
compatibleSubType = undefined
break
case 'Trading Bot':
compatibleType = '->' + 'Team' + '->'
compatibleSubType = undefined
break
case 'Process Definition':
compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->'
compatibleSubType = undefined
break
case 'Process Output':
compatibleType = '->' + 'Process Definition' + '->'
compatibleSubType = undefined
break
case 'Process Dependencies':
compatibleType = '->' + 'Process Definition' + '->'
compatibleSubType = undefined
break
case 'Status Report':
compatibleType = '->' + 'Process Definition' + '->'
compatibleSubType = undefined
break
case 'Execution Started Event':
compatibleType = '->' + 'Process Definition' + '->'
compatibleSubType = undefined
break
case 'Execution Finished Event':
compatibleType = '->' + 'Process Definition' + '->'
compatibleSubType = undefined
break
case 'Calculations Procedure':
compatibleType = '->' + 'Product Definition' + '->'
compatibleSubType = undefined
break
case 'Data Building Procedure':
compatibleType = '->' + 'Product Definition' + '->'
compatibleSubType = undefined
break
case 'Procedure Initialization':
compatibleType = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->'
compatibleSubType = undefined
break
case 'Procedure Loop':
compatibleType = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->'
compatibleSubType = undefined
break
case 'Output Dataset':
compatibleType = '->' + 'Process Output' + '->'
compatibleSubType = undefined
break
case 'Status Dependency':
compatibleType = '->' + 'Process Dependencies' + '->'
compatibleSubType = undefined
break
case 'Data Dependency':
compatibleType = '->' + 'Process Dependencies' + '->'
compatibleSubType = undefined
break
case 'Product Definition':
compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->'
compatibleSubType = undefined
break
case 'Record Definition':
compatibleType = '->' + 'Product Definition' + '->'
compatibleSubType = undefined
break
case 'Record Property':
compatibleType = '->' + 'Record Definition' + '->'
compatibleSubType = undefined
break
case 'Dataset Definition':
compatibleType = '->' + 'Product Definition' + '->'
compatibleSubType = undefined
break
case 'Plotter':
compatibleType = '->' + 'Team' + '->'
compatibleSubType = undefined
break
case 'Plotter Module':
compatibleType = '->' + 'Plotter' + '->'
compatibleSubType = undefined
break
case 'Plotter Panel':
compatibleType = '->' + 'Plotter Module' + '->'
compatibleSubType = undefined
break
case 'Trading System':
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
@@ -207,10 +312,6 @@ function newStrategyPart () {
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Network':
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Network Node':
compatibleType = '->' + 'Network' + '->'
compatibleSubType = undefined
@@ -229,23 +330,23 @@ function newStrategyPart () {
break
case 'Parameters':
compatibleType = '->' + 'Trading System' + '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->'
compatibleSubType = '->' + 'Trading Engine Process' + '->'
compatibleSubType = '->' + 'Trading Process Instance' + '->'
break
case 'Backtesting Session':
compatibleType = '->' + 'Process' + '->'
compatibleSubType = '->' + 'Trading Engine Process' + '->'
compatibleType = '->' + 'Process Instance' + '->'
compatibleSubType = '->' + 'Trading Process Instance' + '->'
break
case 'Live Trading Session':
compatibleType = '->' + 'Process' + '->'
compatibleSubType = '->' + 'Trading Engine Process' + '->'
compatibleType = '->' + 'Process Instance' + '->'
compatibleSubType = '->' + 'Trading Process Instance' + '->'
break
case 'Paper Trading Session':
compatibleType = '->' + 'Process' + '->'
compatibleSubType = '->' + 'Trading Engine Process' + '->'
compatibleType = '->' + 'Process Instance' + '->'
compatibleSubType = '->' + 'Trading Process Instance' + '->'
break
case 'Fordward Testing Session':
compatibleType = '->' + 'Process' + '->'
compatibleSubType = '->' + 'Trading Engine Process' + '->'
compatibleType = '->' + 'Process Instance' + '->'
compatibleSubType = '->' + 'Trading Process Instance' + '->'
break
case 'Base Asset':
compatibleType = '->' + 'Parameters' + '->'
@@ -295,30 +396,30 @@ function newStrategyPart () {
compatibleType = '->' + 'Task Manager' + '->'
compatibleSubType = undefined
break
case 'Sensor':
case 'Sensor Bot Instance':
compatibleType = '->' + 'Task' + '->'
compatibleSubType = undefined
break
case 'Indicator':
case 'Indicator Bot Instance':
compatibleType = '->' + 'Task' + '->'
compatibleSubType = undefined
break
case 'Trading Engine':
case 'Trading Bot Instance':
compatibleType = '->' + 'Task' + '->'
compatibleSubType = undefined
break
case 'Process':
case 'Process Instance':
switch (thisObject.payload.node.subType) {
case 'Sensor Process': {
compatibleType = '->' + 'Sensor' + '->'
case 'Sensor Process Instance': {
compatibleType = '->' + 'Sensor Bot Instance' + '->'
break
}
case 'Indicator Process': {
compatibleType = '->' + 'Indicator' + '->'
case 'Indicator Process Instance': {
compatibleType = '->' + 'Indicator Bot Instance' + '->'
break
}
case 'Trading Engine Process': {
compatibleType = '->' + 'Trading Engine' + '->'
case 'Trading Process Instance': {
compatibleType = '->' + 'Trading Bot Instance' + '->'
break
}
}
@@ -389,7 +490,7 @@ function newStrategyPart () {
compatibleSubType = undefined
break
case 'Formula':
compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->' + 'Announcement' + '->'
compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->' + 'Announcement' + '->' + 'Record Property' + '->'
compatibleSubType = undefined
break
case 'Next Phase Event':
@@ -405,15 +506,15 @@ function newStrategyPart () {
compatibleSubType = undefined
break
case 'Code':
compatibleType = '->' + 'Condition' + '->'
compatibleType = '->' + 'Condition' + '->' + 'Procedure Initialization' + '->' + 'Procedure Loop' + '->' + 'Plotter Module' + '->' + 'Plotter Panel' + '->'
compatibleSubType = undefined
break
default:
return
}
let foundCompatible = false
attachToNode = undefined
isAttaching = false
chainAttachToNode = undefined
isChainAttaching = false
for (let i = 0; i < nearbyFloatingObjects.length; i++) {
let nearby = nearbyFloatingObjects[i]
@@ -422,11 +523,19 @@ function newStrategyPart () {
let nearbyNode = floatingObject.payload.node
if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) {
/* Discard objects with busy coonection ports */
if (thisObject.payload.node.type === 'Status Report' && nearbyNode.statusReport !== undefined) { continue }
if (thisObject.payload.node.type === 'Execution Started Event' && nearbyNode.executionStartedEvent !== undefined) { continue }
if (thisObject.payload.node.type === 'Execution Finished Event' && nearbyNode.executionFinishedEvent !== undefined) { continue }
if (thisObject.payload.node.type === 'Calculations Procedure' && nearbyNode.calculations !== undefined) { continue }
if (thisObject.payload.node.type === 'Data Building Procedure' && nearbyNode.dataBuilding !== undefined) { continue }
if (thisObject.payload.node.type === 'Procedure Initialization' && nearbyNode.initialization !== undefined) { continue }
if (thisObject.payload.node.type === 'Procedure Loop' && nearbyNode.loop !== undefined) { continue }
if (thisObject.payload.node.type === 'Record Definition' && nearbyNode.record !== undefined) { continue }
if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue }
if (thisObject.payload.node.type === 'Sensor' && nearbyNode.bot !== undefined) { continue }
if (thisObject.payload.node.type === 'Indicator' && nearbyNode.bot !== undefined) { continue }
if (thisObject.payload.node.type === 'Trading Engine' && nearbyNode.bot !== undefined) { continue }
if (thisObject.payload.node.type === 'Process' && nearbyNode.process !== undefined) { continue }
if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue }
if (thisObject.payload.node.type === 'Indicator Bot Instance' && nearbyNode.bot !== undefined) { continue }
if (thisObject.payload.node.type === 'Trading Bot Instance' && nearbyNode.bot !== undefined) { continue }
if (thisObject.payload.node.type === 'Process Instance' && nearbyNode.process !== undefined) { continue }
if (thisObject.payload.node.type === 'Trading System' && nearbyNode.tradingSystem !== undefined) { continue }
if (thisObject.payload.node.type === 'Personal Data' && nearbyNode.personalData !== undefined) { continue }
if (thisObject.payload.node.type === 'Parameters' && nearbyNode.parameters !== undefined) { continue }
@@ -481,65 +590,65 @@ function newStrategyPart () {
}
if (foundCompatible === false) {
if (distance < thisObject.container.frame.radius * 1.5 + floatingObject.container.frame.radius * 1.5) {
nearbyNode.payload.uiObject.getReadyToAttach()
isAttaching = true
attachToNode = nearbyNode
nearbyNode.payload.uiObject.getReadyToChainAttach()
isChainAttaching = true
chainAttachToNode = nearbyNode
foundCompatible = true
}
}
nearbyNode.payload.uiObject.showAvailabilityToAttach()
nearbyNode.payload.uiObject.showAvailabilityToChainAttach()
}
}
}
function attacchingCounters () {
if (readyToAttachDisplayCounter > 15) {
readyToAttachDisplayIncrement = -0.25
function chainAttacchingCounters () {
if (readyToChainAttachDisplayCounter > 15) {
readyToChainAttachDisplayIncrement = -0.25
}
if (readyToAttachDisplayCounter < 5) {
readyToAttachDisplayIncrement = 0.25
if (readyToChainAttachDisplayCounter < 5) {
readyToChainAttachDisplayIncrement = 0.25
}
readyToAttachDisplayCounter = readyToAttachDisplayCounter + readyToAttachDisplayIncrement
readyToChainAttachDisplayCounter = readyToChainAttachDisplayCounter + readyToChainAttachDisplayIncrement
readyToAttachCounter--
if (readyToAttachCounter <= 0) {
readyToAttachCounter = 0
isReadyToAttach = false
readyToChainAttachCounter--
if (readyToChainAttachCounter <= 0) {
readyToChainAttachCounter = 0
isReadyToChainAttach = false
} else {
isReadyToAttach = true
isReadyToChainAttach = true
}
availableToAttachCounter--
if (availableToAttachCounter <= 0) {
availableToAttachCounter = 0
isAvailableToAttach = false
availableToChainAttachCounter--
if (availableToChainAttachCounter <= 0) {
availableToChainAttachCounter = 0
isAvailableToChainAttach = false
} else {
isAvailableToAttach = true
isAvailableToChainAttach = true
}
}
function getReadyToAttach () {
readyToAttachCounter = 10
function getReadyToChainAttach () {
readyToChainAttachCounter = 10
}
function showAvailabilityToAttach () {
availableToAttachCounter = 10
function showAvailabilityToChainAttach () {
availableToChainAttachCounter = 10
}
function detachingPhysics () {
function chainDetachingPhysics () {
if (isDragging !== true) { return }
if (thisObject.payload.floatingObject.isFrozen === true) { return }
if (rightDragging === false) { return }
let distanceToChainParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.targetPosition.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.targetPosition.y, 2))
let ratio = distanceToChainParent / previousDistance
if (previousDistance === 0) {
previousDistance = distanceToChainParent
let ratio = distanceToChainParent / previousDistanceToChainParent
if (previousDistanceToChainParent === 0) {
previousDistanceToChainParent = distanceToChainParent
return
}
previousDistance = distanceToChainParent
previousDistanceToChainParent = distanceToChainParent
if (thisObject.isOnFocus !== true) { return }
if (thisObject.payload.chainParent === undefined) { return }
@@ -547,9 +656,152 @@ function newStrategyPart () {
let THRESHOLD = 1.15
if (previousDistance !== undefined) {
if (previousDistanceToChainParent !== undefined) {
if (ratio > THRESHOLD) {
canvas.strategySpace.workspace.detachNode(thisObject.payload.node)
canvas.designerSpace.workspace.chainDetachNode(thisObject.payload.node)
}
}
}
function referenceAttachingPhysics () {
referenceAttacchingCounters()
if (thisObject.isOnFocus !== true) { return }
if (isDragging !== true) { return }
if (rightDragging !== true) { return }
if (thisObject.payload.referenceParent !== undefined) { return }
let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects
let compatibleType
let compatibleSubType
switch (thisObject.payload.node.type) {
case 'Backtesting Session':
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Live Trading Session':
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Paper Trading Session':
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Fordward Testing Session':
compatibleType = '->' + 'Definition' + '->'
compatibleSubType = undefined
break
case 'Output Dataset':
compatibleType = '->' + 'Dataset Definition' + '->'
compatibleSubType = undefined
break
case 'Data Dependency':
compatibleType = '->' + 'Dataset Definition' + '->'
compatibleSubType = undefined
break
case 'Status Dependency':
compatibleType = '->' + 'Status Report' + '->'
compatibleSubType = undefined
break
case 'Execution Started Event':
compatibleType = '->' + 'Execution Finished Event' + '->'
compatibleSubType = undefined
break
case 'Process Instance':
compatibleType = '->' + 'Process Definition' + '->'
compatibleSubType = undefined
break
default:
return
}
let foundCompatible = false
referenceAttachToNode = undefined
isReferenceAttaching = false
for (let i = 0; i < nearbyFloatingObjects.length; i++) {
let nearby = nearbyFloatingObjects[i]
let distance = nearby[0]
let floatingObject = nearby[1]
let nearbyNode = floatingObject.payload.node
if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) {
/* Here we check if the subtypes are compatible. */
if (nearbyNode.subType !== undefined && compatibleSubType !== undefined) {
if (compatibleSubType.indexOf('->' + nearbyNode.subType + '->') < 0) {
continue
}
}
if (foundCompatible === false) {
if (distance < thisObject.container.frame.radius * 1.5 + floatingObject.container.frame.radius * 1.5) {
nearbyNode.payload.uiObject.getReadyToReferenceAttach()
isReferenceAttaching = true
referenceAttachToNode = nearbyNode
foundCompatible = true
}
}
nearbyNode.payload.uiObject.showAvailabilityToReferenceAttach()
}
}
}
function referenceAttacchingCounters () {
if (readyToReferenceAttachDisplayCounter > 15) {
readyToReferenceAttachDisplayIncrement = -0.25
}
if (readyToReferenceAttachDisplayCounter < 5) {
readyToReferenceAttachDisplayIncrement = 0.25
}
readyToReferenceAttachDisplayCounter = readyToReferenceAttachDisplayCounter + readyToReferenceAttachDisplayIncrement
readyToReferenceAttachCounter--
if (readyToReferenceAttachCounter <= 0) {
readyToReferenceAttachCounter = 0
isReadyToReferenceAttach = false
} else {
isReadyToReferenceAttach = true
}
availableToReferenceAttachCounter--
if (availableToReferenceAttachCounter <= 0) {
availableToReferenceAttachCounter = 0
isAvailableToReferenceAttach = false
} else {
isAvailableToReferenceAttach = true
}
}
function getReadyToReferenceAttach () {
readyToReferenceAttachCounter = 10
}
function showAvailabilityToReferenceAttach () {
availableToReferenceAttachCounter = 10
}
function referenceDetachingPhysics () {
if (isDragging !== true) { return }
if (thisObject.payload.floatingObject.isFrozen === true) { return }
if (rightDragging === false) { return }
if (thisObject.payload.referenceParent === undefined) { return }
let distanceToReferenceParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.referenceParent.payload.position.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.referenceParent.payload.position.y, 2))
let ratio = distanceToReferenceParent / previousDistanceToReferenceParent
if (previousDistanceToReferenceParent === 0) {
previousDistanceToReferenceParent = distanceToReferenceParent
return
}
previousDistanceToReferenceParent = distanceToReferenceParent
if (thisObject.isOnFocus !== true) { return }
if (thisObject.payload.referenceParent === undefined) { return }
let THRESHOLD = 1.15
if (previousDistanceToReferenceParent !== undefined) {
if (ratio > THRESHOLD) {
canvas.designerSpace.workspace.referenceDetachNode(thisObject.payload.node)
}
}
}
@@ -658,8 +910,8 @@ function newStrategyPart () {
}
function iconPhysics () {
icon = canvas.strategySpace.iconByPartType.get(thisObject.payload.node.type)
executingIcon = canvas.strategySpace.iconCollection.get('attractive')
icon = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.type)
executingIcon = canvas.designerSpace.iconCollection.get('attractive')
}
function onFocus () {
@@ -674,11 +926,11 @@ function newStrategyPart () {
}
function onDisplace (event) {
thisObject.partTitle.exitEditMode()
thisObject.uiObjectTitle.exitEditMode()
}
function onDragStarted (event) {
thisObject.partTitle.exitEditMode()
thisObject.uiObjectTitle.exitEditMode()
if (thisObject.codeEditor !== undefined) {
thisObject.codeEditor.deactivate()
}
@@ -688,20 +940,29 @@ function newStrategyPart () {
} else {
rightDragging = false
}
previousDistanceToReferenceParent = undefined
previousDistanceToChainParent = undefined
}
function onDragFinished (event) {
if (isAttaching === true) {
canvas.strategySpace.workspace.attachNode(thisObject.payload.node, attachToNode)
attachToNode = undefined
isAttaching = false
if (isChainAttaching === true) {
canvas.designerSpace.workspace.chainAttachNode(thisObject.payload.node, chainAttachToNode)
chainAttachToNode = undefined
isChainAttaching = false
}
if (isReferenceAttaching === true) {
canvas.designerSpace.workspace.referenceAttachNode(thisObject.payload.node, referenceAttachToNode)
referenceAttachToNode = undefined
isReferenceAttaching = false
}
isDragging = false
}
function drawBackground () {
if (thisObject.isOnFocus === false) {
drawConnectingLine()
drawReferenceLine()
drawChainLine()
if (isDragging === false && thisObject.isOnFocus === true) {
thisObject.menu.drawBackground()
@@ -717,7 +978,7 @@ function newStrategyPart () {
if (thisObject.isOnFocus === false) {
drawValue()
drawText()
thisObject.partTitle.draw()
thisObject.uiObjectTitle.draw()
}
}
@@ -736,7 +997,8 @@ function newStrategyPart () {
function drawOnFocus () {
if (thisObject.isOnFocus === true) {
drawConnectingLine()
drawReferenceLine()
drawChainLine()
if (thisObject.codeEditor !== undefined) {
thisObject.codeEditor.drawBackground()
@@ -762,11 +1024,11 @@ function newStrategyPart () {
drawErrorMessage()
drawValue()
drawText()
thisObject.partTitle.draw()
thisObject.uiObjectTitle.draw()
}
}
function drawConnectingLine () {
function drawChainLine () {
if (thisObject.payload.chainParent === undefined) { return }
let targetPoint = {
@@ -797,7 +1059,16 @@ function newStrategyPart () {
browserCanvasContext.moveTo(position.x, position.y)
browserCanvasContext.lineTo(targetPoint.x, targetPoint.y)
browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)'
browserCanvasContext.setLineDash([3, 4])
browserCanvasContext.setLineDash([3, 47])
browserCanvasContext.lineWidth = 4
browserCanvasContext.stroke()
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(position.x, position.y)
browserCanvasContext.lineTo(targetPoint.x, targetPoint.y)
browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)'
browserCanvasContext.setLineDash([1, 9])
browserCanvasContext.lineWidth = 2
browserCanvasContext.stroke()
browserCanvasContext.setLineDash([0, 0])
@@ -816,6 +1087,60 @@ function newStrategyPart () {
}
}
function drawReferenceLine () {
if (thisObject.payload.referenceParent === undefined) { return }
if (thisObject.payload.referenceParent.payload.floatingObject.isParentCollapsed === true) { return }
let targetPoint = {
x: thisObject.payload.referenceParent.payload.position.x,
y: thisObject.payload.referenceParent.payload.position.y
}
let position = {
x: 0,
y: 0
}
targetPoint = canvas.floatingSpace.container.frame.frameThisPoint(targetPoint)
position = thisObject.container.frame.frameThisPoint(position)
let LINE_STYLE = UI_COLOR.GREY
if (thisObject.container.frame.radius > 1) {
/* Target Line */
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(position.x, position.y)
browserCanvasContext.lineTo(targetPoint.x, targetPoint.y)
browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)'
browserCanvasContext.setLineDash([1, 9])
browserCanvasContext.lineWidth = 1
browserCanvasContext.stroke()
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(position.x, position.y)
browserCanvasContext.lineTo(targetPoint.x, targetPoint.y)
browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)'
browserCanvasContext.setLineDash([1, 9, 2, 8, 3, 7, 4, 6, 5, 5, 0, 100])
browserCanvasContext.lineWidth = 4
browserCanvasContext.stroke()
browserCanvasContext.setLineDash([0, 0])
}
if (thisObject.container.frame.radius > 0.5) {
/* Target Spot */
let radius = 1
browserCanvasContext.beginPath()
browserCanvasContext.arc(targetPoint.x, targetPoint.y, radius, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
browserCanvasContext.fill()
}
}
function drawText () {
/* Text Follows */
let position = {
@@ -1034,18 +1359,24 @@ function newStrategyPart () {
browserCanvasContext.fill()
if (thisObject.payload.node.type === 'Definition') {
if (thisObject.payload.node.type === 'Definition' || thisObject.payload.node.type === 'Network' || thisObject.payload.node.type === 'Team') {
VISIBLE_RADIUS = thisObject.container.frame.radius * 2
let OPACITY = 1
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 10
browserCanvasContext.setLineDash([4, 20])
browserCanvasContext.setLineDash([4, 16])
browserCanvasContext.stroke()
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 1
browserCanvasContext.setLineDash([20, 20])
browserCanvasContext.stroke()
}
@@ -1090,33 +1421,103 @@ function newStrategyPart () {
browserCanvasContext.stroke()
}
if (isReadyToAttach === true) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 2 + readyToAttachDisplayCounter * 2
let OPACITY = readyToAttachCounter / 10
if (isReadyToChainAttach === true) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5 + readyToChainAttachDisplayCounter - readyToChainAttachDisplayCounter / 2
let OPACITY = readyToChainAttachCounter / 10
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 10
browserCanvasContext.setLineDash([readyToAttachDisplayCounter, readyToAttachDisplayCounter * 2])
browserCanvasContext.setLineDash([10, 90])
browserCanvasContext.stroke()
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 5
browserCanvasContext.setLineDash([5, 45])
browserCanvasContext.stroke()
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 1
browserCanvasContext.setLineDash([2, 8])
browserCanvasContext.stroke()
}
if (isAvailableToAttach === true && isReadyToAttach === false) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 1.5
let OPACITY = availableToAttachCounter / 10
if (isAvailableToChainAttach === true && isReadyToChainAttach === false) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5
let OPACITY = availableToChainAttachCounter / 10
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TURQUOISE + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 10
browserCanvasContext.setLineDash([8, 20])
browserCanvasContext.setLineDash([8, 32])
browserCanvasContext.stroke()
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TURQUOISE + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 2
browserCanvasContext.setLineDash([3, 5])
browserCanvasContext.stroke()
}
if (isReadyToReferenceAttach === true) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5 + readyToReferenceAttachDisplayCounter - readyToReferenceAttachDisplayCounter / 2
let OPACITY = readyToReferenceAttachCounter / 10
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 10
browserCanvasContext.setLineDash([10, 90])
browserCanvasContext.stroke()
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 5
browserCanvasContext.setLineDash([5, 45])
browserCanvasContext.stroke()
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 1
browserCanvasContext.setLineDash([2, 8])
browserCanvasContext.stroke()
}
if (isAvailableToReferenceAttach === true && isReadyToReferenceAttach === false) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5
let OPACITY = availableToReferenceAttachCounter / 10
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 10
browserCanvasContext.setLineDash([8, 32])
browserCanvasContext.stroke()
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + OPACITY + ')'
browserCanvasContext.lineWidth = 2
browserCanvasContext.setLineDash([3, 5])
browserCanvasContext.stroke()
}
}
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
function newStrategyPartTitle () {
const MODULE_NAME = 'Strategy Part Title'
function newUiObjectTitle () {
const MODULE_NAME = 'UI Object Title'
const ERROR_LOG = true
const logger = newWebDebugLog()
@@ -52,50 +52,70 @@ function newStrategyPartTitle () {
thisObject.allwaysVisible = true
break
}
case 'Network': {
case 'Team': {
thisObject.allwaysVisible = true
break
}
case 'Network Node': {
case 'Sensor Bot': {
thisObject.allwaysVisible = true
break
}
case 'Social Bots': {
case 'Indicator Bot': {
thisObject.allwaysVisible = true
break
}
case 'Telegram Bot': {
case 'Trading Bot': {
thisObject.allwaysVisible = true
break
}
case 'Process Definition': {
thisObject.allwaysVisible = true
break
}
case 'Product Definition': {
thisObject.allwaysVisible = true
break
}
case 'Dataset Definition': {
thisObject.allwaysVisible = true
break
}
case 'Record Property': {
thisObject.allwaysVisible = true
break
}
case 'Plotter': {
thisObject.allwaysVisible = true
break
}
case 'Plotter Module': {
thisObject.allwaysVisible = true
break
}
case 'Plotter Panel': {
thisObject.allwaysVisible = true
break
}
case 'Network': {
thisObject.allwaysVisible = true
break
}
case 'Announcement': {
thisObject.allwaysVisible = true
break
}
case 'Layer Manager': {
break
}
case 'Layer': {
thisObject.allwaysVisible = true
break
}
case 'Task Manager': {
break
}
case 'Task': {
break
}
case 'Sensor': {
case 'Sensor Bot Instance': {
thisObject.allwaysVisible = true
break
}
case 'Indicator': {
case 'Indicator Bot Instance': {
thisObject.allwaysVisible = true
break
}
case 'Trading Engine': {
break
}
case 'Process': {
break
}
case 'Backtesting Session': {
thisObject.allwaysVisible = true
break
@@ -112,18 +132,6 @@ function newStrategyPartTitle () {
thisObject.allwaysVisible = true
break
}
case 'Personal Data': {
break
}
case 'Exchange Account': {
break
}
case 'Exchange Account Asset': {
break
}
case 'Exchange Account Key': {
break
}
case 'Workspace': {
thisObject.allwaysVisible = true
break
@@ -132,90 +140,12 @@ function newStrategyPartTitle () {
thisObject.allwaysVisible = true
break
}
case 'Parameters': {
break
}
case 'Base Asset': {
break
}
case 'Time Range': {
break
}
case 'Time Period': {
break
}
case 'Slippage': {
break
}
case 'Fee Structure': {
break
}
case 'Strategy': {
thisObject.allwaysVisible = true
break
}
case 'Trigger Stage': {
break
}
case 'Open Stage': {
break
}
case 'Manage Stage': {
break
}
case 'Close Stage': {
break
}
case 'Position Size': {
break
}
case 'Position Rate': {
break
}
case 'Trigger On Event': {
break
}
case 'Trigger Off Event': {
break
}
case 'Take Position Event': {
break
}
case 'Initial Definition': {
break
}
case 'Open Execution': {
break
}
case 'Close Execution': {
break
}
case 'Stop': {
break
}
case 'Take Profit': {
break
}
case 'Phase': {
break
}
case 'Formula': {
break
}
case 'Next Phase Event': {
break
}
case 'Situation': {
break
}
case 'Condition': {
break
}
case 'Code': {
break
}
default: {
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> Part Type not Recognized -> type = ' + payload.node.type) }
thisObject.allwaysVisible = false
}
}
+40 -36
View File
@@ -71,7 +71,7 @@ function newProductsPanel () {
for (let j = 0; j < devTeam.bots.length; j++) {
let bot = devTeam.bots[j]
if (bot.type !== 'Indicator') { continue }
if (bot.type !== 'Indicator Bot Instance') { continue }
if (bot.products !== undefined) {
for (let k = 0; k < bot.products.length; k++) {
@@ -271,65 +271,69 @@ function newProductsPanel () {
calculateVisbleProductCards()
function synchronizeLayersAndProductCards () {
/* We will look into the ecosystem to know which Trading Engine bots are defined there. */
/* We will look into the ecosystem to know which Trading bots are defined there. */
let ecosystem = JSON.parse(window.localStorage.getItem('ecosystem'))
if (ecosystem === null || ecosystem === undefined) {
ecosystem = getUserEcosystem()
}
/* Then we get an Array of all instances of this bot placed at Definitions on the Workspace. */
let tradingEngineInstances = canvas.strategySpace.workspace.getAllTradingEngines()
let tradingBotInstances = canvas.designerSpace.workspace.getAllTradingBotInstances()
/* Here we will go through all the instances of trading engines and see their layers, to see
if we can find a matching layer. */
for (let n = 0; n < tradingEngineInstances.length; n++) {
let tradingEngine = tradingEngineInstances[n]
for (let n = 0; n < tradingBotInstances.length; n++) {
let tradingBotInstance = tradingBotInstances[n]
let code
try {
code = JSON.parse(tradingEngine.code)
} catch (err) {
// if we can not parse this, then we ignore this trading engine.
}
if (code !== undefined) {
let instanceBot
let instanceTeam
for (let m = 0; m < tradingBotInstance.processes.length; m++) {
let process = tradingBotInstance.processes[m]
try {
code = JSON.parse(process.payload.referenceParent.payload.parentNode.code)
instanceBot = code.codeName
code = JSON.parse(process.payload.referenceParent.payload.parentNode.payload.parentNode.code)
instanceTeam = code.codeName
} catch (err) {
continue
}
for (let i = 0; i < ecosystem.devTeams.length; i++) {
let devTeam = ecosystem.devTeams[i]
for (let j = 0; j < devTeam.bots.length; j++) {
let bot = devTeam.bots[j]
if (bot.type !== 'Trading Engine') { continue }
if (bot.type !== 'Trading Bot Instance') { continue }
if (devTeam.codeName === code.team && bot.codeName === code.bot) {
/* We found an instance of the same Trading Engine we are currently looking at.
if (devTeam.codeName === instanceTeam && bot.codeName === instanceBot) {
/* We found an instance of the same Trading we are currently looking at.
Next thing to do is to see its layers to see if we can match it with the current product. */
for (let m = 0; m < tradingEngine.processes.length; m++) {
let process = tradingEngine.processes[m]
if (process.session !== undefined) {
if (process.session.layerManager !== undefined) {
let layerManager = process.session.layerManager
if (process.session !== undefined) {
if (process.session.layerManager !== undefined) {
let layerManager = process.session.layerManager
if (bot.products !== undefined) {
for (let k = 0; k < bot.products.length; k++) {
let product = bot.products[k]
if (bot.products !== undefined) {
for (let k = 0; k < bot.products.length; k++) {
let product = bot.products[k]
for (let p = 0; p < layerManager.layers.length; p++) {
let layer = layerManager.layers[p]
let layerCode
try {
layerCode = JSON.parse(layer.code)
} catch (err) {
for (let p = 0; p < layerManager.layers.length; p++) {
let layer = layerManager.layers[p]
let layerCode
try {
layerCode = JSON.parse(layer.code)
} catch (err) {
// if we can not parse this, then we ignore this trading engine.
}
}
if (product.codeName === layerCode.product) {
if (product.codeName === layerCode.product) {
/* We have a layer that is matching the current product */
let cardCode = exchange + '-' + market.assetB + '/' + market.assetA + '-' + devTeam.codeName + '-' + bot.codeName + '-' + product.codeName + '-' + process.session.id
let cardFound = removeFromLocalProductCards(cardCode)
if (cardFound !== true) {
productCard = addProductCard(devTeam, bot, product, process.session)
onProductCardStatusChanged(productCard)
}
let cardCode = exchange + '-' + market.assetB + '/' + market.assetA + '-' + devTeam.codeName + '-' + bot.codeName + '-' + product.codeName + '-' + process.session.id
let cardFound = removeFromLocalProductCards(cardCode)
if (cardFound !== true) {
productCard = addProductCard(devTeam, bot, product, process.session)
onProductCardStatusChanged(productCard)
}
}
}
+5 -5
View File
@@ -45,7 +45,7 @@
thisObject.container.frame.position.x = 0
let INITIAL_POSITION
if (canvas.strategySpace.workspace.enabled === true) {
if (canvas.designerSpace.workspace.enabled === true) {
let localStorage = window.localStorage.getItem(MODULE_NAME)
if (localStorage !== null) {
storage = JSON.parse(localStorage)
@@ -100,7 +100,7 @@
thisObject.status = 'MIDDLE'
if (canvas.strategySpace.workspace.enabled === true) {
if (canvas.designerSpace.workspace.enabled === true) {
thisObject.container.isDraggeable = true
} else {
thisObject.container.isDraggeable = false
@@ -109,10 +109,10 @@
if (thisObject.container.frame.position.y > browserCanvas.height * 99.5 / 100 - COCKPIT_SPACE_HEIGHT) {
thisObject.container.frame.position.y = browserCanvas.height - COCKPIT_SPACE_HEIGHT
thisObject.status = 'BOTTOM'
canvas.strategySpace.makeInvisible()
canvas.designerSpace.makeInvisible()
canvas.floatingSpace.makeInvisible()
} else {
canvas.strategySpace.makeVisible()
canvas.designerSpace.makeVisible()
canvas.floatingSpace.makeVisible()
}
@@ -184,7 +184,7 @@
browserCanvasContext.closePath()
browserCanvasContext.fill()
if (canvas.strategySpace.workspace.enabled === true) {
if (canvas.designerSpace.workspace.enabled === true) {
arrow()
}
}
@@ -1,12 +1,12 @@
function newStrategySpace () {
function newDesignerSpace () {
const MODULE_NAME = 'Strategy Space'
let thisObject = {
sidePanel: undefined,
strategizerGateway: undefined,
container: undefined,
iconCollection: undefined,
iconByPartType: undefined,
iconByUiObjectType: undefined,
workspace: undefined,
physics: physics,
draw: draw,
@@ -23,13 +23,13 @@ function newStrategySpace () {
container.isDraggeable = false
thisObject.iconCollection = new Map()
thisObject.iconByPartType = new Map()
thisObject.iconByUiObjectType = new Map()
return thisObject
async function initialize () {
loadIconCollection()
buildIconByPartTypeMap()
buildIconByUiObjectTypeMap()
thisObject.strategizerGateway = newStrategizerGateway()
@@ -37,22 +37,22 @@ function newStrategySpace () {
thisObject.workspace.initialize()
}
function buildIconByPartTypeMap () {
function buildIconByUiObjectTypeMap () {
const relationshipArray = [
['Definition', 'text'],
['Network', 'network'],
['Network Node', 'network-node'],
['Social Bots', 'support'],
['Social Bots', 'social-bot'],
['Telegram Bot', 'paper-plane'],
['Announcement', 'promotion'],
['Layer Manager', 'layer-manager'],
['Layer', 'attractive'],
['Task Manager', 'task'],
['Task', 'timeline'],
['Sensor', 'bot-sensor'],
['Indicator', 'bot-indicator'],
['Trading Engine', 'trading-engine'],
['Process', 'process'],
['Sensor Bot Instance', 'bot-sensor'],
['Indicator Bot Instance', 'bot-indicator'],
['Trading Bot Instance', 'bot-trading'],
['Process Instance', 'process'],
['Backtesting Session', 'session-backtesting'],
['Live Trading Session', 'session-live-trading'],
['Fordward Testing Session', 'session-forward-testing'],
@@ -89,13 +89,37 @@ function newStrategySpace () {
['Next Phase Event', 'pantone'],
['Situation', 'pyramid'],
['Condition', 'testing'],
['Code', 'html']
['Code', 'html'],
['Team', 'team'],
['Sensor Bot', 'bot-sensor'],
['Indicator Bot', 'bot-indicator'],
['Trading Bot', 'bot-trading'],
['Process Definition', 'process-definition'],
['Process Output', 'process-output'],
['Process Dependencies', 'process-dependencies'],
['Status Report', 'status-report'],
['Execution Started Event', 'execution-started-event'],
['Execution Finished Event', 'execution-finished-event'],
['Calculations Procedure', 'calculations-procedure'],
['Data Building Procedure', 'data-building-procedure'],
['Procedure Initialization', 'procedure-initialization'],
['Procedure Loop', 'procedure-loop'],
['Output Dataset', 'output-dataset'],
['Status Dependency', 'status-dependency'],
['Data Dependency', 'data-dependency'],
['Product Definition', 'product-definition'],
['Record Definition', 'record-definition'],
['Record Property', 'record-property'],
['Dataset Definition', 'dataset-definition'],
['Plotter', 'plotter'],
['Plotter Module', 'plotter-module'],
['Plotter Panel', 'plotter-panel']
]
for (let i = 0; i < relationshipArray.length; i++) {
let record = relationshipArray[i]
let icon = thisObject.iconCollection.get(record[1])
thisObject.iconByPartType.set(record[0], icon)
thisObject.iconByUiObjectType.set(record[0], icon)
}
}
@@ -178,12 +202,34 @@ function newStrategySpace () {
'session-forward-testing',
'network',
'network-node',
'trading-engine',
'bot-trading',
'layer-manager',
'process',
'bot-indicator',
'bot-sensor',
'time-period'
'time-period',
'team',
'procedure-loop',
'calculations-procedure',
'data-building-procedure',
'procedure-initialization',
'process-definition',
'output-dataset',
'data-dependency',
'product-definition',
'plotter-module',
'status-dependency',
'record-property',
'record-definition',
'plotter',
'plotter-panel',
'dataset-definition',
'status-report',
'execution-finished-event',
'process-dependencies',
'process-output',
'social-bot',
'execution-started-event'
]
for (let i = 0; i < iconsNames.length; i++) {
+8 -5
View File
@@ -10,7 +10,7 @@ function newFloatingSpace () {
let thisObject = {
floatingLayer: undefined, // This is the array of floatingObjects being displayed
profileBalls: undefined,
strategyPartConstructor: undefined,
uiObjectConstructor: undefined,
noteSets: undefined,
container: undefined,
oneScreenUp: oneScreenUp,
@@ -53,7 +53,7 @@ function newFloatingSpace () {
function finalize () {
thisObject.floatingLayer.finalize()
thisObject.profileBalls.finalize()
thisObject.strategyPartConstructor.finalize()
thisObject.uiObjectConstructor.finalize()
thisObject.noteSets.finalize()
}
@@ -67,8 +67,8 @@ function newFloatingSpace () {
thisObject.noteSets = newNoteSets()
thisObject.noteSets.initialize(thisObject.floatingLayer)
thisObject.strategyPartConstructor = newStrategyPartConstructor()
thisObject.strategyPartConstructor.initialize(thisObject.floatingLayer)
thisObject.uiObjectConstructor = newUiObjectConstructor()
thisObject.uiObjectConstructor.initialize(thisObject.floatingLayer)
thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
}
@@ -107,6 +107,7 @@ function newFloatingSpace () {
}
thisObject.container.displace(displaceVector)
return displaceVector
}
function oneScreenDown () {
@@ -116,6 +117,7 @@ function newFloatingSpace () {
}
thisObject.container.displace(displaceVector)
return displaceVector
}
function oneScreenLeft () {
@@ -125,6 +127,7 @@ function newFloatingSpace () {
}
thisObject.container.displace(displaceVector)
return displaceVector
}
function oneScreenRight () {
@@ -134,6 +137,7 @@ function newFloatingSpace () {
}
thisObject.container.displace(displaceVector)
return displaceVector
}
function positionAtNode (node) {
@@ -223,4 +227,3 @@ function newFloatingSpace () {
browserCanvasContext.fill()
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+16 -1
View File
@@ -4,6 +4,7 @@ function newSystemEventHandler () {
const MODULE_NAME = 'System Event Handler'
const ERROR_LOG = true
const INFO_LOG = true
const logger = newWebDebugLog()
logger.fileName = MODULE_NAME
@@ -12,6 +13,7 @@ function newSystemEventHandler () {
let thisObject = {
initialize: initialize,
physics: physics,
createEventHandler: createEventHandler,
deleteEventHandler: deleteEventHandler,
listenToEvent: listenToEvent,
@@ -95,6 +97,17 @@ function newSystemEventHandler () {
sendCommand(eventCommand, responseCallBack)
}
function physics () {
if (WEB_SOCKETS_CONNECTION !== undefined) {
if (WEB_SOCKETS_CONNECTION.readyState === 3) { // Connection closed. May happen after computer goes to sleep.
setuptWebSockets(onOpen)
function onOpen () {
if (INFO_LOG === true) { logger.write('[INFO] setuptWebSockets -> Found Web Sockets Connection Closed. Reconnected to WebSockets Server.') }
}
}
}
}
function setuptWebSockets (callBackFunction) {
try {
WEB_SOCKETS_CONNECTION = new WebSocket(WEB_SOCKETS_URL)
@@ -105,7 +118,9 @@ function newSystemEventHandler () {
console.log('WebSocket error:' + JSON.stringify(error))
}
WEB_SOCKETS_CONNECTION.onopen = () => {
callBackFunction()
if (callBackFunction !== undefined) {
callBackFunction()
}
}
WEB_SOCKETS_CONNECTION.onmessage = e => {
// console.log('Websoked Message Received: ' + e.data)
+3 -2
View File
@@ -1,6 +1,7 @@
function roundedCornersBackground (params) {
if (params.xOffset === undefined) { params.xOffset = 0 }
borderPoint1 = {
x: params.cornerRadius,
x: params.cornerRadius + params.xOffset,
y: params.cornerRadius
}
@@ -15,7 +16,7 @@ function roundedCornersBackground (params) {
}
borderPoint4 = {
x: params.cornerRadius,
x: params.cornerRadius + params.xOffset,
y: params.container.frame.height - params.cornerRadius
}