From 757e646a5c0dd9c75592485bfe24b93577074eb2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 20 Mar 2020 11:01:45 +0100 Subject: [PATCH] logging improved --- Multi-Period-Daily/User.bot.js | 9 +++++---- Multi-Period-Market/User.bot.js | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Multi-Period-Daily/User.bot.js b/Multi-Period-Daily/User.bot.js index 716521695..7329782c2 100644 --- a/Multi-Period-Daily/User.bot.js +++ b/Multi-Period-Daily/User.bot.js @@ -259,8 +259,12 @@ Read the candles and volumes from Exchange Raw Data and produce a file for each /* Telling the world we are alive and doing well */ let currentDateString = contextVariables.lastCandleFile.getUTCFullYear() + '-' + utilities.pad(contextVariables.lastCandleFile.getUTCMonth() + 1, 2) + '-' + utilities.pad(contextVariables.lastCandleFile.getUTCDate(), 2); let currentDate = new Date(contextVariables.lastCandleFile) - bot.processHeartBeat(currentDateString, global.getPercentage(fromDate, currentDate, lastDate)) + let percentage = global.getPercentage(fromDate, currentDate, lastDate) + bot.processHeartBeat(currentDateString, percentage) + if (global.areEqualDates(currentDate, new Date()) === false) { + logger.newInternalLoop(bot.codeName, bot.process, currentDate, percentage); + } /* We prepere the arrays that will accumulate all the information for each output file. @@ -790,9 +794,6 @@ Read the candles and volumes from Exchange Raw Data and produce a file for each thisReport.file.beginingOfMarket = beginingOfMarket.toUTCString() thisReport.save(callBack); - if (global.areEqualDates(lastFileDate, new Date()) === false) { - logger.newInternalLoop(bot.codeName, bot.process, lastFileDate); - } } catch (err) { logger.write(MODULE_NAME, "[ERROR] start -> writeStatusReport -> err = " + err.stack); diff --git a/Multi-Period-Market/User.bot.js b/Multi-Period-Market/User.bot.js index a0e16255b..b7664236e 100644 --- a/Multi-Period-Market/User.bot.js +++ b/Multi-Period-Market/User.bot.js @@ -418,14 +418,15 @@ return; } - if (global.areEqualDates(contextVariables.lastCandleFile, new Date()) === false) { - logger.newInternalLoop(bot.codeName, bot.process, contextVariables.lastCandleFile); - } - /* Telling the world we are alive and doing well */ let currentDateString = contextVariables.lastCandleFile.getUTCFullYear() + '-' + utilities.pad(contextVariables.lastCandleFile.getUTCMonth() + 1, 2) + '-' + utilities.pad(contextVariables.lastCandleFile.getUTCDate(), 2); let currentDate = new Date(contextVariables.lastCandleFile) - bot.processHeartBeat(currentDateString, global.getPercentage(fromDate, currentDate, lastDate)) + let percentage = global.getPercentage(fromDate, currentDate, lastDate) + bot.processHeartBeat(currentDateString, percentage) + + if (global.areEqualDates(currentDate, new Date()) === false) { + logger.newInternalLoop(bot.codeName, bot.process, currentDate, percentage); + } periodsLoop();