Process Constants

This commit is contained in:
Luis Fernando Molina committed 2020-11-30 12:06:29 +01:00
1 parent 789b97bc20
commit 772b106325
7 files changed
+38 -8

No files matched your search

+6
View File
@@ -350,6 +350,12 @@
"functionName": "newSuperalgosGlobalsProcessVariables",
"fileName": "ProcessVariables.js"
},
{
"name": "Process Constants",
"propertyName": "processConstants",
"functionName": "newSuperalgosGlobalsProcessConstants",
"fileName": "ProcessConstants.js"
},
{
"name": "Task Variables",
"propertyName": "taskVariables",
@@ -0,0 +1,19 @@
exports.newSuperalgosGlobalsProcessConstants = function () {
let thisObject = {
CONSTANTS_BY_PROCESS_INDEX_MAP: new Map()
}
/*
CONSTANTS_BY_PROCESS_INDEX_MAP
What it is stored here depends very much on what the process is about and what it needs to do. Following
is a list of known properties of this object.
TRADING_SYSTEM_NODE This is a Trading System node structure.
TRADING_ENGINE_NODE This is a Trading Engine node structure.
TRADING_SESSION_NODE This is a Trading Session node structure.
DEPENDENCY_FILTER This is the counter of main loops for a bot process.
*/
return thisObject
}
+2 -2
View File
@@ -79,8 +79,8 @@ exports.newLearningSession = function (processIndex, bot, parentLogger) {
}
/* We are going to run the Definition comming at the event. */
bot.TRADING_SYSTEM = JSON.parse(message.event.tradingSystem)
bot.TRADING_ENGINE = JSON.parse(message.event.tradingEngine)
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_SYSTEM_NODE = JSON.parse(message.event.tradingSystem)
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_ENGINE_NODE = JSON.parse(message.event.tradingEngine)
bot.LEARNING_SESSION = JSON.parse(message.event.session)
bot.DEPENDENCY_FILTER = JSON.parse(message.event.dependencyFilter)
bot.RESUME = false
@@ -87,8 +87,8 @@
/*
Here is where the Trading Engine and Trading Systems received are moved to the simulation state.
*/
bot.simulationState.tradingEngine = bot.TRADING_ENGINE
bot.simulationState.tradingSystem = bot.TRADING_SYSTEM
bot.simulationState.tradingEngine = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_ENGINE_NODE
bot.simulationState.tradingSystem = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_SYSTEM_NODE
}
/* We set up the Trading Engine Module. */
+5
View File
@@ -45,6 +45,11 @@
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id
}
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.set(processIndex, VARIABLES_BY_PROCESS_INDEX)
/*
There are also a few constants at the process level. We initialize them here.
*/
let CONSTANTS_BY_PROCESS_INDEX = {}
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.set(processIndex, CONSTANTS_BY_PROCESS_INDEX)
/* File Path Root */
botConfig.filePathRoot =
@@ -87,8 +87,8 @@ exports.newLearningProcess = function (processIndex, bot, logger, UTILITIES) {
/*
Here is where the Trading Engine and Trading Systems received are moved to the simulation state.
*/
bot.simulationState.tradingEngine = bot.TRADING_ENGINE
bot.simulationState.tradingSystem = bot.TRADING_SYSTEM
bot.simulationState.tradingEngine = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_ENGINE_NODE
bot.simulationState.tradingSystem = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_SYSTEM_NODE
}
/* We set up the Trading Engine Module. */
+2 -2
View File
@@ -80,8 +80,8 @@
}
/* We are going to run the Definition comming at the event. */
bot.TRADING_SYSTEM = JSON.parse(message.event.tradingSystem)
bot.TRADING_ENGINE = JSON.parse(message.event.tradingEngine)
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_SYSTEM_NODE = JSON.parse(message.event.tradingSystem)
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_ENGINE_NODE = JSON.parse(message.event.tradingEngine)
bot.TRADING_SESSION = JSON.parse(message.event.session)
bot.DEPENDENCY_FILTER = JSON.parse(message.event.dependencyFilter)
bot.RESUME = false