From e10465b04992dd3d252ae5e2d85867016d3eead4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 28 Nov 2020 12:30:06 +0100 Subject: [PATCH] processIndex everywhere --- .../Multi-Period-Daily/User.Bot.js | 2 +- .../Multi-Period-Market/User.Bot.js | 2 +- .../Multi-Period-Daily/User.Bot.js | 2 +- .../Multi-Period-Market/User.Bot.js | 2 +- .../Historic-OHLCVs/User.Bot.js | 2 +- .../Historic-Trades/User.Bot.js | 2 +- .../Webhooks-Sensor-Bot/Check-Webhook/User.Bot.js | 2 +- TaskServer/DataDependencies.js | 4 ++-- TaskServer/DataSet.js | 2 +- TaskServer/DebugLog.js | 2 +- TaskServer/IndicatorBot.js | 14 +++++++------- TaskServer/IndicatorOutput.js | 2 +- TaskServer/LowFrequencyTrading/TradingOutput.js | 4 ++-- TaskServer/LowFrequencyTrading/TradingProcess.js | 4 ++-- .../LowFrequencyTrading/TradingSimulation.js | 2 +- TaskServer/MultiPeriodDaily.js | 4 ++-- TaskServer/MultiPeriodMarket.js | 4 ++-- TaskServer/ProcessExecutionEvents.js | 2 +- TaskServer/ProcessInstance.js | 2 +- TaskServer/ReinforcementLearning/LearningBot.js | 12 ++++++------ .../ReinforcementLearning/LearningProcess.js | 4 ++-- TaskServer/SensorBot.js | 8 ++++---- TaskServer/StatusDependencies.js | 4 ++-- TaskServer/StatusReport.js | 2 +- TaskServer/TradingBot.js | 10 +++++----- 25 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js index 1d53c2675..bf3187377 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Daily/User.Bot.js @@ -1,4 +1,4 @@ -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { +exports.newUserBot = function (processIndex, bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { const FULL_LOG = true; const INTENSIVE_LOG = false; diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js index b8de69056..5081f0fee 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Bollinger-Bands-Indicator-Bot/Multi-Period-Market/User.Bot.js @@ -1,4 +1,4 @@ -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { +exports.newUserBot = function (processIndex, bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { const FULL_LOG = true; const LOG_FILE_CONTENT = false; diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js index 3eda0af20..fa20f7910 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Daily/User.Bot.js @@ -1,4 +1,4 @@ -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { +exports.newUserBot = function (processIndex, bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { const FULL_LOG = true; const LOG_FILE_CONTENT = false; diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js index 4fa3a1944..60d8ccd39 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Candles-Volumes-Indicator-Bot/Multi-Period-Market/User.Bot.js @@ -1,4 +1,4 @@ -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { +exports.newUserBot = function (processIndex, bot, logger, COMMONS, UTILITIES, FILE_STORAGE) { const FULL_LOG = true; const LOG_FILE_CONTENT = false; diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-OHLCVs/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-OHLCVs/User.Bot.js index 3aedb4622..e68b1f38d 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-OHLCVs/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-OHLCVs/User.Bot.js @@ -1,5 +1,5 @@  -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) { +exports.newUserBot = function (processIndex, bot, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) { const FULL_LOG = true; const GMT_SECONDS = ':00.000 GMT+0000'; diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-Trades/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-Trades/User.Bot.js index c8b33628b..45e1b9efd 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-Trades/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Exchange-Raw-Data-Sensor-Bot/Historic-Trades/User.Bot.js @@ -1,5 +1,5 @@  -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) { +exports.newUserBot = function (processIndex, bot, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) { const FULL_LOG = true; const LOG_FILE_CONTENT = false; diff --git a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Webhooks-Sensor-Bot/Check-Webhook/User.Bot.js b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Webhooks-Sensor-Bot/Check-Webhook/User.Bot.js index 3044340c0..892de7ee8 100644 --- a/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Webhooks-Sensor-Bot/Check-Webhook/User.Bot.js +++ b/Projects/Superalgos/Bots-Plotters-Code/Masters/bots/Webhooks-Sensor-Bot/Check-Webhook/User.Bot.js @@ -1,5 +1,5 @@  -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) { +exports.newUserBot = function (processIndex, bot, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) { const FULL_LOG = true; const LOG_FILE_CONTENT = false; diff --git a/TaskServer/DataDependencies.js b/TaskServer/DataDependencies.js index cfda35f87..8e0ccd8d3 100644 --- a/TaskServer/DataDependencies.js +++ b/TaskServer/DataDependencies.js @@ -1,4 +1,4 @@ -exports.newDataDependencies = function newDataDependencies(BOT, logger, DATA_SET) { +exports.newDataDependencies = function (processIndex, BOT, logger, DATA_SET) { const MODULE_NAME = "Data Dependencies"; @@ -75,7 +75,7 @@ let newNodeArray = [] for (let i = 0; i < thisObject.nodeArray.length; i++) { - let dataSetModule = DATA_SET.newDataSet(BOT, logger); + let dataSetModule = DATA_SET.newDataSet(processIndex, BOT, logger); dataSetModule.initialize(thisObject.nodeArray[i], onInitilized); function onInitilized(err, wasInitialized) { diff --git a/TaskServer/DataSet.js b/TaskServer/DataSet.js index 630dd572d..4d2bf6301 100644 --- a/TaskServer/DataSet.js +++ b/TaskServer/DataSet.js @@ -1,4 +1,4 @@ -exports.newDataSet = function newDataSet(BOT, logger) { +exports.newDataSet = function (processIndex, BOT, logger) { const MODULE_NAME = "Dataset"; diff --git a/TaskServer/DebugLog.js b/TaskServer/DebugLog.js index f7250e8c5..670694580 100644 --- a/TaskServer/DebugLog.js +++ b/TaskServer/DebugLog.js @@ -1,4 +1,4 @@ -exports.newDebugLog = function newDebugLog() { +exports.newDebugLog = function (processIndex) { const MODULE_NAME = "DebugLog"; diff --git a/TaskServer/IndicatorBot.js b/TaskServer/IndicatorBot.js index baca4bbd4..adc7b6b9b 100644 --- a/TaskServer/IndicatorBot.js +++ b/TaskServer/IndicatorBot.js @@ -106,7 +106,7 @@ if (logger !== undefined) { logger.finalize() } - logger = DEBUG_MODULE.newDebugLog(); + logger = DEBUG_MODULE.newDebugLog(processIndex); TS.projects.superalgos.globals.taskVariables.LOGGER_MAP.set(MODULE_NAME + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id, logger) logger.bot = bot; logger.initialize(); @@ -146,7 +146,7 @@ function initializeProcessExecutionEvents() { try { - processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(bot, logger) + processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex, bot, logger) processExecutionEvents.initialize(processConfig, onInizialized); function onInizialized(err) { @@ -247,7 +247,7 @@ function initializeStatusDependencies() { try { - statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); + statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); statusDependencies.initialize(onInizialized); function onInizialized(err) { @@ -295,7 +295,7 @@ function initializeDataDependencies() { try { - dataDependencies = DATA_DEPENDENCIES.newDataDependencies(bot, logger, DATA_SET); + dataDependencies = DATA_DEPENDENCIES.newDataDependencies(processIndex, bot, logger, DATA_SET); dataDependencies.initialize(onInizialized); function onInizialized(err) { @@ -310,12 +310,12 @@ switch (processConfig.framework.name) { case 'Multi-Period-Market': { - processFramework = MULTI_PERIOD_MARKET.newMultiPeriodMarket(bot, logger, UTILITIES, FILE_STORAGE); + processFramework = MULTI_PERIOD_MARKET.newMultiPeriodMarket(processIndex, bot, logger, UTILITIES, FILE_STORAGE); intitializeProcessFramework(); break; } case 'Multi-Period-Daily': { - processFramework = MULTI_PERIOD_DAILY.newMultiPeriodDaily(bot, logger, UTILITIES, FILE_STORAGE); + processFramework = MULTI_PERIOD_DAILY.newMultiPeriodDaily(processIndex, bot, logger, UTILITIES, FILE_STORAGE); intitializeProcessFramework(); break; } @@ -367,7 +367,7 @@ function initializeUserBot() { try { - usertBot = USER_BOT_MODULE.newUserBot(bot, logger, COMMONS_MODULE, UTILITIES, FILE_STORAGE); + usertBot = USER_BOT_MODULE.newUserBot(processIndex, bot, logger, COMMONS_MODULE, UTILITIES, FILE_STORAGE); usertBot.initialize(statusDependencies, onInizialized); function onInizialized(err) { diff --git a/TaskServer/IndicatorOutput.js b/TaskServer/IndicatorOutput.js index 167f6b29d..7f342caa0 100644 --- a/TaskServer/IndicatorOutput.js +++ b/TaskServer/IndicatorOutput.js @@ -1,4 +1,4 @@ -exports.newIndicatorOutput = function newIndicatorOutput(bot, logger, UTILITIES, FILE_STORAGE) { +exports.newIndicatorOutput = function (processIndex, bot, logger, UTILITIES, FILE_STORAGE) { const MODULE_NAME = "Indicator Bot"; let thisObject = { diff --git a/TaskServer/LowFrequencyTrading/TradingOutput.js b/TaskServer/LowFrequencyTrading/TradingOutput.js index f91ea5ef6..62e417ae4 100644 --- a/TaskServer/LowFrequencyTrading/TradingOutput.js +++ b/TaskServer/LowFrequencyTrading/TradingOutput.js @@ -1,4 +1,4 @@ -exports.newTradingOutput = function newTradingOutput(bot, logger, tradingEngineModule, UTILITIES, FILE_STORAGE) { +exports.newTradingOutput = function (processIndex, bot, logger, tradingEngineModule, UTILITIES, FILE_STORAGE) { /* This module will load if necesary all the data outputs so that they can be appended with new records if needed. After running the simulation, it will save all the data outputs. @@ -38,7 +38,7 @@ exports.newTradingOutput = function newTradingOutput(bot, logger, tradingEngineM /* Preparing everything for the Simulation */ const TRADING_SIMULATION = require('./TradingSimulation.js') - let tradingSimulation = TRADING_SIMULATION.newTradingSimulation(bot, logger, tradingEngineModule, UTILITIES) + let tradingSimulation = TRADING_SIMULATION.newTradingSimulation(processIndex, bot, logger, tradingEngineModule, UTILITIES) let outputDatasets = TS.projects.superalgos.utilities.nodeFunctions.nodeBrachToArray(bot.processNode.referenceParent.processOutput, 'Output Dataset') let outputDatasetsMap = new Map() diff --git a/TaskServer/LowFrequencyTrading/TradingProcess.js b/TaskServer/LowFrequencyTrading/TradingProcess.js index bad3a9ec6..e91e33f93 100644 --- a/TaskServer/LowFrequencyTrading/TradingProcess.js +++ b/TaskServer/LowFrequencyTrading/TradingProcess.js @@ -1,4 +1,4 @@ -exports.newTradingProcess = function newTradingProcess(bot, logger, UTILITIES) { +exports.newTradingProcess = function (processIndex, bot, logger, UTILITIES) { /* This Module will load all the process data dependencies from files and send them downstream. After execution, will save the time range and status report of the process. @@ -27,7 +27,7 @@ let tradingEngineModule = TRADING_ENGINE_MODULE.newTradingEngine(bot, logger) let TRADING_OUTPUT_MODULE = require("./TradingOutput") - let tradingOutputModule = TRADING_OUTPUT_MODULE.newTradingOutput(bot, logger, tradingEngineModule, UTILITIES, FILE_STORAGE) + let tradingOutputModule = TRADING_OUTPUT_MODULE.newTradingOutput(processIndex, bot, logger, tradingEngineModule, UTILITIES, FILE_STORAGE) let processConfig; diff --git a/TaskServer/LowFrequencyTrading/TradingSimulation.js b/TaskServer/LowFrequencyTrading/TradingSimulation.js index 9b6374946..5d6b8d82d 100644 --- a/TaskServer/LowFrequencyTrading/TradingSimulation.js +++ b/TaskServer/LowFrequencyTrading/TradingSimulation.js @@ -1,4 +1,4 @@ -exports.newTradingSimulation = function newTradingSimulation(bot, logger, tradingEngineModule, UTILITIES) { +exports.newTradingSimulation = function (processIndex, bot, logger, tradingEngineModule, UTILITIES) { /* This Module represents the trading simulacion. Escentially a loop through a set of candles and the execution at each loop cycle of the Trading System Protocol. diff --git a/TaskServer/MultiPeriodDaily.js b/TaskServer/MultiPeriodDaily.js index 2f6d1e87e..b2f028996 100644 --- a/TaskServer/MultiPeriodDaily.js +++ b/TaskServer/MultiPeriodDaily.js @@ -1,4 +1,4 @@ -exports.newMultiPeriodDaily = function newMultiPeriodDaily(bot, logger, UTILITIES, FILE_STORAGE) { +exports.newMultiPeriodDaily = function (processIndex, bot, logger, UTILITIES, FILE_STORAGE) { const MODULE_NAME = "Multi Period Daily"; const GMT_SECONDS = ':00.000 GMT+0000'; @@ -33,7 +33,7 @@ let INDICATOR_OUTPUT_MODULE = require("./IndicatorOutput") - indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(bot, logger, UTILITIES, FILE_STORAGE) + indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, bot, logger, UTILITIES, FILE_STORAGE) indicatorOutputModule.initialize(callBackFunction) } diff --git a/TaskServer/MultiPeriodMarket.js b/TaskServer/MultiPeriodMarket.js index b64a35468..32c43c75d 100644 --- a/TaskServer/MultiPeriodMarket.js +++ b/TaskServer/MultiPeriodMarket.js @@ -1,4 +1,4 @@ -exports.newMultiPeriodMarket = function newMultiPeriodMarket(bot, logger, UTILITIES, FILE_STORAGE) { +exports.newMultiPeriodMarket = function (processIndex, bot, logger, UTILITIES, FILE_STORAGE) { const MODULE_NAME = "Multi Period Market"; thisObject = { initialize: initialize, @@ -27,7 +27,7 @@ let INDICATOR_OUTPUT_MODULE = require("./IndicatorOutput") - indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(bot, logger, UTILITIES, FILE_STORAGE) + indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, bot, logger, UTILITIES, FILE_STORAGE) indicatorOutputModule.initialize(callBackFunction) } diff --git a/TaskServer/ProcessExecutionEvents.js b/TaskServer/ProcessExecutionEvents.js index 9ed8d1a25..e79bdd80b 100644 --- a/TaskServer/ProcessExecutionEvents.js +++ b/TaskServer/ProcessExecutionEvents.js @@ -1,4 +1,4 @@ -exports.newProcessExecutionEvents = function newProcessExecutionEvents(BOT, logger) { +exports.newProcessExecutionEvents = function (processIndex, BOT, logger) { /* Here we manage the process execution events. This allow us to emit events when the process starts and finishes. Also to wait for a dependent event diff --git a/TaskServer/ProcessInstance.js b/TaskServer/ProcessInstance.js index cfc2854b8..753b459e4 100644 --- a/TaskServer/ProcessInstance.js +++ b/TaskServer/ProcessInstance.js @@ -28,7 +28,7 @@ We will use a logger for what happens before and after the bot main loop. We will add the process id to its key so that it is unique and it can later be finalized. */ - let logger = DEBUG_MODULE.newDebugLog() + let logger = DEBUG_MODULE.newDebugLog(processIndex) TS.projects.superalgos.globals.taskVariables.LOGGER_MAP.set('Pre-Bot-Main-Loop' + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id, logger) logger.bot = botConfig; diff --git a/TaskServer/ReinforcementLearning/LearningBot.js b/TaskServer/ReinforcementLearning/LearningBot.js index 4550e5370..85dfb30d7 100644 --- a/TaskServer/ReinforcementLearning/LearningBot.js +++ b/TaskServer/ReinforcementLearning/LearningBot.js @@ -63,7 +63,7 @@ exports.newLearningBot = function newLearningBot(processIndex, bot, parentLogger if (logger !== undefined) { logger.finalize() } - logger = DEBUG_MODULE.newDebugLog(); + logger = DEBUG_MODULE.newDebugLog(processIndex); TS.projects.superalgos.globals.taskVariables.LOGGER_MAP.set(MODULE_NAME + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id, logger) logger.bot = bot; logger.initialize(); @@ -99,9 +99,9 @@ exports.newLearningBot = function newLearningBot(processIndex, bot, parentLogger if (bot.SESSION_STATUS === 'Running' && bot.STOP_SESSION === true) { bot.SESSION_STATUS = 'Stopped' - } + } - TS.projects.superalgos.functionLibraries.sessionFunctions.emitSessionStatus (bot.SESSION_STATUS, bot.sessionKey) + TS.projects.superalgos.functionLibraries.sessionFunctions.emitSessionStatus(bot.SESSION_STATUS, bot.sessionKey) /* Checking if we should process this loop or not.*/ if (bot.STOP_SESSION === true) { @@ -128,7 +128,7 @@ exports.newLearningBot = function newLearningBot(processIndex, bot, parentLogger function initializeProcessExecutionEvents() { try { - processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(bot, logger) + processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex, bot, logger) processExecutionEvents.initialize(processConfig, onInizialized); function onInizialized(err) { @@ -229,7 +229,7 @@ exports.newLearningBot = function newLearningBot(processIndex, bot, parentLogger function initializeStatusDependencies() { try { - statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); + statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); statusDependencies.initialize(onInizialized); function onInizialized(err) { @@ -277,7 +277,7 @@ exports.newLearningBot = function newLearningBot(processIndex, bot, parentLogger function initializeDataDependencies() { try { - dataDependencies = DATA_DEPENDENCIES.newDataDependencies(bot, logger, DATA_SET); + dataDependencies = DATA_DEPENDENCIES.newDataDependencies(processIndex, bot, logger, DATA_SET); dataDependencies.initialize(onInizialized); function onInizialized(err) { diff --git a/TaskServer/ReinforcementLearning/LearningProcess.js b/TaskServer/ReinforcementLearning/LearningProcess.js index b47a8557c..4e0d48ae4 100644 --- a/TaskServer/ReinforcementLearning/LearningProcess.js +++ b/TaskServer/ReinforcementLearning/LearningProcess.js @@ -1,4 +1,4 @@ -exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) { +exports.newLearningProcess = function (processIndex, bot, logger, UTILITIES) { /* This Module will load all the process data dependencies from files and send them downstream. After execution, will save the time range and status report of the process. @@ -27,7 +27,7 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) let markovDecisionProcessModule = MARKOV_DECISION_PROCESS_MODULE.newMarkovDecisionProcess(bot, logger) let ALGORITHM_MODULE = require("./Algorithm") - let algorithmModule = ALGORITHM_MODULE.newTradingOutput(bot, logger, markovDecisionProcessModule, UTILITIES, FILE_STORAGE) + let algorithmModule = ALGORITHM_MODULE.newTradingOutput(processIndex, bot, logger, markovDecisionProcessModule, UTILITIES, FILE_STORAGE) let processConfig; diff --git a/TaskServer/SensorBot.js b/TaskServer/SensorBot.js index 2b7e81684..e5335ad2c 100644 --- a/TaskServer/SensorBot.js +++ b/TaskServer/SensorBot.js @@ -113,7 +113,7 @@ if (logger !== undefined) { logger.finalize() } - logger = DEBUG_MODULE.newDebugLog(); + logger = DEBUG_MODULE.newDebugLog(processIndex); TS.projects.superalgos.globals.taskVariables.LOGGER_MAP.set(MODULE_NAME + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id, logger) logger.bot = bot; logger.initialize(); @@ -150,7 +150,7 @@ function initializeProcessExecutionEvents() { try { - processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(bot, logger) + processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex, bot, logger) processExecutionEvents.initialize(processConfig, onInizialized); function onInizialized(err) { @@ -252,7 +252,7 @@ function initializeStatusDependencies() { try { - statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); + statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); statusDependencies.initialize(onInizialized); function onInizialized(err) { @@ -300,7 +300,7 @@ function initializeUserBot() { try { - usertBot = USER_BOT_MODULE.newUserBot(bot, logger, COMMONS_MODULE, UTILITIES, FILE_STORAGE, STATUS_REPORT, exchangeAPI); + usertBot = USER_BOT_MODULE.newUserBot(processIndex, bot, logger, COMMONS_MODULE, UTILITIES, FILE_STORAGE, STATUS_REPORT, exchangeAPI); usertBot.initialize(statusDependencies, onInizialized); function onInizialized(err) { diff --git a/TaskServer/StatusDependencies.js b/TaskServer/StatusDependencies.js index aa5306320..1e8262b3b 100644 --- a/TaskServer/StatusDependencies.js +++ b/TaskServer/StatusDependencies.js @@ -1,4 +1,4 @@ -exports.newStatusDependencies = function newStatusDependencies(BOT, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT) { +exports.newStatusDependencies = function (processIndex, BOT, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT) { const MODULE_NAME = "Status Dependencies"; @@ -48,7 +48,7 @@ for (let i = 0; i < dependenciesToProcess.length; i++) { - let statusReportModule = STATUS_REPORT.newStatusReport(BOT, logger, UTILITIES, PROCESS_OUTPUT); + let statusReportModule = STATUS_REPORT.newStatusReport(processIndex, BOT, logger, UTILITIES, PROCESS_OUTPUT); logger.write(MODULE_NAME, "[INFO] initialize -> onInitilized -> Initializing Status Report # " + (i + 1)); let statusDependency = dependenciesToProcess[i] diff --git a/TaskServer/StatusReport.js b/TaskServer/StatusReport.js index c93ba9673..68177f377 100644 --- a/TaskServer/StatusReport.js +++ b/TaskServer/StatusReport.js @@ -1,4 +1,4 @@ -exports.newStatusReport = function newStatusReport(BOT, logger, UTILITIES, PROCESS_OUTPUT) { +exports.newStatusReport = function (processIndex, BOT, logger, UTILITIES, PROCESS_OUTPUT) { /* diff --git a/TaskServer/TradingBot.js b/TaskServer/TradingBot.js index 67005bbc3..364bd82b1 100644 --- a/TaskServer/TradingBot.js +++ b/TaskServer/TradingBot.js @@ -63,7 +63,7 @@ if (logger !== undefined) { logger.finalize() } - logger = DEBUG_MODULE.newDebugLog(); + logger = DEBUG_MODULE.newDebugLog(processIndex); TS.projects.superalgos.globals.taskVariables.LOGGER_MAP.set(MODULE_NAME + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id, logger) logger.bot = bot; logger.initialize(); @@ -128,7 +128,7 @@ function initializeProcessExecutionEvents() { try { - processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(bot, logger) + processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex, bot, logger) processExecutionEvents.initialize(processConfig, onInizialized); function onInizialized(err) { @@ -229,7 +229,7 @@ function initializeStatusDependencies() { try { - statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); + statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, bot, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT); statusDependencies.initialize(onInizialized); function onInizialized(err) { @@ -277,7 +277,7 @@ function initializeDataDependencies() { try { - dataDependencies = DATA_DEPENDENCIES.newDataDependencies(bot, logger, DATA_SET); + dataDependencies = DATA_DEPENDENCIES.newDataDependencies(processIndex, bot, logger, DATA_SET); dataDependencies.initialize(onInizialized); function onInizialized(err) { @@ -287,7 +287,7 @@ logger.write(MODULE_NAME, "[INFO] run -> loop -> initializeDataDependencies -> onInizialized -> Execution finished well.") switch (processConfig.framework.name) { case 'Low-Frequency-Trading-Process': { - processFramework = TRADING_PROCESS_MODULE.newTradingProcess(bot, logger, UTILITIES); + processFramework = TRADING_PROCESS_MODULE.newTradingProcess(processIndex, bot, logger, UTILITIES); intitializeProcessFramework(); break; }