global.FILE_PATH_ROOT eliminated

This commit is contained in:
Luis Fernando Molina committed 2018-03-18 10:07:45 +01:00
1 parent c9e3528cec
commit 0508a1e20c
5 files changed
+46 -32

No files matched your search

Binary file not shown.
+4 -4
View File
@@ -178,7 +178,7 @@
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> Entering function."); }
let fileName = "Execution.History.json"
let filePath = global.FILE_PATH_ROOT + "/Output/" + bot.process;
let filePath = bot.filePathRoot + "/Output/" + bot.process;
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> filePath = " + filePath); }
@@ -239,7 +239,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 = global.FILE_PATH_ROOT + "/Output/" + bot.process + '/' + dateForPath;
let filePath = bot.filePathRoot + "/Output/" + bot.process + '/' + dateForPath;
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> filePath = " + filePath); }
@@ -399,7 +399,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 = global.FILE_PATH_ROOT + "/Output/" + bot.process + '/' + dateForPath;
let filePath = bot.filePathRoot + "/Output/" + bot.process + '/' + dateForPath;
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> filePath = " + filePath); }
@@ -459,7 +459,7 @@
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> Entering function."); }
let fileName = "Execution.History.json"
let filePath = global.FILE_PATH_ROOT + "/Output/" + bot.process;
let filePath = bot.filePathRoot + "/Output/" + bot.process;
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> filePath = " + filePath); }
+35 -27
View File
@@ -25,35 +25,12 @@ global.EXCHANGE_SIMULATION_MODE = JSON.parse(global.PLATFORM_CONFIG.exchangeSimu
global.STORAGE_CONN_STRING_FOLDER = global.PLATFORM_CONFIG.storageConnStringFolder; // 'Testnet', 'Mixed' or 'Production', or whatever folder name the conn strings files are into.
/* Now we will read the config of the bot from the path we obtained on the VM config. */
let botConfig;
try {
botConfig = JSON.parse(fs.readFileSync(global.PLATFORM_CONFIG.bot.path + '/this.bot.config.json', 'utf8'));
}
catch (err) {
console.log("[ERROR] 'readConfig' - ERROR : " + err.message);
return;
}
let bot = { // TODO > REPLACE THIS FOR THE ENTIRE BOT CONFIGURATION. NOTE THAT NAME NOW IS CODENAME
"name": botConfig.displayName,
"type": botConfig.type,
"version": botConfig.version,
"devTeam": botConfig.devTeam
};
/* Now we will run according to what we see at the config file. */
const ROOT_DIR = './';
const MODULE_NAME = "Run";
const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log');
const logger = DEBUG_MODULE.newDebugLog();
logger.fileName = MODULE_NAME;
logger.bot = botConfig;
process.on('uncaughtException', function (err) {
logger.write('uncaughtException - ' + err.message);
@@ -140,9 +117,6 @@ global.dailyFilePeriods =
global.dailyFilePeriods = JSON.parse(global.dailyFilePeriods);
/* File Path Root */
global.FILE_PATH_ROOT = botConfig.devTeam + "/" + botConfig.codeName + "." + botConfig.version.major + "." + botConfig.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + botConfig.dataSetVersion;
/* Loop Counter */
@@ -162,6 +136,40 @@ const TRADING_BOT_MAIN_LOOP_MODULE = require('./Trading Bot Main Loop');
const INDICATOR_BOT_MAIN_LOOP_MODULE = require('./Indicator Bot Main Loop');
const EXTRACTION_BOT_MAIN_LOOP_MODULE = require('./Extraction Bot Main Loop');
/* Loop through all the processes configured to be run by this Node.js Instance. */
let logger;
for (let p = 0; p < global.PLATFORM_CONFIG.executionList; p++) {
let listItem = PLATFORM_CONFIG.executionList[p];
/* Now we will read the config of the bot from the path we obtained at the AACloud config. */
let botConfig;
try {
botConfig = JSON.parse(fs.readFileSync(global.PLATFORM_CONFIG.bot.path + '/this.bot.config.json', 'utf8'));
}
catch (err) {
console.log("[ERROR] 'readConfig' - ERROR : " + err.message);
return;
}
logger = DEBUG_MODULE.newDebugLog();
logger.fileName = MODULE_NAME;
logger.bot = botConfig;
/* File Path Root */
bot.filePathRoot
botConfig.filePathRoot = botConfig.devTeam + "/" + botConfig.codeName + "." + botConfig.version.major + "." + botConfig.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + botConfig.dataSetVersion;
}
/* Now we will see which are the script Arguments. We expect the name of the process to run, since that is what it should be defined at the Task Scheduller. */
let processToRun = process.argv[2];
@@ -226,7 +234,7 @@ for (let i = 0; i < botConfig.processes.length; i++) {
let month = pad((new Date()).getUTCMonth() + 1, 2);
let year = (new Date()).getUTCFullYear();
switch (bot.type) {
switch (botConfig.type) {
case 'Extraction': {
runExtractionBot(processConfig, month, year);
return;
+1 -1
View File
@@ -173,7 +173,7 @@
}
let fileName = "Status.Report.json"
let filePath = global.FILE_PATH_ROOT + "/Reports/" + owner.process + timePath;
let filePath = bot.filePathRoot + "/Reports/" + owner.process + timePath;
if (FULL_LOG === true) { logger.write("[INFO] save -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] save -> filePath = " + filePath); }
+6
View File
@@ -8,6 +8,12 @@
"bot": {
"path": "../Bots/AAMasters/AAMariam-Trading-Bot"
},
"executionList": [
{
"botPath": "../Bots/AAMasters/AAMariam-Trading-Bot",
"process": "Trading-Process"
}
],
"stopGracefully": "false",
"exchangeSimulationMode": "false",
"storageConnStringFolder": "Production",