Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop

This commit is contained in:
Julian Molina committed 2021-01-29 18:46:36 +01:00
commit 63e5091250
11 files changed
+211 -93

No files matched your search

@@ -2839,6 +2839,12 @@
"relatedUiObject": "Trading Parameters",
"actionFunction": "payload.executeAction"
},
{
"action": "Switch To Paper Trading",
"label": "Switch To Paper Trading",
"relatedUiObject": "Paper Trading Session",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
@@ -10093,6 +10099,12 @@
"relatedUiObject": "Trading Parameters",
"actionFunction": "payload.executeAction"
},
{
"action": "Switch To Backtesting",
"label": "Switch To Backtesting",
"relatedUiObject": "Backtesting Session",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
@@ -10194,6 +10206,12 @@
"relatedUiObject": "Trading Parameters",
"actionFunction": "payload.executeAction"
},
{
"action": "Switch To Live Trading",
"label": "Switch To Live Trading",
"relatedUiObject": "Live Trading Session",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
@@ -10321,6 +10339,12 @@
"relatedUiObject": "Trading Parameters",
"actionFunction": "payload.executeAction"
},
{
"action": "Switch To Forward Testing",
"label": "Switch To Forward Testing",
"relatedUiObject": "Forward Testing Session",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
@@ -634,7 +634,7 @@ function newSuperalgosActionSwitch() {
{
let definition = getSchemaDocument(action.node)
if (definition !== undefined) {
UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo(action.node.project,'Node', action.node.type)
UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo(action.node.project, 'Node', action.node.type)
}
}
break
@@ -678,6 +678,30 @@ function newSuperalgosActionSwitch() {
UI.projects.superalgos.functionLibraries.workspaceFunctions.addMissingWorkspaceProjects(action.node, action.rootNodes)
}
break
case 'Switch To Forward Testing':
{
action.node.type = "Forward Testing Session"
UI.projects.superalgos.spaces.floatingSpace.uiObjectConstructor.createUiObject(true, action.node.payload)
}
break
case 'Switch To Live Trading':
{
action.node.type = "Live Trading Session"
UI.projects.superalgos.spaces.floatingSpace.uiObjectConstructor.createUiObject(true, action.node.payload)
}
break
case 'Switch To Paper Trading':
{
action.node.type = "Paper Trading Session"
UI.projects.superalgos.spaces.floatingSpace.uiObjectConstructor.createUiObject(true, action.node.payload)
}
break
case 'Switch To Backtesting':
{
action.node.type = "Backtesting Session"
UI.projects.superalgos.spaces.floatingSpace.uiObjectConstructor.createUiObject(true, action.node.payload)
}
break
}
}
}
@@ -156,7 +156,6 @@ function newSuperalgosFunctionLibraryNodeDeleter() {
node.payload.targetPosition.x = undefined
node.payload.targetPosition.y = undefined
node.payload.visible = undefined
node.payload.subTitle = undefined
node.payload.title = undefined
node.payload.node = undefined
node.payload.parentNode = undefined
@@ -641,13 +641,6 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
}
}
/* Setting the title */
if (title !== undefined) {
payload.subTitle = title
} else {
payload.subTitle = uiObjectType
}
payload.visible = true
payload.title = name
payload.node = node
@@ -108,17 +108,19 @@ function newWorkspace() {
UI.projects.superalgos.utilities.statusBar.changeStatus("Setting up Docs Search Engine...")
setTimeout(theEnd, 100)
function theEnd() {
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine()
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine(onIndexingFinished)
setupEventsServerClients()
runTasksAndSessions()
thisObject.enabled = true
UI.projects.superalgos.spaces.cockpitSpace.initializePosition()
CAN_SPACES_DRAW = true
function onIndexingFinished() {
setupEventsServerClients()
runTasksAndSessions()
thisObject.enabled = true
UI.projects.superalgos.spaces.cockpitSpace.initializePosition()
CAN_SPACES_DRAW = true
thisObject.isInitialized = true
savingWorkspaceIntervalId = setInterval(saveWorkspace, 60000)
UI.projects.superalgos.utilities.statusBar.changeStatus("Displaying the UI...")
thisObject.isInitialized = true
savingWorkspaceIntervalId = setInterval(saveWorkspace, 60000)
UI.projects.superalgos.utilities.statusBar.changeStatus("Displaying the UI...")
}
}
}
} catch (err) {
@@ -368,12 +370,14 @@ function newWorkspace() {
workingAtTask = 0
function takeAction() {
UI.projects.superalgos.spaces.docsSpace.reset()
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine() // The docs needs to index the loaded workspace.
UI.projects.superalgos.spaces.floatingSpace.inMapMode = false
thisObject.isInitialized = true
saveWorkspace()
runTasksAndSessions()
UI.projects.superalgos.spaces.docsSpace.reset()
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine(onIndexingFinished) // The docs needs to index the loaded workspace.
function onIndexingFinished() {
UI.projects.superalgos.spaces.floatingSpace.inMapMode = false
thisObject.isInitialized = true
saveWorkspace()
runTasksAndSessions()
}
}
break
}
@@ -468,9 +468,11 @@ function newSuperalgosDocsCommmandInterface() {
setTimeout(startReindexingProcess, 100)
function startReindexingProcess() {
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine()
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine(onFinish)
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message - Reindexing Done')
function onFinish() {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message - Reindexing Done')
}
}
}
@@ -16,7 +16,10 @@ function newSuperalgosDocsSearchEngine() {
thisObject.docsIndex = undefined
}
function setUpSearchEngine() {
function setUpSearchEngine(callbackFunction) {
let totalAsyncCallsMade = 0
let totalAsyncCallsFinished = 0
setUpWorkspaceSchemas()
thisObject.docsIndex = []
@@ -26,82 +29,125 @@ function newSuperalgosDocsSearchEngine() {
let documentIndex
/* Search in Nodes */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema[i],
category: 'Node',
project: project
totalAsyncCallsMade++
setTimeout(searchInNodes, 0)
totalAsyncCallsMade++
setTimeout(searchInConcepts, 0)
totalAsyncCallsMade++
setTimeout(searchInNTopics, 0)
totalAsyncCallsMade++
setTimeout(searchInTutorials, 0)
totalAsyncCallsMade++
setTimeout(searchInReviews, 0)
totalAsyncCallsMade++
setTimeout(searchInBooks, 0)
totalAsyncCallsMade++
setTimeout(searchInWorkspaces, 0)
function searchInNodes() {
/* Search in Nodes */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema[i],
category: 'Node',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
asyncCallFinished()
}
/* Search in Concepts */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema[i],
category: 'Concept',
project: project
function searchInConcepts() {
/* Search in Concepts */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema[i],
category: 'Concept',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
asyncCallFinished()
}
/* Search in Topics */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema[i],
category: 'Topic',
project: project
function searchInNTopics() {
/* Search in Topics */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema[i],
category: 'Topic',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
asyncCallFinished()
}
/* Search in Tutorials */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema[i],
category: 'Tutorial',
project: project
function searchInTutorials() {
/* Search in Tutorials */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema[i],
category: 'Tutorial',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
asyncCallFinished()
}
/* Search in Reviews */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema[i],
category: 'Review',
project: project
function searchInReviews() {
/* Search in Reviews */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema[i],
category: 'Review',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
asyncCallFinished()
}
/* Search in Books */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema[i],
category: 'Book',
project: project
function searchInBooks() {
/* Search in Books */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema[i],
category: 'Book',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
asyncCallFinished()
}
/* Search in Workspace */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema[i],
category: 'Workspace',
project: project
function searchInWorkspaces() {
/* Search in Workspace */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema[i],
category: 'Workspace',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
asyncCallFinished()
}
function asyncCallFinished() {
totalAsyncCallsFinished++
if (totalAsyncCallsMade === totalAsyncCallsFinished) {
callbackFunction()
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
}
@@ -210,6 +210,12 @@ function newFloatingLayer() {
let newInvisibleArray = []
for (let i = 0; i < invisibleFloatingObjects.length; i++) {
let floatingObject = invisibleFloatingObjects[i]
if (floatingObject.payload === undefined) {
/* The floating object was replaced by another one. */
invisibleFloatingObjects.splice(i, 1)
return
}
collapsePhysics(floatingObject)
@@ -227,6 +233,12 @@ function newFloatingLayer() {
for (let i = 0; i < visibleFloatingObjects.length; i++) {
let floatingObject = visibleFloatingObjects[i]
if (floatingObject.payload === undefined) {
/* The floating object was replaced by another one. */
visibleFloatingObjects.splice(i, 1)
return
}
collapsePhysics(floatingObject)
if (floatingObject.isParentCollapsed === true) {
@@ -1679,7 +1679,7 @@ function newUiObject() {
if (radius > 6) {
const MAX_LABEL_LENGTH = 30
label = thisObject.payload.subTitle
label = thisObject.payload.node.type
label = addIndexNumber(label)
if (label !== undefined) {
@@ -25,10 +25,22 @@ function newUiObjectConstructor() {
}
function createUiObject(userAddingNew, payload) {
/*
In case we are replacing an existing uiObject and floatingObject
*/
if (payload.floatingObject !== undefined) {
payload.floatingObject.finalize()
}
if (payload.uiObject !== undefined) {
payload.uiObject.finalize()
}
let floatingObject = newFloatingObject()
floatingObject.fitFunction = UI.projects.superalgos.spaces.floatingSpace.fitIntoVisibleArea
floatingObject.container.connectToParent(UI.projects.superalgos.spaces.floatingSpace.container, false, false, false, false, false, false, false, false)
floatingObject.initialize('UI Object', payload)
payload.floatingObject = floatingObject
/*
@@ -49,14 +49,16 @@ function newSuperalgosPanelSpace() {
}
case 'Plotter Panel':
{
if (pParameters.panelNode.config.isLegacy !== true) {
let panelConfig = JSON.parse(pParameters.panelNode.config)
if (panelConfig.isLegacy !== true) {
panel = newPlotterPanel()
panel.fitFunction = UI.projects.superalgos.spaces.chartingSpace.fitFunction
panel.container.isVisibleFunction = UI.projects.superalgos.spaces.chartingSpace.isThisPointVisible
panel.session = pSession
panel.initialize(pParameters.panelNode)
} else {
panel = getNewPlotterPanel(pParameters.mine, pParameters.plotterCodeName, pParameters.moduleCodeName, pParameters.panelNode.config.codeName)
panel = getNewPlotterPanel(pParameters.mine, pParameters.plotterCodeName, pParameters.moduleCodeName, panelConfig.codeName)
panel.fitFunction = UI.projects.superalgos.spaces.chartingSpace.fitFunction
panel.container.isVisibleFunction = UI.projects.superalgos.spaces.chartingSpace.isThisPointVisible
panel.session = pSession