diff --git a/.vs/AACloudPlatform/v15/.suo b/.vs/AACloudPlatform/v15/.suo index 7560b6487..84e35d8ff 100644 Binary files a/.vs/AACloudPlatform/v15/.suo and b/.vs/AACloudPlatform/v15/.suo differ diff --git a/Azure File Storage.js b/Azure File Storage.js index b9a74a3b4..ad6fe935a 100644 --- a/Azure File Storage.js +++ b/Azure File Storage.js @@ -268,7 +268,7 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) { message: "Folder does not exist." }; - logger.write("[ERROR] getTextFile -> onFileReceived -> Custom Response -> message = " + customResponse.message); + logger.write("[ERROR] getTextFile -> onFileReceived -> Custom Response -> message = " + customErr.message); callBackFunction(customErr); return; diff --git a/Debug Log.js b/Debug Log.js index 3212264e3..6a026938c 100644 --- a/Debug Log.js +++ b/Debug Log.js @@ -36,10 +36,6 @@ createFolderSync(folderPath); - folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName; - - createFolderSync(folderPath); - folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor; createFolderSync(folderPath); diff --git a/Indicator Bot Main Loop.js b/Indicator Bot Main Loop.js index 575cbe481..da500c4b3 100644 --- a/Indicator Bot Main Loop.js +++ b/Indicator Bot Main Loop.js @@ -53,7 +53,7 @@ /* 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 FILE_STORAGE = require(ROOT_DIR + 'Azure File Storage'); const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log'); const STATUS_REPORT = require(ROOT_DIR + 'Status Report'); @@ -74,8 +74,8 @@ if (FULL_LOG === true) { logger.write("[INFO] run -> loop -> initializeStatusReport -> Entering function."); } - statusReport = STATUS_REPORT.newContext(bot, DEBUG_MODULE, FILE_STORAGE, UTILITIES); - statusReport.initialize(onInizialized); + statusReport = STATUS_REPORT.newStatusReport(bot, DEBUG_MODULE, FILE_STORAGE, UTILITIES); + statusReport.initialize(bot, onInizialized); function onInizialized(err) { @@ -85,20 +85,22 @@ initializeUserBot(); return; } - break; case global.DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time. logger.write("[ERROR] run -> loop -> initializeStatusReport -> onInizialized > Retry Later. Requesting Execution Retry."); nextWaitTime = 'Retry'; loopControl(nextWaitTime); return; } - break; case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle. logger.write("[ERROR] run -> loop -> initializeStatusReport -> onInizialized > Operation Failed. Aborting the process."); callBackFunction(err); return; } - break; + case global.CUSTOM_FAIL_RESPONSE.result: { + logger.write("[INFO] run -> loop -> initializeStatusReport -> onInizialized > Execution finished with some expected issue."); + initializeUserBot(); + return; + } } } } diff --git a/Interval Executor.js b/Interval Executor.js index 0219d8384..1c8e277ed 100644 --- a/Interval Executor.js +++ b/Interval Executor.js @@ -124,12 +124,12 @@ if (shutdownEvent.isShuttingDown() === false) { const UTILITIES = require(ROOT_DIR + 'Utilities'); - const AZURE_FILE_STORAGE = require(ROOT_DIR + 'Azure File Storage'); + const 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'); - let fileProcessingInterval = INTERVAL_MODULE.newInterval(bot, UTILITIES, AZURE_FILE_STORAGE, DEBUG_MODULE, MARKETS_MODULE, POLONIEX_CLIENT_MODULE); + let fileProcessingInterval = INTERVAL_MODULE.newInterval(bot, UTILITIES, FILE_STORAGE, DEBUG_MODULE, MARKETS_MODULE, POLONIEX_CLIENT_MODULE); fileProcessingInterval.initialize(year, month, onReadyToStart); diff --git a/Project.njsproj b/Project.njsproj index a46d74930..85a2f27ea 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -13,7 +13,7 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) Project - Trading-Process + Multi-Period-Market C:\Program Files\nodejs\node.exe False diff --git a/Run.js b/Run.js index b4c6bc5bf..5b639de7f 100644 --- a/Run.js +++ b/Run.js @@ -3,7 +3,7 @@ const FULL_LOG = true; /* The following global variable tells the system if it is running on test mode or production. */ -global.RUNNING_MODE = 'Production'; // 'Testnet' or 'Production' +global.RUNNING_MODE = 'Mixed'; // 'Testnet' or 'Production' /* First thing to do is to read the config and guess which bot we will be running. */ diff --git a/Status Report.js b/Status Report.js index 14e19240f..32114cbc9 100644 --- a/Status Report.js +++ b/Status Report.js @@ -87,19 +87,21 @@ callBackFunction(global.DEFAULT_OK_RESPONSE); return; } - break; case global.DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time. logger.write("[ERROR] initialize -> onDone -> Retry Later. Requesting Execution Retry."); callBackFunction(err); return; } - break; case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle. logger.write("[ERROR] initialize -> onDone -> Operation Failed. Aborting the process."); callBackFunction(err); return; } - break; + case global.CUSTOM_FAIL_RESPONSE.result: { + logger.write("[INFO] initialize -> onDone -> Execution finished with some expected issue."); + callBackFunction(err); + return; + } } } catch (err) { @@ -129,12 +131,14 @@ /* In this case we can assume that this is the first execution ever of this bot.*/ + thisObject.statusReport = JSON.parse('{}'); + let customErr = { result: global.CUSTOM_FAIL_RESPONSE.result, message: "Status Report was never created." } logger.write("[ERROR] save -> err = " + err.message); - callBackFunction(customErr); + callBack(customErr); return; } @@ -173,7 +177,7 @@ } catch (err) { logger.write("[ERROR] initialize -> err = " + err.message); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); + callBack(global.DEFAULT_FAIL_RESPONSE); } } diff --git a/Trading Bot Main Loop.js b/Trading Bot Main Loop.js index 72309ce4b..bcefcef7e 100644 --- a/Trading Bot Main Loop.js +++ b/Trading Bot Main Loop.js @@ -53,7 +53,7 @@ /* 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 FILE_STORAGE = require(ROOT_DIR + 'Azure File Storage'); 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'); @@ -83,7 +83,7 @@ if (FULL_LOG === true) { logger.write("[INFO] run -> loop -> initializeContext -> Entering function."); } - context = CONTEXT.newContext(bot, DEBUG_MODULE, AZURE_FILE_STORAGE, UTILITIES, STATUS_REPORT); + context = CONTEXT.newContext(bot, DEBUG_MODULE, FILE_STORAGE, UTILITIES, STATUS_REPORT); context.initialize(onInizialized); function onInizialized(err) { @@ -116,7 +116,7 @@ if (FULL_LOG === true) { logger.write("[INFO] run -> loop -> initializeDatasource -> Entering function."); } - datasource = DATASOURCE.newDatasource(bot, DEBUG_MODULE, AZURE_FILE_STORAGE, UTILITIES); + datasource = DATASOURCE.newDatasource(bot, DEBUG_MODULE, FILE_STORAGE, UTILITIES); datasource.initialize(onInizialized); function onInizialized(err) { diff --git a/obj/Debug/Project.njsproj.FileListAbsolute.txt b/obj/Debug/Project.njsproj.FileListAbsolute.txt index 71fd7f7bc..8949330d2 100644 --- a/obj/Debug/Project.njsproj.FileListAbsolute.txt +++ b/obj/Debug/Project.njsproj.FileListAbsolute.txt @@ -1,2 +1,3 @@ C:\Users\Luis\source\repos\AACloudPlatform\obj\Debug\Project.njsproj.CoreCompileInputs.cache C:\Users\Luis\source\repos\AACloudPlatform\bin\Microsoft.NodejsTools.WebRole.dll +C:\Users\Luis\source\repos\AACloudPlatform\obj\Debug\Project.njsprojResolveAssemblyReference.cache