Integration with new Version of Strategizer complete

This commit is contained in:
Luis Fernando Molina committed 2019-06-04 11:36:02 +02:00
1 parent 5374744799
commit 4d78d5d921
5 files changed
+211 -373

No files matched your search

+26 -16
View File
@@ -7,6 +7,7 @@ function newWorkspace () {
container: undefined,
idAtStrategizer: undefined,
onMenuItemClick: onMenuItemClick,
getProtocolTradingSystem: getProtocolTradingSystem,
physics: physics,
spawn: spawn,
detachNode: detachNode,
@@ -41,6 +42,7 @@ function newWorkspace () {
functionLibraryProtocolNode = newProtocolNode()
functionLibraryWorkspaceNodes = newWorkspaceNode()
let isInitialized = false
return thisObject
function finalize () {
@@ -63,36 +65,43 @@ function newWorkspace () {
workspace = JSON.parse(savedWorkspace)
rootNodes = workspace.rootNodes
thisObject.idAtStrategizer = workspace.idAtStrategizer
if (thisObject.idAtStrategizer === undefined) {
initializeLoadingFromStrategizer()
} else {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined)
}
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined)
}
isInitialized = true
}
}
async function initializeLoadingFromStrategizer () {
await canvas.strategySpace.strategizerGateway.loadFromStrategyzer()
let tradingSystem = canvas.strategySpace.strategizerGateway.strategizerData
if (tradingSystem !== undefined) {
let adaptedTradingSystem = {
strategies: tradingSystem.subStrategies
let result = await canvas.strategySpace.strategizerGateway.loadFromStrategyzer()
if (result === true) {
thisObject.tradingSystem = canvas.strategySpace.strategizerGateway.strategizerData
rootNodes.push(thisObject.tradingSystem)
functionLibraryPartsFromNodes.createPartFromNode(thisObject.tradingSystem, undefined, undefined)
thisObject.tradingSystem.payload.uiObject.setRunningStatus()
} else {
// First use of the Designer, lets help by creating the first Trading System
thisObject.tradingSystem = {
type: 'Trading System',
strategies: []
}
thisObject.idAtStrategizer = tradingSystem.id
rootNodes.push(adaptedTradingSystem)
functionLibraryPartsFromNodes.createPartFromNode(adaptedTradingSystem, undefined, undefined)
thisObject.tradingSystem = adaptedTradingSystem
rootNodes.push(thisObject.tradingSystem)
functionLibraryPartsFromNodes.createPartFromNode(thisObject.tradingSystem, undefined, undefined)
thisObject.tradingSystem.payload.uiObject.setRunningStatus()
}
isInitialized = true
}
function getContainer (point) {
}
function getProtocolTradingSystem () {
return functionLibraryProtocolNode.getProtocolNode(thisObject.tradingSystem)
}
function detachNode (node) {
functionLibraryAttachDetach.detachNode(node, rootNodes)
}
@@ -102,6 +111,7 @@ function newWorkspace () {
}
function physics () {
if (isInitialized !== true) { return }
/* Here we will save all the workspace related objects into the local storage */
let stringifyReadyNodes = []
for (let i = 0; i < rootNodes.length; i++) {