Error Handling Improved, Different Errors Plotted with mouseover opens the Docs

This commit is contained in:
Luis Fernando Molina committed 2021-01-27 18:11:12 +01:00
1 parent 1e1501b222
commit 185d11224d
13 files changed
+146 -39

No files matched your search

@@ -1 +1 @@
{"type":"Trading Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","project":"Superalgos","id":"ec8d74ba-a4ad-417a-b479-6bae95b8a1fe","savedPayload":{"position":{"x":24910.97457254189,"y":18457.46644293786},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"3ed03a02-381d-43fe-9faa-761728c53bd8"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","project":"Superalgos","id":"22b0af33-8c2f-4194-839b-affd18f298d5","savedPayload":{"position":{"x":24834.601232363748,"y":18490.07023931273},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"15f5b150-f1cf-403c-8cb9-2c7c4e1db8e8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","project":"Superalgos","id":"23ab91ae-2e78-4993-bb69-855f69cef1ce","savedPayload":{"position":{"x":24753.53736157276,"y":18508.085329665024},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","project":"Superalgos","id":"d0a4515a-279d-4c27-8de2-168108861242","savedPayload":{"position":{"x":24670.543493063306,"y":18510.89823169951},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"7fc80977-5b37-413e-8107-0a89a16e08b0","savedPayload":{"position":{"x":24588.445883487308,"y":18498.413155411115},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"a6888750-1043-420c-9253-633e1399c5e4","savedPayload":{"position":{"x":24510.040268473647,"y":18471.05526509864},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","project":"Superalgos","id":"0ad114df-f076-4a86-8c62-4c4a146da73c","savedPayload":{"position":{"x":24437.996657204443,"y":18429.756200904503},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","project":"Superalgos","id":"04b51302-957d-4365-ad55-9f89d60e261c","savedPayload":{"position":{"x":24374.76840845468,"y":18375.922352927064},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFroLine truncated
{"type":"Trading Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","project":"Superalgos","id":"ec8d74ba-a4ad-417a-b479-6bae95b8a1fe","savedPayload":{"position":{"x":24910.97457254189,"y":18457.46644293786},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"3ed03a02-381d-43fe-9faa-761728c53bd8"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","project":"Superalgos","id":"22b0af33-8c2f-4194-839b-affd18f298d5","savedPayload":{"position":{"x":24834.601232363748,"y":18490.07023931273},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"15f5b150-f1cf-403c-8cb9-2c7c4e1db8e8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","project":"Superalgos","id":"23ab91ae-2e78-4993-bb69-855f69cef1ce","savedPayload":{"position":{"x":24753.53736157276,"y":18508.085329665024},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","project":"Superalgos","id":"d0a4515a-279d-4c27-8de2-168108861242","savedPayload":{"position":{"x":24670.543493063306,"y":18510.89823169951},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"7fc80977-5b37-413e-8107-0a89a16e08b0","savedPayload":{"position":{"x":24588.445883487308,"y":18498.413155411115},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"a6888750-1043-420c-9253-633e1399c5e4","savedPayload":{"position":{"x":24510.040268473647,"y":18471.05526509864},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","project":"Superalgos","id":"0ad114df-f076-4a86-8c62-4c4a146da73c","savedPayload":{"position":{"x":24437.996657204443,"y":18429.756200904503},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","project":"Superalgos","id":"04b51302-957d-4365-ad55-9f89d60e261c","savedPayload":{"position":{"x":24374.76840845468,"y":18375.922352927064},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFroLine truncated
@@ -89,7 +89,7 @@
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, tradingSystemOrder.name, undefined, undefined, undefined, contextInfo)
tradingSystem.errors.push([tradingSystemOrder.id, message, docs])
tradingSystem.addError([tradingSystemOrder.id, message, docs])
logError("getOrder -> Error = " + err.message);
}
@@ -199,7 +199,7 @@
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, exchangeApiKey.name, undefined, exchangeApiKey.config, undefined, contextInfo)
tradingSystem.errors.push([exchangeApiKey.id, message, docs])
tradingSystem.addError([exchangeApiKey.id, message, docs])
function errorFooter() {
logError('key: ->' + exchangeApiKey.config.codeName + '<-')
@@ -247,7 +247,7 @@
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, tradingSystemOrder.name, undefined, undefined, undefined, contextInfo)
tradingSystem.errors.push([tradingSystemOrder.id, message, docs])
tradingSystem.addError([tradingSystemOrder.id, message, docs])
logError("cancelOrder -> Error = " + err.message);
}
}
@@ -47,7 +47,7 @@ exports.newSuperalgosBotModulesAnnouncements = function (processIndex) {
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, announcement.announcementCondition.name, announcement.announcementCondition.code, undefined, undefined, undefined)
tradingSystem.errors.push([announcement.announcementCondition.id, err.message, docs])
tradingSystem.addError([announcement.announcementCondition.id, err.message, docs])
}
if (conditionValue !== true) { canAnnounce = false }
}
@@ -70,7 +70,7 @@ exports.newSuperalgosBotModulesAnnouncements = function (processIndex) {
placeholder: {}
}
tradingSystem.errors.push([TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.id, message, docs])
tradingSystem.addError([TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.id, message, docs])
}
}
}
@@ -253,7 +253,7 @@ exports.newSuperalgosBotModulesSnapshots = function (processIndex) {
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, nodeWithCode.name, nodeWithCode.code, undefined, undefined, contextInfo)
tradingSystem.errors.push([nodeWithCode.id, message, docs])
tradingSystem.addError([nodeWithCode.id, message, docs])
values.push(0)
}
}
@@ -270,7 +270,7 @@ exports.newSuperalgosBotModulesSnapshots = function (processIndex) {
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, nodeWithCode.name, nodeWithCode.code, undefined)
tradingSystem.errors.push([nodeWithCode.id, message, docs])
tradingSystem.addError([nodeWithCode.id, message, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] runSimulation -> addCodeToSnapshot -> nodeWithCode.code = ' + nodeWithCode.code)
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] runSimulation -> addCodeToSnapshot -> err = ' + err.stack)
}
@@ -87,7 +87,7 @@ exports.newSuperalgosBotModulesTradingExecution = function (processIndex) {
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err)
tradingSystem.errors.push([executionNode.id, message, docs])
tradingSystem.addError([executionNode.id, message, docs])
}
if (typeof err === 'string' || err instanceof String) {
@@ -108,7 +108,7 @@ exports.newSuperalgosBotModulesTradingExecution = function (processIndex) {
placeholder: {}
}
tradingSystem.errors.push([node.id, message, docs])
tradingSystem.addError([node.id, message, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> " + message);
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.name = " + node.name);
@@ -1074,7 +1074,7 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
placeholder: {}
}
tradingSystem.errors.push([node.id, message, docs])
tradingSystem.addError([node.id, message, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> " + message);
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.name = " + node.name);
@@ -517,7 +517,7 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
}
function badDefinitionUnhandledException(err, message, node, docs) {
tradingSystem.errors.push([node.id, message, docs])
tradingSystem.addError([node.id, message, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> " + message);
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.name = " + node.name);
@@ -539,7 +539,7 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.errors.push([tradingSystem.id, errorMessage, docs])
tradingSystem.addError([tradingSystem.id, errorMessage, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
return false
@@ -565,7 +565,7 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.errors.push([tradingSystem.id, errorMessage, docs])
tradingSystem.addError([tradingSystem.id, errorMessage, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
return false
@@ -591,7 +591,7 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.errors.push([tradingSystem.id, errorMessage, docs])
tradingSystem.addError([tradingSystem.id, errorMessage, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
return false
@@ -617,7 +617,7 @@ exports.newSuperalgosBotModulesTradingSimulation = function (processIndex) {
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.errors.push([tradingSystem.id, errorMessage, docs])
tradingSystem.addError([tradingSystem.id, errorMessage, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
return false
@@ -616,7 +616,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) {
placeholder: {}
}
tradingSystem.errors.push([moveToPhaseEvent.id, 'This Node needs to reference a Phase.', docs])
tradingSystem.addError([moveToPhaseEvent.id, 'This Node needs to reference a Phase.', docs])
continue
}
@@ -723,7 +723,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) {
placeholder: {}
}
tradingSystem.errors.push([moveToPhaseEvent.id, 'This Node needs to reference a Phase.', docs])
tradingSystem.addError([moveToPhaseEvent.id, 'This Node needs to reference a Phase.', docs])
continue
}
@@ -1150,7 +1150,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) {
placeholder: {}
}
tradingSystem.errors.push([node.id, message, docs])
tradingSystem.addError([node.id, message, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> " + message);
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.name = " + node.name);
@@ -62,6 +62,18 @@ exports.newSuperalgosBotModulesTradingSystem = function (processIndex) {
evalNode(startingNode, 'Formulas', descendentOfNodeType)
}
tradingSystem.addError = function (errorInfoArray) {
/*
This function adds to the array of error info a rate based on the amount of items
already at the errors array. This rate will later help plotting the error at the
charts.
*/
let baseRate = tradingEngine.current.episode.candle.close.value
let rate = baseRate - baseRate * ((tradingSystem.errors.length + 1) + 0) / 100
errorInfoArray.push(rate)
tradingSystem.errors.push(errorInfoArray)
}
function isItInside(elementWithTimestamp, elementWithBeginEnd) {
/*
The function is to allow in Conditions and Formulas to easily know when an element with timestamp (like the ones of single files) are inside the time range
@@ -277,7 +289,7 @@ exports.newSuperalgosBotModulesTradingSystem = function (processIndex) {
tradingSystem.highlights.push(node.id)
}
if (errorMessage !== undefined) {
tradingSystem.errors.push([node.id, errorMessage, docs])
tradingSystem.addError([node.id, errorMessage, docs])
}
if (value !== undefined) {
tradingSystem.values.push([node.id, value])
@@ -312,7 +324,7 @@ exports.newSuperalgosBotModulesTradingSystem = function (processIndex) {
}
if (errorMessage !== undefined) {
tradingSystem.errors.push([node.id, errorMessage, docs])
tradingSystem.addError([node.id, errorMessage, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[INFO] evalFormula -> errorMessage = ' + errorMessage)
return
} else {
@@ -327,10 +339,10 @@ exports.newSuperalgosBotModulesTradingSystem = function (processIndex) {
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, node.name, node.code, undefined, value)
tradingSystem.errors.push([node.id, 'Formula needs to return a numeric value.', docs])
tradingSystem.addError([node.id, 'Formula needs to return a numeric value.', docs])
return
}
tradingSystem.values.push([node.id, value])
tradingSystem.formulas.set(node.id, value)
}
@@ -1,34 +1,82 @@
function newNodesErrors() {
const MODULE_NAME = 'Nodes Errors'
const logger = newWebDebugLog()
let thisObject = {
onRecordChange: onRecordChange,
initialize: initialize,
finalize: finalize
}
return thisObject
function finalize() {
}
function initialize(pRootNode) {
}
function onRecordChange(currentRecord) {
if (currentRecord === undefined) { return }
let array = currentRecord.errors
if (array === undefined) { return }
for (let i = 0; i < array.length; i++) {
let arrayItem = array[i]
if (currentRecord.rateIndex === undefined) {
/*
The user is not pointing to any rate in particular, so we are
going to report all errors to the nodes involved.
*/
let array = currentRecord.errors
if (array === undefined) { return }
for (let i = 0; i < array.length; i++) {
let arrayItem = array[i]
let nodeId = arrayItem[0]
let errorMessage = arrayItem[1]
let docs = arrayItem[2]
applyValue(nodeId, errorMessage, docs)
}
} else {
/*
The user is pointing to a particular rate, so we are
going to report only that error and we will open the docs
to show the error's page.
*/
let array = currentRecord.errors
if (array === undefined) { return }
let arrayItem = array[currentRecord.rateIndex]
let nodeId = arrayItem[0]
let errorMessage = arrayItem[1]
let docs = arrayItem[2]
applyValue(nodeId, errorMessage, docs)
if (UI.projects.superalgos.spaces.docsSpace.sidePanelTab.isOpen === true) {
if (
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project !== docs.project ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category !== docs.category ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type !== docs.type ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId !== nodeId
) {
UI.projects.superalgos.spaces.docsSpace.navigateTo(
docs.project,
docs.category,
docs.type,
docs.anchor,
nodeId,
docs.placeholder
)
}
} else {
UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo(
docs.project,
docs.category,
docs.type,
docs.anchor,
nodeId,
docs.placeholder
)
}
}
}
@@ -2,7 +2,7 @@ function newPlotter() {
const MODULE_NAME = 'Plotter'
const ERROR_LOG = true
const logger = newWebDebugLog()
let thisObject = {
currentRecord: undefined,
@@ -521,9 +521,45 @@ function newPlotter() {
if (record[ratePropertyName] === undefined) {
currentRecordChanged()
} else {
/* Current Record depends also on rate */
if (record[ratePropertyName] >= minUserPositionRate && record[ratePropertyName] <= maxUserPositionRate) {
let rate
if (productDefinition.referenceParent.config.rateInArrayAtIndex !== undefined) {
/*
If this property is present, it means for us that the rate is not comming as
a property of the record object, but instead, the record object contains an
array at the property ratePropertyName, and inside that array there are other
arrays from where we need to find the rate at some of its records at the index
position determined by rateInArrayIndex
*/
let rateArray = record[ratePropertyName]
for (let i = 0; i < rateArray.length; i++) {
let rateArrayItem = rateArray[i]
let rate = rateArrayItem[productDefinition.referenceParent.config.rateInArrayAtIndex]
/*
We will try to find at which record is the mouse pointer close enough.
*/
if (rate >= minUserPositionRate && rate <= maxUserPositionRate) {
/*
We store the index found here so as to enable whoever receives this
record to know which record the user is pointing at.
*/
record.rateIndex = i
currentRecordChanged()
break
}
}
/*
If the User is not pointing to a rate in particular we are still going
to raise the event but without a rateindex property
*/
record.rateIndex = undefined
currentRecordChanged()
} else {
/*
Current Record depends that the mouse pointer is within a range close enought to the rate
*/
if (record[ratePropertyName] >= minUserPositionRate && record[ratePropertyName] <= maxUserPositionRate) {
currentRecordChanged()
}
}
}
} else {
@@ -861,7 +897,7 @@ function newPlotter() {
/* We use the datapoints already calculated. */
dataPoints = record.dataPoints
} else {
if (logged === false) {
if (logged === false) {
logged = true
}
let dataPoints = new Map()
@@ -873,7 +909,11 @@ function newPlotter() {
if (point.pointFormula !== undefined) {
let x = 0
let y = 0
eval(point.pointFormula.code)
try {
eval(point.pointFormula.code)
} catch (err) {
continue
}
let rawPoint = {
x: x,
y: y
@@ -112,10 +112,17 @@ function newSuperalgosDocsDocumentPage() {
}
async function repositionWorkspace() {
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category !== 'Workspace') { return }
let node
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category === 'Workspace') {
node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(thisObject.docsSchemaDocument.nodeId)
}
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId !== undefined) {
node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId)
}
if (node === undefined) { return }
let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(thisObject.docsSchemaDocument.nodeId)
node.payload.floatingObject.unCollapseParent()
setTimeout(positionAtNode, 0000, node)
setTimeout(positionAtNode, 3000, node)
setTimeout(positionAtNode, 5000, node)
function positionAtNode(node) {
@@ -620,7 +627,7 @@ function newSuperalgosDocsDocumentPage() {
let key = 'placeholded-paragraph-' + autoGeneratedParagraphIndex
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
return
return
} else {
return 'Property ' + propertyName + ' not found at the placeholder object. This means that within the info recieved, this information is not available.'
}