diff --git a/.vs/AACloudPlatform/v15/.suo b/.vs/AACloudPlatform/v15/.suo
index 8663604b4..0c8416988 100644
Binary files a/.vs/AACloudPlatform/v15/.suo and b/.vs/AACloudPlatform/v15/.suo differ
diff --git a/AACloudPlatform.njsproj b/AACloudPlatform.njsproj
index 91da2bf4b..b7d3265dd 100644
--- a/AACloudPlatform.njsproj
+++ b/AACloudPlatform.njsproj
@@ -13,7 +13,7 @@
14.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
AACloudPlatform
- Order-Books
+ Trading-Process
C:\Program Files\nodejs\node.exe
False
diff --git a/Olivia.azure.storage.connstring b/AAOlivia.azure.storage.connstring
similarity index 100%
rename from Olivia.azure.storage.connstring
rename to AAOlivia.azure.storage.connstring
diff --git a/Tom.azure.storage.connstring b/AATom.azure.storage.connstring
similarity index 100%
rename from Tom.azure.storage.connstring
rename to AATom.azure.storage.connstring
diff --git a/Assistant.js b/Assistant.js
index b6a813d51..451236793 100644
--- a/Assistant.js
+++ b/Assistant.js
@@ -1,5 +1,7 @@
exports.newAssistant = function newAssistant(BOT, DEBUG_MODULE) {
+ const FULL_LOG = true;
+
/*
This module allows trading bots to execute actions on the exchange, and also on its current recorded state.
@@ -39,6 +41,8 @@
try {
+ if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); }
+
/* Store local values. */
botContext = pBotContext;
@@ -51,18 +55,18 @@
try {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: {
- callBackFunction(DEFAULT_OK_RESPONSE);
+ case global.DEFAULT_OK_RESPONSE.result: {
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
return;
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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 DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ 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;
@@ -72,14 +76,14 @@
} catch (err) {
logger.write("[ERROR] initialize -> onDone -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] initialize -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -100,19 +104,19 @@
function onResponse(err, pExchangePositions) {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
+ case global.DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
exchangePositions = pExchangePositions;
ordersExecutionCheck(callBack);
return;
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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] getPositionsAtExchange -> onResponse -> Retry Later. Requesting Execution Retry.");
callBack(err);
return;
}
break;
- case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
logger.write("[ERROR] getPositionsAtExchange -> onResponse -> Operation Failed. Aborting the process.");
callBack(err);
return;
@@ -122,7 +126,7 @@
}
} catch (err) {
logger.write("[ERROR] getPositionsAtExchange -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -229,7 +233,7 @@
botContext.executionContext.positions[i].amountB !== sumAssetB
) {
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> confirmOrderWasPartiallyExecuted -> Cannot be confirmed that a partially execution was done well.");
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
@@ -264,7 +268,7 @@
} catch (err) {
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> confirmOrderWasPartiallyExecuted -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
}
@@ -306,7 +310,7 @@
botContext.executionContext.positions[i].amountB !== sumAssetB
) {
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> confirmOrderWasExecuted -> Cannot be confirmed that the order was executed. It must be manually cancelled by the user or cancelled by the exchange itself.");
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
@@ -339,7 +343,7 @@
} catch (err) {
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> confirmOrderWasExecuted -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
}
@@ -359,37 +363,37 @@
try {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
+ case global.DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
innerCallBack(pTrades);
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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] ordersExecutionCheck -> loopBody -> getPositionTradesAtExchange -> onResponse -> Retry Later. Requesting Execution Retry.");
- callBack(DEFAULT_RETRY_RESPONSE);
+ callBack(global.DEFAULT_RETRY_RESPONSE);
return;
}
break;
- case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> getPositionTradesAtExchange -> onResponse -> Operation Failed. Aborting the process.");
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
break;
}
} catch (err) {
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> getPositionTradesAtExchange -> onResponse -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> getPositionTradesAtExchange -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] ordersExecutionCheck -> loopBody -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
}
@@ -416,12 +420,12 @@
function final() {
- callBack(DEFAULT_OK_RESPONSE);
+ callBack(global.DEFAULT_OK_RESPONSE);
}
} catch (err) {
logger.write("[ERROR] ordersExecutionCheck -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -434,7 +438,7 @@
try {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
+ case global.DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
let position = {
id: pPositionId,
@@ -459,31 +463,31 @@
botContext.newHistoryRecord.newPositions++;
botContext.newHistoryRecord.rate = pRate;
- callBack(DEFAULT_OK_RESPONSE);
+ callBack(global.DEFAULT_OK_RESPONSE);
return;
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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] putPositionAtExchange -> onResponse -> Retry Later. Requesting Execution Retry.");
- callBack(DEFAULT_RETRY_RESPONSE);
+ callBack(global.DEFAULT_RETRY_RESPONSE);
return;
}
break;
- case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
logger.write("[ERROR] putPositionAtExchange -> onResponse -> Operation Failed. Aborting the process.");
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
break;
}
} catch (err) {
logger.write("[ERROR] putPositionAtExchange -> onResponse -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] putPositionAtExchange -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -496,7 +500,7 @@
try {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
+ case global.DEFAULT_OK_RESPONSE.result: { // Everything went well, we have the information requested.
let newPosition = {
id: pPositionId,
@@ -534,30 +538,30 @@
botContext.newHistoryRecord.movedPositions++;
botContext.newHistoryRecord.rate = pNewRate;
- callBack(DEFAULT_OK_RESPONSE);
+ callBack(global.DEFAULT_OK_RESPONSE);
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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] movePositionAtExchange -> onResponse -> Retry Later. Requesting Execution Retry.");
- callBack(DEFAULT_RETRY_RESPONSE);
+ callBack(global.DEFAULT_RETRY_RESPONSE);
return;
}
break;
- case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
logger.write("[ERROR] movePositionAtExchange -> onResponse -> Operation Failed. Aborting the process.");
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
return;
}
break;
}
} catch (err) {
logger.write("[ERROR] movePositionAtExchange -> onResponse -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] movePositionAtExchange -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
};
\ No newline at end of file
diff --git a/Azure File Storage.js b/Azure File Storage.js
index 383c139d4..252a336f1 100644
--- a/Azure File Storage.js
+++ b/Azure File Storage.js
@@ -41,7 +41,7 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) {
if (dataOwnerBotName === undefined) {
- dataOwner = bot.name;
+ dataOwner = bot.codeName;
} else {
diff --git a/Context.js b/Context.js
index 68cfa73c8..d85063a57 100644
--- a/Context.js
+++ b/Context.js
@@ -1,5 +1,7 @@
exports.newContext = function newContext(BOT, DEBUG_MODULE, FILE_STORAGE) {
+ const FULL_LOG = true;
+
/*
This module allows trading bots to connect to the exchange and do trding operations on it. So far it can only work with Poloniex.
@@ -34,7 +36,7 @@
executionHistory: [], // This is the record of bot execution.
executionContext: undefined, // Here is the business information of the last execution of this bot process.
newHistoryRecord : {
- date: processDatetime,
+ date: undefined,
rate: 0, // This will be used to know where to plot this information in the time line.
newPositions: 0,
newTrades: 0,
@@ -70,6 +72,9 @@
function initialize(pProcessDatetime, callBackFunction) {
try {
+
+ if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); }
+
/*
Here we get the positions the bot did and that are recorded at the bot storage account. We will use them through out the rest
@@ -77,7 +82,7 @@
*/
- cloudStorage.initialize(bot.name);
+ cloudStorage.initialize(bot.codeName);
thisObject.newHistoryRecord.date = pProcessDatetime;
processDatetime = pProcessDatetime;
@@ -88,18 +93,18 @@
try {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: {
- callBackFunction(DEFAULT_OK_RESPONSE);
+ case global.DEFAULT_OK_RESPONSE.result: {
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
return;
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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 DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ 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;
@@ -109,7 +114,7 @@
} catch (err) {
logger.write("[ERROR] initialize -> onDone -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -119,7 +124,7 @@
/* If the process run and was interrupted, there should be a status report that allows us to resume execution. */
let fileName = "Status.Report.json"
- let filePath = EXCHANGE_NAME + "/" + bot.name + "/" + bot.dataSetVersion + "/Processes/" + bot.process;
+ let filePath = EXCHANGE_NAME + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Processes/" + bot.process;
cloudStorage.getTextFile(filePath, fileName, onFileReceived, true);
@@ -150,12 +155,12 @@
*/
logger.write("[ERROR] initialize -> getStatusReport -> Bot cannot execute without the Status report. -> Err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] initialize -> getExecutionHistory -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -163,7 +168,7 @@
try {
let fileName = "Execution.History.json"
- let filePath = EXCHANGE_NAME + "/" + bot.name + "/" + bot.dataSetVersion + "/Output/" + bot.process;
+ let filePath = EXCHANGE_NAME + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process;
cloudStorage.getTextFile(filePath, fileName, onFileReceived, true);
@@ -185,12 +190,12 @@
*/
logger.write("[ERROR] initialize -> getExecutionHistory -> Bot cannot execute without the Execution History. -> Err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] initialize -> getExecutionHistory -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -201,7 +206,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 = EXCHANGE_NAME + "/" + bot.name + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + dateForPath;
+ let filePath = EXCHANGE_NAME + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + dateForPath;
cloudStorage.getTextFile(filePath, fileName, onFileReceived, true);
@@ -213,7 +218,7 @@
thisObject.executionContext.transactions = []; // We record here the transactions that happened duting this execution.
- callBack(DEFAULT_OK_RESPONSE);
+ callBack(global.DEFAULT_OK_RESPONSE);
} catch (err) {
@@ -226,13 +231,13 @@
*/
logger.write("[ERROR] initialize -> getExecutionContext -> Bot cannot execute without the Execution Context. -> Err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] initialize -> getExecutionContext -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -261,17 +266,17 @@
transactions: []
};
- callBack(DEFAULT_OK_RESPONSE);
+ callBack(global.DEFAULT_OK_RESPONSE);
} catch (err) {
logger.write("[ERROR] initialize -> createConext -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] initialize -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -285,18 +290,18 @@
try {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: {
- callBackFunction(DEFAULT_OK_RESPONSE);
+ case global.DEFAULT_OK_RESPONSE.result: {
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
return;
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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] saveThemAll -> onDone -> Retry Later. Requesting Execution Retry.");
callBackFunction(err);
return;
}
break;
- case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
logger.write("[ERROR] saveThemAll -> onDone -> Operation Failed. Aborting the process.");
callBackFunction(err);
return;
@@ -306,7 +311,7 @@
} catch (err) {
logger.write("[ERROR] saveThemAll -> onDone -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -320,7 +325,7 @@
let fileName = "Execution.Context.json"
let dateForPath = processDatetime.getUTCFullYear() + '/' + utilities.pad(processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(processDatetime.getUTCDate(), 2) + '/' + utilities.pad(processDatetime.getUTCHours(), 2) + '/' + utilities.pad(processDatetime.getUTCMinutes(), 2);
- let filePath = EXCHANGE_NAME + "/" + bot.name + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + dateForPath;
+ let filePath = EXCHANGE_NAME + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + dateForPath;
utilities.createFolderIfNeeded(filePath, cloudStorage, onFolderCreated);
@@ -343,14 +348,14 @@
}
catch (err) {
logger.write("[ERROR] saveThemAll -> writeExecutionContext -> onFolderCreated -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write("[ERROR] saveThemAll -> writeExecutionContext -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -363,7 +368,7 @@
try {
let fileName = "Execution.History.json"
- let filePath = EXCHANGE_NAME + "/" + bot.name + "/" + bot.dataSetVersion + "/Output/" + bot.process;
+ let filePath = EXCHANGE_NAME + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process;
utilities.createFolderIfNeeded(filePath, cloudStorage, onFolderCreated);
@@ -392,14 +397,14 @@
}
catch (err) {
logger.write("[ERROR] saveThemAll -> writeExucutionHistory -> onFolderCreated -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write("[ERROR] saveThemAll -> writeExucutionHistory -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -412,7 +417,7 @@
try {
let fileName = "Status.Report.json"
- let filePath = EXCHANGE_NAME + "/" + bot.name + "/" + bot.dataSetVersion + "/Processes/" + bot.process;
+ let filePath = EXCHANGE_NAME + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Processes/" + bot.process;
utilities.createFolderIfNeeded(filePath, cloudStorage, onFolderCreated);
@@ -432,26 +437,26 @@
logger.write("[INFO] saveThemAll -> writeStatusReport -> onFolderCreated -> Content written = " + fileContent);
}
- callBack(DEFAULT_OK_RESPONSE);
+ callBack(global.DEFAULT_OK_RESPONSE);
return;
}
}
catch (err) {
logger.write("[ERROR] saveThemAll -> writeStatusReport -> onFolderCreated -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write("[ERROR] saveThemAll -> writeStatusReport -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] saveThemAll -> Error = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
diff --git a/Datasource.js b/Datasource.js
index df2fed165..dcc28fd8a 100644
--- a/Datasource.js
+++ b/Datasource.js
@@ -1,5 +1,7 @@
exports.newDatasource = function newDatasource(BOT, DEBUG_MODULE, FILE_STORAGE) {
+ const FULL_LOG = true;
+
/*
This module allows trading bots to access information stored at the cloud storage.
@@ -60,6 +62,8 @@
try {
+ if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); }
+
oliviaAzureFileStorage.initialize("Olivia");
tomAzureFileStorage.initialize("Tom");
@@ -69,18 +73,18 @@
try {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: {
- callBackFunction(DEFAULT_OK_RESPONSE);
+ case global.DEFAULT_OK_RESPONSE.result: {
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
return;
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ 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 DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ 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;
@@ -90,7 +94,7 @@
} catch (err) {
logger.write("[ERROR] initialize -> onDone -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -132,7 +136,7 @@
}
} catch (err) {
logger.write("[ERROR] getCandles -> getMarketFiles -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -159,7 +163,7 @@
}
} catch (err) {
logger.write("[ERROR] getCandles -> getDailyFiles -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -222,13 +226,13 @@
}
} catch (err) {
logger.write("[ERROR] getCandles -> getCandlesWeAreIn -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] getCandles -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -269,7 +273,7 @@
}
} catch (err) {
logger.write("[ERROR] getPatterns -> getMarketFiles -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -296,7 +300,7 @@
}
} catch (err) {
logger.write("[ERROR] getPatterns -> getDailyFiles -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -355,19 +359,19 @@
if (counter === thisObject.stairsFiles.size) {
- callBack(DEFAULT_OK_RESPONSE);
+ callBack(global.DEFAULT_OK_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] getPatterns -> getStairsWeAreIn -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] getPatterns -> err = " + err.message);
- callBack(DEFAULT_FAIL_RESPONSE);
+ callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -416,7 +420,7 @@
} catch (err) {
logger.write("[ERROR] initialize -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
};
\ No newline at end of file
diff --git a/Debug Log.js b/Debug Log.js
index f78c18965..788099f3d 100644
--- a/Debug Log.js
+++ b/Debug Log.js
@@ -12,7 +12,7 @@
let firstCall = true;
let folderPath;
- thisObject = {
+ let thisObject = {
bot: undefined,
fileName: undefined,
write: write
@@ -32,15 +32,15 @@
createFolderSync(folderPath);
- folderPath = thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.name;
+ folderPath = thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName;
createFolderSync(folderPath);
- folderPath = thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.name + "/" + thisObject.bot.version;
+ folderPath = thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "/" + thisObject.bot.version;
createFolderSync(folderPath);
- folderPath = thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.name + "/" + thisObject.bot.version + "/" + thisObject.bot.process;
+ folderPath = thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "/" + thisObject.bot.version + "/" + thisObject.bot.process;
createFolderSync(folderPath);
diff --git a/ExchangeAPI.js b/ExchangeAPI.js
index 0651d9333..7497135cb 100644
--- a/ExchangeAPI.js
+++ b/ExchangeAPI.js
@@ -1,5 +1,7 @@
exports.newExchangeAPI = function newExchangeAPI(BOT, DEBUG_MODULE, POLONIEX_CLIENT_MODULE) {
+ const FULL_LOG = true;
+
/*
This module allows trading bots to connect to the exchange and do trding operations on it. So far it can only work with Poloniex.
@@ -29,10 +31,12 @@
try {
+ if (LOG_INFO === true) { logger.write("[INFO] initialize -> Entering function."); }
+
let apiKey = readApiKey();
poloniexApiClient = new POLONIEX_CLIENT_MODULE(apiKey.Key, apiKey.Secret);
- callBackFunction(DEFAULT_OK_RESPONSE);
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
function readApiKey() {
@@ -47,14 +51,14 @@
logger.write("[HINT] The file must have the keys to access your poloniex account, in this format -> " + '{ "Key" : "4FB9TMEB-234VH2W1-BYJIXHGM-GL15DSA1", "Secret" : "1a24298skdjdf734uuyhbdagdasdtyut276587256hdsdas765asdasdasd76asdasda765asdasfas6asfda57657asd5a76sd5a7s65d7a6sd57as65d7as65d"}');
logger.write("[HINT] You get this key logging in to your Poloniex web account, enabling API keys and getting a new one. ");
logger.write("[HINT] Be sure not to allow withdrawls with this Key. When asked at the exchange key page, say no. ");
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] initialize -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -74,7 +78,7 @@
if (err.message.indexOf("ETIMEDOUT") > 0) {
logger.write("[WARN] getOpenPositions -> onExchangeCallReturned -> Timeout reached while trying to access the Exchange API. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
@@ -82,19 +86,19 @@
if (err.message.indexOf("ECONNRESET") > 0) {
logger.write("[WARN] getOpenPositions -> onExchangeCallReturned -> The exchange reseted the connection. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
logger.write("[ERROR] getOpenPositions -> onExchangeCallReturned -> Unexpected error trying to contact the Exchange. This will halt this bot process. : ERROR = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
}
} catch (err) {
logger.write("[ERROR] getOpenPositions -> onExchangeCallReturned -> exchangeResponse.error = " + exchangeResponse.error);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
@@ -136,12 +140,12 @@
}
catch (err) {
logger.write("[ERROR] getOpenPositions -> onExchangeCallReturned -> Error = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] getOpenPositions -> Error = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -161,7 +165,7 @@
if (err.message.indexOf("ETIMEDOUT") > 0) {
logger.write("[WARN] getExecutedTrades -> onExchangeCallReturned -> Timeout reached while trying to access the Exchange API. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
@@ -169,19 +173,19 @@
if (err.message.indexOf("ECONNRESET") > 0) {
logger.write("[WARN] getExecutedTrades -> onExchangeCallReturned -> The exchange reseted the connection. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
logger.write("[ERROR] getExecutedTrades -> onExchangeCallReturned -> Unexpected error trying to contact the Exchange. This will halt this bot process. : ERROR = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
}
} catch (err) {
logger.write("[ERROR] getExecutedTrades -> onExchangeCallReturned -> exchangeResponse.error = " + exchangeResponse.error);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
} else {
@@ -229,12 +233,12 @@
}
catch (err) {
logger.write("[ERROR] getExecutedTrades -> onExchangeCallReturned -> Error = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] getExecutedTrades -> Error = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -253,7 +257,7 @@
}
logger.write("[ERROR] putPosition -> pType must be either 'buy' or 'sell'.");
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
function onExchangeCallReturned(err, exchangeResponse) {
@@ -266,7 +270,7 @@
if (err.message.indexOf("ETIMEDOUT") > 0) {
logger.write("[WARN] putPosition -> onExchangeCallReturned -> Timeout reached while trying to access the Exchange API. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
@@ -274,19 +278,19 @@
if (err.message.indexOf("ECONNRESET") > 0) {
logger.write("[WARN] putPosition -> onExchangeCallReturned -> The exchange reseted the connection. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
logger.write("[ERROR] putPosition -> onExchangeCallReturned -> Unexpected error trying to contact the Exchange. This will halt this bot process. : ERROR = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
}
} catch (err) {
logger.write("[ERROR] putPosition -> onExchangeCallReturned -> exchangeResponse.error = " + exchangeResponse.error);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
@@ -316,13 +320,13 @@
}
catch (err) {
logger.write("[ERROR] putPosition -> onExchangeCallReturned -> Error = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] putPosition -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -342,7 +346,7 @@
if (err.message.indexOf("ETIMEDOUT") > 0) {
logger.write("[WARN] movePosition -> onExchangeCallReturned -> Timeout reached while trying to access the Exchange API. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
@@ -350,19 +354,19 @@
if (err.message.indexOf("ECONNRESET") > 0) {
logger.write("[WARN] movePosition -> onExchangeCallReturned -> The exchange reseted the connection. Requesting new execution later. : ERROR = " + err.message);
- callBackFunction(DEFAULT_RETRY_RESPONSE);
+ callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
logger.write("[ERROR] movePosition -> onExchangeCallReturned -> Unexpected error trying to contact the Exchange. This will halt this bot process. : ERROR = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
}
} catch (err) {
logger.write("[ERROR] movePosition -> onExchangeCallReturned -> exchangeResponse.error = " + exchangeResponse.error);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
@@ -370,7 +374,7 @@
if (exchangeResponse.success !== 1) {
logger.write("[ERROR] movePosition -> onExchangeCallReturned -> exchangeResponse.success = " + exchangeResponse.success);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
/*
@@ -397,13 +401,13 @@
}
catch (err) {
logger.write("[ERROR] movePosition -> onExchangeCallReturned -> Error = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
logger.write("[ERROR] movePosition -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
};
\ No newline at end of file
diff --git a/Run.js b/Run.js
index fb0aa43d9..5473b2272 100644
--- a/Run.js
+++ b/Run.js
@@ -1,4 +1,7 @@
-/* First thing to do is to read the config and guess which bot we will be running. */
+
+const LOG_INFO = true;
+
+/* First thing to do is to read the config and guess which bot we will be running. */
var fs = require('fs');
let vmConfig;
@@ -22,24 +25,19 @@ let botConfig;
try {
botConfig = JSON.parse(fs.readFileSync(vmConfig.bot.path + '/this.bot.config.json', 'utf8'));
-
}
catch (err) {
- const logText = "[ERROR] 'readConfig' - ERROR : " + err.message;
- console.log.write(logText);
-
+ console.log("[ERROR] 'readConfig' - ERROR : " + err.message);
return;
}
-let bot = {
+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
};
-botConfig.bot;
-
/* Now we will run according to what we see at the config file. */
const ROOT_DIR = './';
@@ -48,7 +46,7 @@ const MODULE_NAME = "Run";
const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log');
const logger = DEBUG_MODULE.newDebugLog();
logger.fileName = MODULE_NAME;
-logger.bot = bot;
+logger.bot = botConfig;
process.on('uncaughtException', function (err) {
logger.write('uncaughtException - ' + err.message);
@@ -64,17 +62,17 @@ process.on('exit', function (code) {
logger.write('About to exit with code:' + code);
});
-const DEFAULT_OK_RESPONSE = {
+global.DEFAULT_OK_RESPONSE = {
result: "Ok",
message: "Operation Succeeded"
};
-const DEFAULT_FAIL_RESPONSE = {
+global.global.DEFAULT_FAIL_RESPONSE = {
result: "Fail",
message: "Operation Failed"
};
-const DEFAULT_RETRY_RESPONSE = {
+global.global.DEFAULT_RETRY_RESPONSE = {
result: "Retry",
message: "Retry Later"
};
@@ -97,7 +95,7 @@ for (let i = 0; i < botConfig.processes.length; i++) {
let processConfig = botConfig.processes[i];
- bot.process = processConfig.name;
+ botConfig.process = processConfig.name;
try {
@@ -159,9 +157,9 @@ for (let i = 0; i < botConfig.processes.length; i++) {
function startProcess() {
- if (bot.type === "trading") {
+ if (bot.type === "Trading") {
- runTradingBot();
+ runTradingBot(processConfig);
return;
}
@@ -187,34 +185,41 @@ for (let i = 0; i < botConfig.processes.length; i++) {
}
-function runTradingBot() {
+function runTradingBot(pProcessConfig) {
- let tradingBot = TRADING_BOT_MODULE.newTradingBot(bot);
- tradingBot.initialize(vmConfig.bot.path, processConfig, onInitializeReady);
+ try {
+ if (LOG_INFO === true) { logger.write("[INFO] runTradingBot -> Entering function."); }
- function onInitializeReady(err) {
+ let tradingBot = TRADING_BOT_MODULE.newTradingBot(botConfig);
+ tradingBot.initialize(vmConfig.bot.path, pProcessConfig, onInitializeReady);
- if (err.result !== DEFAULT_OK_RESPONSE.result) {
+ function onInitializeReady(err) {
- tradingBot.start(whenStartFinishes);
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
- function whenStartFinishes() {
+ tradingBot.start(whenStartFinishes);
- if (err.result !== DEFAULT_OK_RESPONSE.result) {
+ function whenStartFinishes() {
- logger.write("[INFO] trading bot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully. :-)");
+ if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
- } else {
+ logger.write("[INFO] trading bot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully. :-)");
- logger.write("[ERR] trading bot -> onInitializeReady -> whenStartFinishes -> err = " + err.message);
- logger.write("[ERR] trading bot -> onInitializeReady -> whenStartFinishes -> Execution will be stopped. ");
- logger.write("[ERR] trading bot -> onInitializeReady -> whenStartFinishes -> Bye. :-(");
+ } else {
+
+ logger.write("[ERR] trading bot -> onInitializeReady -> whenStartFinishes -> err = " + err.message);
+ logger.write("[ERR] trading bot -> onInitializeReady -> whenStartFinishes -> Execution will be stopped. ");
+ logger.write("[ERR] trading bot -> onInitializeReady -> whenStartFinishes -> Bye. :-(");
+ }
}
- }
- } else {
- logger.write("[ERR] trading bot -> onInitializeReady -> err = " + err.message);
- logger.write("[ERR] trading bot -> onInitializeReady -> Bot will not be started. ");
+ } else {
+ logger.write("[ERR] trading bot -> onInitializeReady -> err = " + err.message);
+ logger.write("[ERR] trading bot -> onInitializeReady -> Bot will not be started. ");
+ }
}
}
+ catch (err) {
+ logger.write("[ERROR] runTradingBot -> err = " + err.message);
+ }
}
\ No newline at end of file
diff --git a/TradingBot.js b/TradingBot.js
index ab726eea3..bcbd12729 100644
--- a/TradingBot.js
+++ b/TradingBot.js
@@ -30,11 +30,11 @@
USER_BOT_MODULE = require(pBotPath + "/" + pProcessConfig.name + "/" + 'User.Bot');
- callBackFunction(DEFAULT_OK_RESPONSE);
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
} catch (err) {
logger.write("[ERROR] initialize -> err = " + err.message);
- callBackFunction(DEFAULT_FAIL_RESPONSE);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
@@ -77,6 +77,8 @@
let nextWaitTime;
+ initializeContext();
+
function initializeContext() {
context = CONTEXT.newContext(bot, DEBUG_MODULE, AZURE_FILE_STORAGE);
@@ -84,7 +86,7 @@
function onInizialized(err) {
- if (err.result === DEFAULT_OK_RESPONSE.result) {
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
initializeDatasource();
} else {
logger.write("[ERROR] start -> loop -> initializeContext -> err = " + err.message);
@@ -100,7 +102,7 @@
function onInizialized(err) {
- if (err.result === DEFAULT_OK_RESPONSE.result) {
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
initializeExchangeAPI();
} else {
logger.write("[ERROR] start -> loop -> initializeDatasource -> err = " + err.message);
@@ -116,7 +118,7 @@
function onInizialized(err) {
- if (err.result === DEFAULT_OK_RESPONSE.result) {
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
initializeAssistant();
} else {
logger.write("[ERROR] start -> loop -> initializeExchangeAPI -> err = " + err.message);
@@ -132,7 +134,7 @@
function onInizialized(err) {
- if (err.result === DEFAULT_OK_RESPONSE.result) {
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
initializeUserBot();
} else {
logger.write("[ERROR] start -> loop -> initializeAssistant -> err = " + err.message);
@@ -156,7 +158,7 @@
function onInizialized(err) {
- if (err.result === DEFAULT_OK_RESPONSE.result) {
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
startUserBot();
} else {
logger.write("[ERROR] start -> loop -> initializeUserBot -> err = " + err.message);
@@ -172,19 +174,19 @@
function onFinished(err) {
switch (err.result) {
- case DEFAULT_OK_RESPONSE.result: {
+ case global.DEFAULT_OK_RESPONSE.result: {
nextWaitTime = 'Normal';
saveContext();
return;
}
break;
- case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
+ case global.DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
nextWaitTime = 'Retry';
loopControl(nextWaitTime); // Note that we do not save the context, since the processing was aborted.
return;
}
break;
- case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
+ case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
logger.write("[ERROR] start -> loop -> startUserBot -> Operation Failed. Aborting the process.");
callBackFunction(err);
return;
@@ -200,7 +202,7 @@
function onFinished(err) {
- if (err.result === DEFAULT_OK_RESPONSE.result) {
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
loopControl(nextWaitTime);
} else {
logger.write("[ERROR] start -> loop -> saveContext -> err = " + err.message);
@@ -236,7 +238,6 @@
catch (err) {
logger.write("[ERROR] start -> err = " + err.message);
- logger.write(logText);
}
}
};
diff --git a/this.vm.config.json b/this.vm.config.json
index 2633e2148..5d775bb42 100644
--- a/this.vm.config.json
+++ b/this.vm.config.json
@@ -1,5 +1,5 @@
{
"bot": {
- "path": "../AACarol-Extraction-Bot"
+ "path": "../Bots/AAMasters/AAMariam-Trading-Bot"
}
}
\ No newline at end of file