Merge pull request #452 from Luis-Fernando-Molina/develop

Contribution: Session Errors Handling / UX improved
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-01-23 10:29:11 +01:00
commit e37e86e571
8 files changed
+149 -12

No files matched your search

@@ -14,8 +14,16 @@
},
{
"style": "Title",
"text": "Example",
"updated": 1611332609003
"text": "Property Missing",
"updated": 1611392835535
},
{
"style": "Json",
"text": "label"
},
{
"style": "Title",
"text": "Example"
},
{
"style": "Json",
@@ -9,8 +9,16 @@
"paragraphs": [
{
"style": "Success",
"text": "Check the config at the Node reporting this error and make sure that this property exists. ",
"updated": 1611335725336
"text": "Check the config at the Node reporting this error and make sure that this property exists.",
"updated": 1611392878438
},
{
"style": "Title",
"text": "Property Missing"
},
{
"style": "Json",
"text": "initialBalance"
}
]
}
@@ -0,0 +1,16 @@
{
"topic": "TS Trading Session Errors",
"pageNumber": "10",
"type": "TS Trading Session Error - Key Reference Node Missing",
"definition": {
"text": "For a Live Trading Session or a Forward Testing Session you need to provide an Exchange API Key to access your Exchange account. In order to do that you need to add a Key Reference Node which references an Exchange Account Key Node with your keys.",
"updated": 1611392529450
},
"paragraphs": [
{
"style": "Success",
"text": "At the Task Node where this error poped up, add a Key Reference Node and reference from it an Exchange Account Key with it. Then you can try to run the Trading Session again.",
"updated": 1611392617497
}
]
}
@@ -0,0 +1,16 @@
{
"topic": "TS Trading Session Errors",
"pageNumber": "11",
"type": "TS Trading Session Error - Exchange Account Key Node Missing",
"definition": {
"text": "An Exchange Account Key Node is expected and needed in order to run a Live Trading Session or an Forward Testing Session.",
"updated": 1611392704049
},
"paragraphs": [
{
"style": "Success",
"text": "From the Key Reference Node where this error poped up, you need to reference an Account Exchange Key holding your keys to access your account at the Exchange.",
"updated": 1611392779124
}
]
}
@@ -0,0 +1,24 @@
{
"topic": "TS Trading Session Errors",
"pageNumber": "12",
"type": "TS Trading Session Error - Codename Property Missing",
"definition": {
"text": "A property called codeName is expeceted at the Exchange Account Key Node config.",
"updated": 1611392953689
},
"paragraphs": [
{
"style": "Success",
"text": "Add this property and assign to it the value of your account key taken from the Exchange website.",
"updated": 1611393012580
},
{
"style": "Title",
"text": "Property Missing"
},
{
"style": "Json",
"text": "codeName"
}
]
}
@@ -0,0 +1,24 @@
{
"topic": "TS Trading Session Errors",
"pageNumber": "13",
"type": "TS Trading Session Error - Secret Property Missing",
"definition": {
"text": "A property called secret is expeceted at the Exchange Account Key Node config.",
"updated": 1611393059925
},
"paragraphs": [
{
"style": "Success",
"text": "Add this property and assign to it the value of your account key secret taken from the Exchange website.",
"updated": 1611393087867
},
{
"style": "Title",
"text": "Property Missing"
},
{
"style": "Json",
"text": " secret"
}
]
}
@@ -517,31 +517,63 @@
function checkKey() {
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference === undefined) {
let errorMessage = "Key Reference not defined. Please check that and try again."
let errorMessage = "Key Reference Node Missing"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[ERROR] initialize -> checkKey -> " + errorMessage)
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage)
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS Trading Session Error - ' + errorMessage,
placeholder: {}
}
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE, errorMessage, docs)
return false
}
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent === undefined) {
let errorMessage = "Key Reference not referencing an Exchange Account Key. Please check that and try again."
let errorMessage = "Exchange Account Key Node Missing"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[ERROR] initialize -> checkKey -> " + errorMessage)
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage)
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS Trading Session Error - ' + errorMessage,
placeholder: {}
}
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference, errorMessage, docs)
return false
}
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.codeName === undefined) {
let errorMessage = "Key 'codeName' undefined. Paste there you key. Please check that and try again."
let errorMessage = "Codename Property Missing"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[ERROR] initialize -> checkKey -> " + errorMessage)
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage)
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS Trading Session Error - ' + errorMessage,
placeholder: {}
}
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent, errorMessage, docs)
return false
}
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.secret === undefined) {
let errorMessage = "Key 'secret' undefined. Paste there you key secret. Please check that and try again."
let errorMessage = "Secret Property Missing"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[ERROR] initialize -> checkKey -> " + errorMessage)
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage)
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS Trading Session Error - ' + errorMessage,
placeholder: {}
}
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent, errorMessage, docs)
return false
}
return true
@@ -77,6 +77,15 @@ exports.newSuperalgosFunctionLibrariesSessionFunctions = function () {
TS.projects.superalgos.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT.raiseEvent(
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_KEY, 'Error', event)
if (node !== undefined && node.id !== TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.id) {
event = {
warningMessage: "Session could not be ran. Check the Workspace Map for Nodes with errors."
}
TS.projects.superalgos.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT.raiseEvent(
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_KEY, 'Warning', event)
}
if (TS.projects.superalgos.globals.taskVariables.IS_TASK_STOPPING === true) {
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).IS_SESSION_STOPPING = true
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[IMPORTANT] sessionError -> Stopping the Session now. ')