diff --git a/.vs/AACloudPlatform/v15/.suo b/.vs/AACloudPlatform/v15/.suo index 546a02397..01866f77d 100644 Binary files a/.vs/AACloudPlatform/v15/.suo and b/.vs/AACloudPlatform/v15/.suo differ diff --git a/Assistant.js b/Assistant.js index 315cfcdf1..00f591499 100644 --- a/Assistant.js +++ b/Assistant.js @@ -41,7 +41,7 @@ try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } /* Store local values. */ diff --git a/Azure File Storage.js b/Azure File Storage.js index d21834109..62e538245 100644 --- a/Azure File Storage.js +++ b/Azure File Storage.js @@ -37,7 +37,7 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) { function initialize(pDataOwnerBotCodeName, callBackFunction) { try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } if (pDataOwnerBotCodeName === undefined) { dataOwner = bot.codeName; @@ -72,7 +72,7 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) { function createFolder(pFolderPath, callBackFunction) { - if (LOG_INFO === true) { logger.write("[INFO] createFolder -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] createFolder -> Entering function."); } if (fileService === undefined) { @@ -165,7 +165,7 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) { callBackFunction(global.DEFAULT_FAIL_RESPONSE); } else { - if (LOG_INFO === true) { logger.write("[INFO] createTextFile -> onFileCreated -> File Created."); } + if (FULL_LOG === true) { logger.write("[INFO] createTextFile -> onFileCreated -> File Created."); } callBackFunction(global.DEFAULT_OK_RESPONSE); } } @@ -234,7 +234,7 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) { callBackFunction(global.DEFAULT_FAIL_RESPONSE); } else { - if (LOG_INFO === true) { logger.write("[INFO] getTextFile -> onFileReceived -> File retrieved."); } + if (FULL_LOG === true) { logger.write("[INFO] getTextFile -> onFileReceived -> File retrieved."); } callBackFunction(global.DEFAULT_OK_RESPONSE, text); } } diff --git a/Context.js b/Context.js index 057f67117..17cb9412f 100644 --- a/Context.js +++ b/Context.js @@ -73,7 +73,7 @@ try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } /* @@ -81,6 +81,7 @@ of the process. */ + initializeStorage(); function initializeStorage() { @@ -135,7 +136,7 @@ try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> getStatusReport -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> Entering function."); } /* If the process run and was interrupted, there should be a status report that allows us to resume execution. */ @@ -152,7 +153,7 @@ return; } - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> onFileReceived -> Content received = " + text); } @@ -190,7 +191,7 @@ function getExecutionHistory(callBack) { try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> getExecutionHistory -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> Entering function."); } let fileName = "Execution.History.json" let filePath = EXCHANGE_NAME + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process; @@ -205,7 +206,7 @@ return; } - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> onFileReceived -> Content received = " + text); } @@ -238,7 +239,7 @@ function getExecutionContext(callBack) { try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> getExecutionContext -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> Entering function."); } let date = new Date(thisObject.statusReport.lastExecution); @@ -256,7 +257,7 @@ return; } - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> onFileReceived -> Content received = " + text); } @@ -290,7 +291,7 @@ function createConext(callBack) { try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> createConext -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> createConext -> Entering function."); } /* When the bot is executed for the very first time, there are a few files that do not exist and need to be created, and that @@ -364,7 +365,7 @@ function writeExecutionContext(callBack) { - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> Entering function."); } @@ -398,7 +399,7 @@ return; } - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> onFolderCreated -> onFileCreated -> Content written = " + fileContent); } @@ -420,7 +421,7 @@ function writeExucutionHistory(callBack) { - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> Entering function."); } @@ -463,7 +464,7 @@ return; } - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> onFolderCreated -> onFileCreated -> Content written = " + fileContent); } @@ -485,7 +486,7 @@ function writeStatusReport(callBack) { - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> Entering function."); } @@ -520,7 +521,7 @@ return; } - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> onFolderCreated -> onFileCreated -> Content written = " + fileContent); } diff --git a/Datasource.js b/Datasource.js index ad07b8d8b..e5640df49 100644 --- a/Datasource.js +++ b/Datasource.js @@ -62,7 +62,7 @@ try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } initializeOliviaStorage(); diff --git a/ExchangeAPI.js b/ExchangeAPI.js index 89ee69159..0cf8b0ed0 100644 --- a/ExchangeAPI.js +++ b/ExchangeAPI.js @@ -31,7 +31,7 @@ try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } let apiKey = readApiKey(); poloniexApiClient = new POLONIEX_CLIENT_MODULE(apiKey.Key, apiKey.Secret); diff --git a/Interval Executor.js b/Interval Executor.js index 22c29800b..70b4a433e 100644 --- a/Interval Executor.js +++ b/Interval Executor.js @@ -4,7 +4,7 @@ const ROOT_DIR = './'; const MODULE_NAME = "Interval Executor"; - const LOG_INFO = true; + const FULL_LOG = true; let INTERVAL_MODULE; @@ -79,13 +79,13 @@ if (year !== undefined) { - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] Entering function 'start', with year = " + year + " and month = " + month); } } else { - if (LOG_INFO === true) { + if (FULL_LOG === true) { logger.write("[INFO] Entering function 'start'."); } @@ -109,7 +109,7 @@ try { - if (LOG_INFO === true) { + if (FULL_LOG === true) { if (processConfig.intervalMaxLoops !== 0) { diff --git a/Run.js b/Run.js index 5a23a5921..f237d2f75 100644 --- a/Run.js +++ b/Run.js @@ -1,5 +1,5 @@  -const LOG_INFO = true; +const FULL_LOG = true; /* The following global variable tells the system if it is running on test mode or production. */ @@ -192,7 +192,7 @@ for (let i = 0; i < botConfig.processes.length; i++) { function runTradingBot(pProcessConfig) { try { - if (LOG_INFO === true) { logger.write("[INFO] runTradingBot -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] runTradingBot -> Entering function."); } let tradingBot = TRADING_BOT_MODULE.newTradingBot(botConfig); tradingBot.initialize(vmConfig.bot.path, pProcessConfig, onInitializeReady); @@ -203,9 +203,9 @@ function runTradingBot(pProcessConfig) { tradingBot.start(whenStartFinishes); - function whenStartFinishes() { + function whenStartFinishes(err) { - if (err.result !== global.DEFAULT_OK_RESPONSE.result) { + if (err.result === global.DEFAULT_OK_RESPONSE.result) { logger.write("[INFO] trading bot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully. :-)"); diff --git a/TradingBot.js b/TradingBot.js index bcbd12729..dee106d1b 100644 --- a/TradingBot.js +++ b/TradingBot.js @@ -4,7 +4,7 @@ const ROOT_DIR = './'; const MODULE_NAME = "Trading Bot"; - const LOG_INFO = true; + const FULL_LOG = true; let USER_BOT_MODULE; @@ -25,7 +25,7 @@ function initialize(pBotPath, pProcessConfig, callBackFunction) { try { - if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } processConfig = pProcessConfig; USER_BOT_MODULE = require(pBotPath + "/" + pProcessConfig.name + "/" + 'User.Bot'); @@ -41,20 +41,19 @@ function start(callBackFunction) { try { - if (LOG_INFO === true) { logger.write("[INFO] start -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] start -> Entering function."); } loop(); function loop() { try { - if (LOG_INFO === true) { logger.write("[INFO] start -> loop -> Entering function."); } + if (FULL_LOG === true) { logger.write("[INFO] start -> loop -> Entering function."); } /* We define here all the modules that the rest of the infraestructure, including the bots themselves can consume. */ const UTILITIES = require(ROOT_DIR + 'Utilities'); const AZURE_FILE_STORAGE = require(ROOT_DIR + 'Azure File Storage'); - const MARKETS_MODULE = require(ROOT_DIR + 'Markets'); const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log'); const POLONIEX_CLIENT_MODULE = require(ROOT_DIR + 'Poloniex API Client'); const EXCHANGE_API = require(ROOT_DIR + 'ExchangeAPI'); @@ -223,12 +222,12 @@ switch (nextWaitTime) { case 'Normal': { - if (LOG_INFO === true) { logger.write("[INFO] start -> loopControl -> Restarting Loop in " + (processConfig.executionWaitTime / 1000) + " seconds."); } + if (FULL_LOG === true) { logger.write("[INFO] start -> loopControl -> Restarting Loop in " + (processConfig.executionWaitTime / 1000) + " seconds."); } setTimeout(loop, processConfig.executionWaitTime); } break; case 'Retry': { - if (LOG_INFO === true) { logger.write("[INFO] start -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 1000) + " seconds."); } + if (FULL_LOG === true) { logger.write("[INFO] start -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 1000) + " seconds."); } setTimeout(loop, processConfig.retryWaitTime); } break;