Sending the Definition via Events Part 1
This commit is contained in:
1 parent
c14b03a25b
commit
7e369c722b
3 files changed
+19
-7
No files matched your search
@@ -73,7 +73,7 @@ function newRestartSimulation () {
|
||||
function onEvent (message) {
|
||||
refreshCounter++
|
||||
|
||||
if (refreshCounter === 3) {
|
||||
if (refreshCounter === 1) {
|
||||
refreshCounter = 0
|
||||
turnOffProductCards()
|
||||
turnOnProductCards()
|
||||
@@ -125,9 +125,15 @@ function newRestartSimulation () {
|
||||
logger.write('[ERROR] Restart Simulation -> Can not delete Logs and Simulation data. err = ' + err.messsage)
|
||||
}
|
||||
}
|
||||
systemEventHandler.raiseEvent('Cockpit-Restart-Button', 'Live-Trading Started')
|
||||
let event = {
|
||||
definition: getDefinition()
|
||||
}
|
||||
systemEventHandler.raiseEvent('Cockpit-Restart-Button', 'Live-Trading Started', event)
|
||||
} else {
|
||||
systemEventHandler.raiseEvent('Cockpit-Restart-Button', 'Backstesting Started')
|
||||
let event = {
|
||||
definition: getDefinition()
|
||||
}
|
||||
systemEventHandler.raiseEvent('Cockpit-Restart-Button', 'Backstesting Started', event)
|
||||
}
|
||||
|
||||
thisObject.status = 'Calculating'
|
||||
@@ -146,6 +152,12 @@ function newRestartSimulation () {
|
||||
}
|
||||
}
|
||||
|
||||
function getDefinition () {
|
||||
let definitionNode = canvas.strategySpace.workspace.getProtocolDefinitionNode()
|
||||
definitionNode.simulationParams = getSimulationParams()
|
||||
return JSON.stringify(definitionNode)
|
||||
}
|
||||
|
||||
function turnOffProductCards () {
|
||||
let productCardsToTurnOff = ['Trading-Simulation', 'Simulation-Conditions', 'Simulation-Strategies', 'Simulation-Trades', 'Live Trading History']
|
||||
for (let i = 0; i < canvas.panelsSpace.panels.length; i++) {
|
||||
|
||||
@@ -108,7 +108,7 @@ function newStrategizerGateway () {
|
||||
return
|
||||
}
|
||||
|
||||
let tradingSystem = canvas.strategySpace.workspace.getProtocolTradingSystem()
|
||||
let tradingSystem = canvas.strategySpace.workspace.getProtocolDefinitionNode()
|
||||
if (tradingSystem === undefined || tradingSystem === null) {
|
||||
logger.write('[ERROR] saveToStrategyzer -> Can not save when tradingSystem is null or undefined.')
|
||||
return
|
||||
|
||||
@@ -11,7 +11,7 @@ function newWorkspace () {
|
||||
enabled: false,
|
||||
nodeChildren: undefined,
|
||||
onMenuItemClick: onMenuItemClick,
|
||||
getProtocolTradingSystem: getProtocolTradingSystem,
|
||||
getProtocolDefinitionNode: getProtocolDefinitionNode,
|
||||
physics: physics,
|
||||
spawn: spawn,
|
||||
detachNode: detachNode,
|
||||
@@ -98,8 +98,8 @@ function newWorkspace () {
|
||||
}
|
||||
}
|
||||
|
||||
function getProtocolTradingSystem () {
|
||||
return functionLibraryProtocolNode.getProtocolNode(thisObject.definition)
|
||||
function getProtocolDefinitionNode () {
|
||||
return functionLibraryProtocolNode.getProtocolNode(thisObject.definition, false, true, true) // <- We need to do this workaround in order no to send unescaped charactars through a system event.
|
||||
}
|
||||
|
||||
function detachNode (node) {
|
||||
|
||||
Reference in new issue
Block a user