Trading Session Errors Topic

This commit is contained in:
Luis Fernando Molina committed 2021-01-22 15:04:36 +01:00
1 parent d4a811a449
commit 9ca921e8c3
6 files changed
+114 -10

No files matched your search

@@ -0,0 +1,14 @@
{
"type": "Node JS Javsacript",
"definition": {
"text": "A Task in Superalgos runs in Node JS, which means that the Conditions and Formulas you write at your Trading System must comply with Javascript for Node JS syntax. ",
"updated": 1611323749488
},
"paragraphs": [
{
"style": "Text",
"text": "The same is true for properties values in configs. They need to be valid data types of Javascript for Node JS.",
"updated": 1611323797820
}
]
}
@@ -0,0 +1,16 @@
{
"topic": "TS Trading Session Errors",
"pageNumber": "1",
"type": "TS Trading Session Error - Session Node With No Parameters",
"definition": {
"text": "The Backtesting Session, Live Trading Session, Paper Trading Session and Forward Testing Session nodes are expected to have a child of type Trading Parameters, and in this case it could not be found.",
"updated": 1611322334493
},
"paragraphs": [
{
"style": "Success",
"text": "To fix this, add a Trading Parameters child and try again.",
"updated": 1611322031139
}
]
}
@@ -0,0 +1,21 @@
{
"topic": "TS Trading Session Errors",
"pageNumber": "2",
"type": "TS Trading Session Error - Initial Datetime Is Not A Valid Date",
"definition": {
"text": "The initialDatetime property configured at the Time Range node is not recongnized as a valid Javascript Datetime.",
"updated": 1611322806779
},
"paragraphs": [
{
"style": "Text",
"text": "The validation of sessionParameters.timeRange.config.initialDatetime did not pass, and therefore the Trading Session can not run.",
"updated": 1611322904690
},
{
"style": "Success",
"text": "Check Node JS Javsacript docs to learn how to correctly express a datetime value.",
"updated": 1611323830743
}
]
}
@@ -0,0 +1,25 @@
{
"topic": "TS Trading Session Errors",
"pageNumber": "3",
"type": "TS Trading Session Error - Final Datetime Is Not A Valid Date",
"definition": {
"text": "The finalDatetime property configured at the Time Range node is not recongnized as a valid Javascript Datetime.",
"updated": 1611323471271
},
"paragraphs": [
{
"style": "Text",
"text": "The validation of sessionParameters.timeRange.config.finalDatetime did not pass, and therefore the Trading Session can not run.",
"updated": 1611323500247
},
{
"style": "Success",
"text": "Check Node JS Javsacript docs to learn how to correctly express a datetime value.",
"updated": 1611323848427
},
{
"style": "Text",
"text": ""
}
]
}
@@ -222,13 +222,22 @@
*/
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters === undefined) {
let errorMessage = "Session Node with no Parameters."
let errorMessage = "Session Node With No Parameters"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[ERROR] initialize -> checkParemeters -> " + 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.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE,
errorMessage
errorMessage,
docs
)
return false
}
@@ -247,18 +256,34 @@
/* Check that we received valid dates */
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type === 'Backtesting Session') {
if (isNaN(new Date(TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.initialDatetime)).valueOf()) {
let errorMessage = "sessionParameters.timeRange.config.initialDatetime is not a valid date."
let errorMessage = "Initial Datetime Is Not A Valid Date"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[ERROR] initialize -> checkParemeters -> " + errorMessage)
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters, 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.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange, errorMessage, docs)
return false
}
}
if (isNaN(new Date(TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange.config.finalDatetime)).valueOf()) {
let errorMessage = "sessionParameters.timeRange.config.initialDatetime is not a valid date."
let errorMessage = "Final Datetime Is Not A Valid Date"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[ERROR] initialize -> checkParemeters -> " + errorMessage)
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters, 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.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeRange, errorMessage, docs)
return false
}
}
@@ -58,21 +58,24 @@ exports.newSuperalgosFunctionLibrariesSessionFunctions = function () {
}
}
function sessionError(processIndex, node, errorMessage) {
function sessionError(processIndex, node, errorMessage, docs) {
let event
if (node !== undefined) {
event = {
nodeName: node.name,
nodeType: node.type,
nodeId: node.id,
errorMessage: errorMessage
errorMessage: errorMessage,
docs: docs
}
} else {
event = {
errorMessage: errorMessage
errorMessage: errorMessage,
docs: docs
}
}
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)
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 (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