diff --git a/Projects/Superalgos/Schemas/Docs-Concepts/node-js-javsacript.json b/Projects/Superalgos/Schemas/Docs-Concepts/node-js-javsacript.json new file mode 100644 index 000000000..f94e5c31d --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Concepts/node-js-javsacript.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-001-ts-trading-session-error-session-node-with no parameters.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-001-ts-trading-session-error-session-node-with no parameters.json new file mode 100644 index 000000000..7274781b1 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-001-ts-trading-session-error-session-node-with no parameters.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-002-ts-trading-session-error-initial-datetime-is not a valid date.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-002-ts-trading-session-error-initial-datetime-is not a valid date.json new file mode 100644 index 000000000..c04690bf4 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-002-ts-trading-session-error-initial-datetime-is not a valid date.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-003-ts-trading-session-error-final-datetime-is not a valid date.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-003-ts-trading-session-error-final-datetime-is not a valid date.json new file mode 100644 index 000000000..82513ab1d --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-trading-session-errors-003-ts-trading-session-error-final-datetime-is not a valid date.json @@ -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": "" + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js index b2f8fcaaf..ad6e9bea3 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/TradingSession.js @@ -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 } } diff --git a/Projects/Superalgos/TS/Function-Libraries/SessionFunctions.js b/Projects/Superalgos/TS/Function-Libraries/SessionFunctions.js index b5b3d6061..ffb4b9a42 100644 --- a/Projects/Superalgos/TS/Function-Libraries/SessionFunctions.js +++ b/Projects/Superalgos/TS/Function-Libraries/SessionFunctions.js @@ -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