From 7316b5b7b47afb4a1a6702e3cb3aff2ff531396a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 24 Jun 2019 17:34:29 +0200 Subject: [PATCH 01/17] Less cycles to restart the plotter --- CockpitSpace/RestartSimulation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CockpitSpace/RestartSimulation.js b/CockpitSpace/RestartSimulation.js index 530dff1cb..7bbb426da 100644 --- a/CockpitSpace/RestartSimulation.js +++ b/CockpitSpace/RestartSimulation.js @@ -113,7 +113,7 @@ function newRestartSimulation () { thisObject.status = 'Restarting' await graphQlRestartSimulation(simulationParams) thisObject.status = 'Calculating' - counterTillNextState = 2000 + counterTillNextState = 250 } else { thisObject.status = 'Error' counterTillNextState = 500 @@ -165,7 +165,7 @@ function newRestartSimulation () { case 'Calculating': thisObject.status = 'Refreshing' turnOffProductCards() - counterTillNextState = 250 + counterTillNextState = 50 break case 'Refreshing': thisObject.status = 'Ready' @@ -276,3 +276,4 @@ function newRestartSimulation () { browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y) } } + From a988cbf2a0a6efde3cd63dc4c988bcfac9e27a5c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 25 Jun 2019 00:56:11 +0200 Subject: [PATCH 02/17] More mass for level 3 --- FloatingSpace/StrategyPartConstructor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 12c5fd8ee..86d102c93 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -1730,7 +1730,7 @@ function newStrategyPartConstructor () { floatingObject.targetFriction = FRICTION floatingObject.friction = INITIAL_FRICTION - floatingObject.initializeMass(20) + floatingObject.initializeMass(50) floatingObject.initializeRadius(35) floatingObject.initializeImageSize(60) floatingObject.initializeFontSize(10) From 5ea6e2621c03d19e4268a1cab7671400c939c454 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 25 Jun 2019 10:18:30 +0200 Subject: [PATCH 03/17] Bug Fixed deleting nodes --- FloatingSpace/StrategyPartConstructor.js | 2 +- StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 86d102c93..55f08876e 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -223,7 +223,7 @@ function newStrategyPartConstructor () { { action: 'Delete Parameters', actionFunction: payload.onMenuItemClick, - label: 'Delete Trading System', + label: 'Delete Parameters', visible: false, iconPathOn: 'trash', iconPathOff: 'trash', diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index ab64cbbe5..c5a69fece 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -44,6 +44,10 @@ function newNodeDeleter () { deleteStrategy(node.strategies[0], rootNodes) } + if (node.parameters !== undefined) { + deleteParameters(node.parameters, rootNodes) + } + completeDeletion(node, rootNodes) destroyPart(node) cleanNode(node) @@ -121,6 +125,9 @@ function newNodeDeleter () { if (node.takePosition !== undefined) { deleteEvent(node.takePosition, rootNodes) } + if (node.positionSize !== undefined) { + deletePositionSize(node.positionSize, rootNodes) + } destroyPart(node) cleanNode(node) } From 4e103cd35c90d21e060c720795ebf9adda2dc545 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 25 Jun 2019 10:53:52 +0200 Subject: [PATCH 04/17] productCard.product.codeName in (productCardsToTurnOff) --- CockpitSpace/RestartSimulation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CockpitSpace/RestartSimulation.js b/CockpitSpace/RestartSimulation.js index 7bbb426da..c4f428c8c 100644 --- a/CockpitSpace/RestartSimulation.js +++ b/CockpitSpace/RestartSimulation.js @@ -125,12 +125,13 @@ function newRestartSimulation () { } function turnOffProductCards () { + let productCardsToTurnOff = ['Trading-Simulation', 'Simulation-Conditions', 'Simulation-Strategies', 'Simulation-Trades'] for (let i = 0; i < canvas.panelsSpace.panels.length; i++) { let panel = canvas.panelsSpace.panels[i] if (panel.name === 'Products Panel') { for (j = 0; j < panel.productCards.length; j++) { let productCard = panel.productCards[j] - if (productCard.product.relatedToTradingEngine === true && productCard.status !== PRODUCT_CARD_STATUS.OFF) { + if (productCard.product.codeName in (productCardsToTurnOff) && productCard.status !== PRODUCT_CARD_STATUS.OFF) { productCard.turnOff() productCardsToTurnOn.push(productCard) } From 9cf9e1fb19e62e97bd8b5a8c3e86db9f1b4a97bc Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 25 Jun 2019 17:37:13 +0200 Subject: [PATCH 05/17] Bug Fixes --- CockpitSpace/RestartSimulation.js | 6 +++--- StrategySpace/StrategizerGateway.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CockpitSpace/RestartSimulation.js b/CockpitSpace/RestartSimulation.js index c4f428c8c..c32947f52 100644 --- a/CockpitSpace/RestartSimulation.js +++ b/CockpitSpace/RestartSimulation.js @@ -113,7 +113,7 @@ function newRestartSimulation () { thisObject.status = 'Restarting' await graphQlRestartSimulation(simulationParams) thisObject.status = 'Calculating' - counterTillNextState = 250 + counterTillNextState = 50 } else { thisObject.status = 'Error' counterTillNextState = 500 @@ -131,7 +131,7 @@ function newRestartSimulation () { if (panel.name === 'Products Panel') { for (j = 0; j < panel.productCards.length; j++) { let productCard = panel.productCards[j] - if (productCard.product.codeName in (productCardsToTurnOff) && productCard.status !== PRODUCT_CARD_STATUS.OFF) { + if (productCardsToTurnOff.includes(productCard.product.codeName) && productCard.status !== PRODUCT_CARD_STATUS.OFF) { productCard.turnOff() productCardsToTurnOn.push(productCard) } @@ -166,7 +166,7 @@ function newRestartSimulation () { case 'Calculating': thisObject.status = 'Refreshing' turnOffProductCards() - counterTillNextState = 50 + counterTillNextState = 10 break case 'Refreshing': thisObject.status = 'Ready' diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 673cb9bb7..39af6c833 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -47,7 +47,7 @@ function newStrategizerGateway () { } user = JSON.parse(user) - let fbSlug = 'simulator' + '-' + user.alias + let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias /* See if we need to update or create a new record at the strategizer */ From 771e3cfd7bcd898a38263e6f96dcb6e7d5ca9d76 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 26 Jun 2019 11:24:44 +0200 Subject: [PATCH 06/17] BUG FIXED when detaching and re attaching stuff --- FloatingSpace/StrategyPart.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index cc3603f2a..0849f13c3 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -500,6 +500,8 @@ function newStrategyPart () { function onDragFinished (event) { if (isAttaching === true) { canvas.strategySpace.workspace.attachNode(thisObject.payload.node, attachToNode) + attachToNode = undefined + isAttaching = false } isDragging = false } From f1d5da63f9d761b6c1eb88076eb27a5e2f819cc2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 26 Jun 2019 11:49:50 +0200 Subject: [PATCH 07/17] Increase target friction --- FloatingSpace/StrategyPartConstructor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 55f08876e..91f43dc5a 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -1596,7 +1596,7 @@ function newStrategyPartConstructor () { } function setFloatingObjectBasicProperties (floatingObject, payload) { - const FRICTION = 0.94 + const FRICTION = 0.95 const INITIAL_FRICTION = 0.99 switch (payload.node.type) { From 1b6e4a5dafdb3eb7c7fd0dee5b3bd2f827699e0f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 26 Jun 2019 15:30:06 +0200 Subject: [PATCH 08/17] Bug Fixed : No more than one phase at Initial Definition --- StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 742db41ad..480f0ece0 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -504,6 +504,11 @@ function newPartsFromNodes () { } let phaseParent = parentNode let m = phaseParent.phases.length + + if (phaseParent.payload.parentNode !== undefined) { + if (phaseParent.payload.parentNode.type === 'Initial Definition' && m > 0) { return } + } + let phase = { name: 'New Phase', formula: { From c1789c16f1bc09574befb74703bdf4495a55c678 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 26 Jun 2019 15:45:43 +0200 Subject: [PATCH 09/17] Context Menu Appearing Faster --- FloatingSpace/CircularMenu.js | 2 +- FloatingSpace/CircularMenuItem.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/CircularMenu.js b/FloatingSpace/CircularMenu.js index 5a6c96be7..33fed0473 100644 --- a/FloatingSpace/CircularMenu.js +++ b/FloatingSpace/CircularMenu.js @@ -114,7 +114,7 @@ function newCircularMenu () { function onNotFocus () { for (let i = 0; i < menuItems.length; i++) { let menutItem = menuItems[i] - menutItem.targetRadius = menutItem.rawRadius * 0 - i * 5 + menutItem.targetRadius = menutItem.rawRadius * 0 - i * 4 menutItem.isDeployed = false } thisObject.isDeployed = false diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index cbda91bc9..ee77de716 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -106,7 +106,7 @@ function newCircularMenuItem () { function physics () { if (thisObject.dontShowAtFullscreen === true && CURRENT_TOP_MARGIN === 0) { return } - const INCREASE_STEP = 1 + const INCREASE_STEP = 2 if (Math.abs(thisObject.currentRadius - thisObject.targetRadius) >= INCREASE_STEP) { if (thisObject.currentRadius < thisObject.targetRadius) { From 7292abb0286b1a68f3dc6357752d03bd9b1b0eaa Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 27 Jun 2019 01:28:27 +0200 Subject: [PATCH 10/17] IMPROVEMENT: Phase 0 --- FloatingSpace/StrategyPart.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 0849f13c3..7a48b2dfb 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -738,7 +738,16 @@ function newStrategyPart () { for (let i = 0; i < parent.phases.length; i++) { let phase = parent.phases[i] if (phase.id === thisObject.payload.node.id) { - label = label + ' #' + (i + 1) + let parentParent = parent.payload.parentNode + if (parentParent !== undefined) { + if (parentParent.type === 'Initial Definition') { + label = label + ' #' + (i) + } else { + label = label + ' #' + (i + 1) + } + } else { + label = label + ' #' + (i + 1) + } return label } } From 2d7f11c47d9ca3099d946189c64c06b238c7245c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 27 Jun 2019 10:23:46 +0200 Subject: [PATCH 11/17] BUG FIXED: Formula not a number crashes animation --- FloatingSpace/StrategyPart.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 7a48b2dfb..afb01447a 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -433,7 +433,7 @@ function newStrategyPart () { } function setValue (value) { - if (value !== undefined) { + if (value !== undefined && isNaN(value) === false) { formulaValue = value hasValue = true valueCounter = 5 @@ -951,4 +951,3 @@ function newStrategyPart () { } } } - From 69b1b6c916f4240a27047cfb0739fb5fdb78d35c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 27 Jun 2019 11:04:09 +0200 Subject: [PATCH 12/17] BUG FIXED: True returned in formula crashed animation --- FloatingSpace/StrategyPart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index afb01447a..e3c56f8f2 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -433,7 +433,7 @@ function newStrategyPart () { } function setValue (value) { - if (value !== undefined && isNaN(value) === false) { + if (value !== undefined && isNaN(value) === false && (typeof value !== 'boolean')) { formulaValue = value hasValue = true valueCounter = 5 From 4e355dd60f8fd411c6b3b01ca1756d15516ad9c9 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 27 Jun 2019 18:21:35 +0200 Subject: [PATCH 13/17] Detaching only with 2 mouse button allowed --- Canvas.js | 4 +++- FloatingSpace/StrategyPart.js | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Canvas.js b/Canvas.js index c99219890..6f5a49c25 100644 --- a/Canvas.js +++ b/Canvas.js @@ -236,7 +236,8 @@ function newCanvas () { try { let point = { x: event.pageX, - y: event.pageY - CURRENT_TOP_MARGIN + y: event.pageY - CURRENT_TOP_MARGIN, + button: event.button } dragVector.downX = point.x @@ -706,3 +707,4 @@ function newCanvas () { } } } + diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index e3c56f8f2..6da021f37 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -79,6 +79,7 @@ function newStrategyPart () { let errorMessage = '' let formulaValue = 0 + let detachingEnabled = false return thisObject @@ -373,6 +374,7 @@ function newStrategyPart () { function detachingPhysics () { if (isDragging !== true) { return } if (thisObject.isFrozen === true) { return } + if (detachingEnabled === 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 @@ -433,7 +435,7 @@ function newStrategyPart () { } function setValue (value) { - if (value !== undefined && isNaN(value) === false && (typeof value !== 'boolean')) { + if (value !== undefined) { formulaValue = value hasValue = true valueCounter = 5 @@ -495,6 +497,11 @@ function newStrategyPart () { thisObject.codeEditor.deactivate() } isDragging = true + if (event.button === 2) { + detachingEnabled = true + } else { + detachingEnabled = false + } } function onDragFinished (event) { @@ -738,16 +745,7 @@ function newStrategyPart () { for (let i = 0; i < parent.phases.length; i++) { let phase = parent.phases[i] if (phase.id === thisObject.payload.node.id) { - let parentParent = parent.payload.parentNode - if (parentParent !== undefined) { - if (parentParent.type === 'Initial Definition') { - label = label + ' #' + (i) - } else { - label = label + ' #' + (i + 1) - } - } else { - label = label + ' #' + (i + 1) - } + label = label + ' #' + (i + 1) return label } } @@ -951,3 +949,4 @@ function newStrategyPart () { } } } + From eefe9507f9456e3f76442bd1202f864c1e1e5ade Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 27 Jun 2019 23:04:54 -0300 Subject: [PATCH 14/17] Fixing issue for user names different than team slug --- StrategySpace/StrategizerGateway.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 39af6c833..1743521cc 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -47,7 +47,7 @@ function newStrategizerGateway () { } user = JSON.parse(user) - let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias + let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias.replace('.','') /* See if we need to update or create a new record at the strategizer */ @@ -86,8 +86,8 @@ function newStrategizerGateway () { throw 'Error getting events: ' + JSON.stringify(response.data.errors) } else { canvas.strategySpace.workspace.idAtStrategizer = response.data.data.strategizer_CreateTradingSystem.id - } - } else { + } + } else { const graphQLServer = await axios({ url: window.canvasApp.graphQL.masterAppApiUrl, method: 'post', @@ -112,7 +112,7 @@ function newStrategizerGateway () { headers: { authorization: 'Bearer ' + accessToken } - }) + }) } return true @@ -132,7 +132,7 @@ function newStrategizerGateway () { } user = JSON.parse(user) - let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias + let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias.replace('.','') let response = await axios({ url: window.canvasApp.graphQL.masterAppApiUrl, @@ -147,7 +147,8 @@ function newStrategizerGateway () { data } } - `, + `, + variables: { fbSlug: fbSlug } @@ -163,13 +164,13 @@ function newStrategizerGateway () { } else { logger.write('[ERROR] Error while getting Trading System from Strategizer: ' + JSON.stringify(response.data.errors)) return false - } + } } else { window.localStorage.setItem('userStrategies', JSON.stringify(response.data.data.strategizer_TradingSystemByFb.data)) thisObject.strategizerData = JSON.parse(JSON.stringify(response.data.data.strategizer_TradingSystemByFb.data)) canvas.strategySpace.workspace.idAtStrategizer = response.data.data.strategizer_TradingSystemByFb.id return true - } + } } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack) } } From 369ecd47b6e8c3bcf38857c0402b95e883caa47e Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 27 Jun 2019 23:05:12 -0300 Subject: [PATCH 15/17] Unused variable --- TopSpace/Login.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/TopSpace/Login.js b/TopSpace/Login.js index 099176916..b3964fbeb 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -33,7 +33,7 @@ function newLogin() { if (accessToken) { await getEvents(accessToken, sharedStatus) - await getClones(accessToken) + // await getClones(accessToken) } thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick) @@ -120,7 +120,6 @@ function newLogin() { stateDatetime createDatetime lastLogs - runAsTeam summaryDate buyAverage sellAverage From 66f2bbc4dc0d905cb52b7207b353186fb6062788 Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 27 Jun 2019 23:05:25 -0300 Subject: [PATCH 16/17] Unused variable --- Dashboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dashboard.js b/Dashboard.js index 46d5dd536..94896fc5c 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -153,7 +153,7 @@ function newDashboard () { }) .then(response => { teams = response.data.teams_Teams - window.localStorage.setItem('Teams', JSON.stringify(response.data.teams_Teams)) + //window.localStorage.setItem('Teams', JSON.stringify(response.data.teams_Teams)) resolve({ teams: response.data.teams_Teams }) }) .catch(err => { From 958589a30ef649c561257c3b8fb59e8fda3af720 Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 27 Jun 2019 23:05:44 -0300 Subject: [PATCH 17/17] Fixing error on log entry --- CockpitSpace/GraphQLRestartSimulation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CockpitSpace/GraphQLRestartSimulation.js b/CockpitSpace/GraphQLRestartSimulation.js index 53c5d2e37..fc42a3a66 100644 --- a/CockpitSpace/GraphQLRestartSimulation.js +++ b/CockpitSpace/GraphQLRestartSimulation.js @@ -28,7 +28,7 @@ async function graphQlRestartSimulation (simulationParams) { }) if (graphQLServer.data.errors) { - console.log(err.stack) + console.log(graphQLServer.data.errors) throw new Error(graphQLServer.data.errors[0].message) } } catch (err) {