diff --git a/.vs/AACloudPlatform/v15/.suo b/.vs/AACloudPlatform/v15/.suo index 403f0e921..ddf647c79 100644 Binary files a/.vs/AACloudPlatform/v15/.suo and b/.vs/AACloudPlatform/v15/.suo differ diff --git a/Context.js b/Context.js index fb5d787c5..826341bbe 100644 --- a/Context.js +++ b/Context.js @@ -147,7 +147,7 @@ if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> Entering function."); } let fileName = "Status.Report.json" - let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.EXCHANGE_NAME; + let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor; if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> fileName = " + fileName); } if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> filePath = " + filePath); } @@ -205,7 +205,7 @@ if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> Entering function."); } let fileName = "Execution.History.json" - let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME; + let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor; if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> fileName = " + fileName); } if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> filePath = " + filePath); } @@ -266,7 +266,7 @@ let fileName = "Execution.Context.json" let dateForPath = date.getUTCFullYear() + '/' + utilities.pad(date.getUTCMonth() + 1, 2) + '/' + utilities.pad(date.getUTCDate(), 2) + '/' + utilities.pad(date.getUTCHours(), 2) + '/' + utilities.pad(date.getUTCMinutes(), 2); - let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME + "/" + dateForPath; + let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + dateForPath; if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> fileName = " + fileName); } if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> filePath = " + filePath); } @@ -426,7 +426,7 @@ let fileName = "Execution.Context.json" let dateForPath = global.processDatetime.getUTCFullYear() + '/' + utilities.pad(global.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(global.processDatetime.getUTCDate(), 2) + '/' + utilities.pad(global.processDatetime.getUTCHours(), 2) + '/' + utilities.pad(global.processDatetime.getUTCMinutes(), 2); - let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME + "/" + dateForPath; + let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + dateForPath; if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> fileName = " + fileName); } if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> filePath = " + filePath); } @@ -486,7 +486,7 @@ if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> Entering function."); } let fileName = "Execution.History.json" - let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME; + let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor; if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> fileName = " + fileName); } if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> filePath = " + filePath); } @@ -562,7 +562,7 @@ if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> Entering function."); } let fileName = "Status.Report.json" - let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.EXCHANGE_NAME; + let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor; if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> fileName = " + fileName); } if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> filePath = " + filePath); } diff --git a/Debug Log.js b/Debug Log.js index 2abaf5cdd..3212264e3 100644 --- a/Debug Log.js +++ b/Debug Log.js @@ -40,11 +40,11 @@ createFolderSync(folderPath); - folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "/" + thisObject.bot.version; + folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor; createFolderSync(folderPath); - folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "/" + thisObject.bot.version + "/" + thisObject.bot.process; + folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor + "/" + thisObject.bot.process; createFolderSync(folderPath); diff --git a/Project.njsproj b/Project.njsproj index 1eb413ca3..f88c2ef97 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -45,7 +45,7 @@ - + diff --git a/Run.js b/Run.js index 76c1b44eb..4f8d1c7db 100644 --- a/Run.js +++ b/Run.js @@ -8,11 +8,10 @@ global.RUNNING_MODE = 'Production'; // 'Testnet' or 'Production' /* First thing to do is to read the config and guess which bot we will be running. */ var fs = require('fs'); -let vmConfig; try { - vmConfig = JSON.parse(fs.readFileSync('this.vm.config.json', 'utf8')); + global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('platform.config.json', 'utf8')); } catch (err) { @@ -28,7 +27,7 @@ let botConfig; try { - botConfig = JSON.parse(fs.readFileSync(vmConfig.bot.path + '/this.bot.config.json', 'utf8')); + botConfig = JSON.parse(fs.readFileSync(global.PLATFORM_CONFIG.bot.path + '/this.bot.config.json', 'utf8')); } catch (err) { console.log("[ERROR] 'readConfig' - ERROR : " + err.message); @@ -167,7 +166,7 @@ for (let i = 0; i < botConfig.processes.length; i++) { const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot); - newIntervalExecutor.initialize(vmConfig.bot.path, processConfig, year, month, onInitializeReady); + newIntervalExecutor.initialize(global.PLATFORM_CONFIG.bot.path, processConfig, year, month, onInitializeReady); function onInitializeReady() { @@ -192,7 +191,7 @@ for (let i = 0; i < botConfig.processes.length; i++) { const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot); - newIntervalExecutor.initialize(vmConfig.bot.path, processConfig, processConfig.startMode.oneMonth.year, processConfig.startMode.oneMonth.month, onInitializeReady); + newIntervalExecutor.initialize(global.PLATFORM_CONFIG.bot.path, processConfig, processConfig.startMode.oneMonth.year, processConfig.startMode.oneMonth.month, onInitializeReady); function onInitializeReady() { @@ -218,7 +217,7 @@ for (let i = 0; i < botConfig.processes.length; i++) { const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot); - newIntervalExecutor.initialize(vmConfig.bot.path, processConfig, undefined, undefined, onInitializeReady); + newIntervalExecutor.initialize(global.PLATFORM_CONFIG.bot.path, processConfig, undefined, undefined, onInitializeReady); function onInitializeReady() { @@ -243,7 +242,7 @@ function runTradingBot(pProcessConfig) { if (FULL_LOG === true) { logger.write("[INFO] runTradingBot -> Entering function."); } let tradingBotMainLoop = TRADING_BOT_MAIN_LOOP_MODULE.newTradingBotMainLoop(botConfig); - tradingBotMainLoop.initialize(vmConfig.bot.path, pProcessConfig, onInitializeReady); + tradingBotMainLoop.initialize(global.PLATFORM_CONFIG.bot.path, pProcessConfig, onInitializeReady); function onInitializeReady(err) { diff --git a/Trading Bot Main Loop.js b/Trading Bot Main Loop.js index 10b5840e3..e4da9c327 100644 --- a/Trading Bot Main Loop.js +++ b/Trading Bot Main Loop.js @@ -352,12 +352,11 @@ function shallWeStop() { var fs = require('fs'); - let vmConfig; try { - vmConfig = JSON.parse(fs.readFileSync('this.vm.config.json', 'utf8')); - return JSON.parse(vmConfig.stopGracefully); + global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('platform.config.json', 'utf8')); + return JSON.parse(global.PLATFORM_CONFIG.stopGracefully); } catch (err) { const logText = "[ERROR] 'readConfig' - ERROR : " + err.message; diff --git a/this.vm.config.json b/platform.config.json similarity index 50% rename from this.vm.config.json rename to platform.config.json index aa2288eab..95ce357d7 100644 --- a/this.vm.config.json +++ b/platform.config.json @@ -1,4 +1,10 @@ { + "codeName": "AACloudPlatform", + "version": { + "major": 1, + "minor": 0, + "patch": 0 + }, "bot": { "path": "../Bots/AAMasters/AAMariam-Trading-Bot" },