From 5e0dd485c90a2ffff9595b3c1d108880aae1d86b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 15 Mar 2018 10:21:02 +0100 Subject: [PATCH] Initialization debugged --- .vs/AACloudPlatform/v15/.suo | Bin 73216 -> 81920 bytes Azure File Storage.js | 2 +- Debug Log.js | 4 ---- Indicator Bot Main Loop.js | 14 ++++++++------ Interval Executor.js | 4 ++-- Project.njsproj | 2 +- Run.js | 2 +- Status Report.js | 14 +++++++++----- Trading Bot Main Loop.js | 6 +++--- .../Project.njsproj.FileListAbsolute.txt | 1 + 10 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.vs/AACloudPlatform/v15/.suo b/.vs/AACloudPlatform/v15/.suo index 7560b6487ea3fce41c9453d6a3f812709af86523..84e35d8ff3628c3e28adee07ec8abb4689927a57 100644 GIT binary patch delta 5355 zcmds)dr*_v6~Mpy@gEyZRxo@h3R|Mq z>b9;zP9?i`t88c;$8|f%=d4cawh@@A#jUctopq+u>EMk0qf={9aax>KdQM0%zIJrn zPItV_k8>aAo_p@=d^gT>g3~E$H6-zzKSgq!46`A~z0uK8s-=9?snP^q;hdOrHuu~Y zEEO8~7FG^-_|ak`wjO7s$8n*^f3Q~|X|POr0p$!N5eY|UqW(_Tx1GjK+2H02=&iuD~*Q1uoy)e zR-_<$9I;?AW|sIhN>RRoyowYf^$7J0q}Q-aqwPXjj=b(~uY)%fnt7F2T8r3_Dr6n9 z9{CPZjeHx~fNVkRNDZ>lZ4{UWyb4uJ0~U*rtw?D9}h?m2HaLiw&ER zTBI2PugvUHYTa1^Q;~HrD8-0?#gnM;5v^Rb)Thj5uBek)WGEQgd@7SebO16CaxfDi zCjz=~Eh;sJ3WZonXW?akBTSFhB?YvCB{{JYl~y6E$%z*24>8+>kmICE=cC1+|9?9N z*P^pPt6C{W;a<1Ud}RaX|+LK1@cl;b0`c zU*S6d%AhuB*s5aPYV4tZpjI=12VUinzk{`pjwkbt2O}w_$p=t@7V{v=R-_GizpXTd z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A_tJvw-z`269ZbO?f*>$Exb%;x0Z~8cv5pPI{lSGDDI3E7lw>$w;{wZzU9YvZms zHDNg7BcG>O!xsMj;8L#s*u+g8ZoIeBD&E`6+dHh`Epb<$sJ3_15U*$-&CWxUIB?R& zX(!!W)4n5-@RtHa%2MBz=frZ&;Vxd)?u@Le=&|w0eP8~&UBa(vJoe*&{hh(1M4SM_ zKv~2dc_9~}2j_D*Vd zD94`O820Y7@#GVSMU5+pd`U#F9lZHar`q@_@_6)THf{B-Eg5!lvUQIowyM6ScInE+ zp`%r)axbD~HY)PgM^|qPzpID8(fEU2w{jmiN#S!^xJwIvr;|s~g#lu1^%&m$UKw}y zyIH?5SDop$Q)^!VQGkO#%#q8$+fHY3U8bq6*-g_-gGO)Du2E_Jq9a>nAIYZFSqDKNz}0Ju-yTn0#LXXNwr$R(-4szN`>Ri4T4vg)yv^>UR+wPop0Bgo&gGLW zc1sE7izzq7{83|W{&5=T*Lpa8hNs0fnI7Tpvw3pcE^*KMxotnXsVBy}0p5~-aPmTL z1doBofqWh1-^(T--)s4IAm8U_)hfqxcxrt+Or-Id?w+=-Ih32g7Y?MirQ7HmBOlAm eX5X 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