global.processDatetime moved to bot object

This commit is contained in:
Luis Fernando Molina committed 2018-03-18 16:35:25 +01:00
1 parent a4759ebf45
commit f9c333a85c
7 files changed
+13 -14

No files matched your search

Binary file not shown.
+3 -3
View File
@@ -63,7 +63,7 @@
any reason stops being updated.
*/
if (candle.begin < global.processDatetime.valueOf() - 2 * 60 * 1000) {
if (candle.begin < bot.processDatetime.valueOf() - 2 * 60 * 1000) {
logger.write("[ERROR] initialize -> Candles more than two minutes old. Retrying later.");
callBack(global.DEFAULT_RETRY_RESPONSE);
@@ -632,7 +632,7 @@
rate: pRate,
amountA: pAmountA,
amountB: pAmountB,
date: (global.processDatetime.valueOf()),
date: (bot.processDatetime.valueOf()),
status: "open",
trades: []
};
@@ -724,7 +724,7 @@
rate: pNewRate,
amountA: pPosition.amountB * pNewRate,
amountB: pPosition.amountB,
date: (global.processDatetime.valueOf()),
date: (bot.processDatetime.valueOf()),
status: "open",
trades: []
};
+3 -3
View File
@@ -103,7 +103,7 @@
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
thisObject.newHistoryRecord.date = global.processDatetime;
thisObject.newHistoryRecord.date = bot.processDatetime;
getStatusReport(onDone);
@@ -398,7 +398,7 @@
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> Entering function."); }
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 dateForPath = bot.processDatetime.getUTCFullYear() + '/' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.processDatetime.getUTCDate(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCHours(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCMinutes(), 2);
let filePath = bot.filePathRoot + "/Output/" + bot.process + '/' + dateForPath;
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> fileName = " + fileName); }
@@ -534,7 +534,7 @@
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> Entering function."); }
statusReportModule.file.lastExecution = global.processDatetime;
statusReportModule.file.lastExecution = bot.processDatetime;
statusReportModule.save(callBack);
}
+4 -4
View File
@@ -178,7 +178,7 @@
let periodTime = global.dailyFilePeriods[i][0];
let periodName = global.dailyFilePeriods[i][1];
getFile(oliviaAzureFileStorage, "@AssetA_@AssetB.json", "@Exchange/Output/Candles/Multi-Period-Daily/@Period/@Year/@Month/@Day", periodName, global.processDatetime, onFileReceived, callBack);
getFile(oliviaAzureFileStorage, "@AssetA_@AssetB.json", "@Exchange/Output/Candles/Multi-Period-Daily/@Period/@Year/@Month/@Day", periodName, bot.processDatetime, onFileReceived, callBack);
function onFileReceived(err, file) {
@@ -253,7 +253,7 @@
let timePeriod = candle.end - candle.begin + 1; // In miliseconds. (remember each candle spans a period minus one milisecond)
if (candle.begin >= global.processDatetime.valueOf() - timePeriod * 10 && candle.begin <= global.processDatetime.valueOf()) {
if (candle.begin >= bot.processDatetime.valueOf() - timePeriod * 10 && candle.begin <= bot.processDatetime.valueOf()) {
candlesArray.push(candle);
@@ -357,7 +357,7 @@
let periodTime = global.dailyFilePeriods[i][0];
let periodName = global.dailyFilePeriods[i][1];
getFile(tomAzureFileStorage, "@AssetA_@AssetB.json", "@Exchange/Tom/dataSet.V1/Output/Candle-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", periodName, global.processDatetime, onFileReceived, callBack);
getFile(tomAzureFileStorage, "@AssetA_@AssetB.json", "@Exchange/Tom/dataSet.V1/Output/Candle-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", periodName, bot.processDatetime, onFileReceived, callBack);
function onFileReceived(err, file) {
@@ -436,7 +436,7 @@
stairs.lastMin = pStairsFile[i][10];
stairs.lastMax = pStairsFile[i][11];
if (global.processDatetime.valueOf() >= stairs.begin && global.processDatetime.valueOf() <= stairs.end) {
if (bot.processDatetime.valueOf() >= stairs.begin && bot.processDatetime.valueOf() <= stairs.end) {
thisObject.stairsMap.set(pPeriodName, stairs);
+1 -1
View File
@@ -71,7 +71,7 @@
/* We define the datetime for the process that we are running now. This will be the official processing time for both the infraestructure and the bot. */
global.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution.
bot.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution.
/* We will prepare first the infraestructure needed for the bot to run. There are 3 modules we need to sucessfullly initialize first. */
+1 -1
View File
@@ -70,7 +70,7 @@
/* We define the datetime for the process that we are running now. This will be the official processing time for both the infraestructure and the bot. */
global.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution.
bot.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution.
/* We will prepare first the infraestructure needed for the bot to run. There are 3 modules we need to sucessfullly initialize first. */
+1 -2
View File
@@ -75,8 +75,7 @@
/* We define the datetime for the process that we are running now. This will be the official processing time for both the infraestructure and the bot. */
global.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution.
global.processDatetime = new Date(global.processDatetime.valueOf() - 30 * 24 * 60 * 60 * 1000); // we go 30 days back in time since candles are currently not up to date.
bot.processDatetime = new Date(); // This will be considered the process date and time, so as to have it consistenly all over the execution.
/* We will prepare first the infraestructure needed for the bot to run. There are 3 modules we need to sucessfullly initialize first. */