From 5fc682cf9636d0a3aea4dc2c40963a8365403cb0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 19 Mar 2020 22:17:04 +0100 Subject: [PATCH] percentage implemented --- Multi-Period-Daily/User.Bot.js | 11 ++++++++++- Multi-Period-Market/User.Bot.js | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Multi-Period-Daily/User.Bot.js b/Multi-Period-Daily/User.Bot.js index b81b302d0..21d650bef 100644 --- a/Multi-Period-Daily/User.Bot.js +++ b/Multi-Period-Daily/User.Bot.js @@ -255,6 +255,8 @@ let n; processDate = new Date(contextVariables.lastCandleFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop. + let fromDate = new Date(processDate.valueOf()) + let lastDate = new Date() if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> buildStairs -> processDate = " + processDate); } advanceTime(); @@ -283,6 +285,11 @@ } + /* Telling the world we are alive and doing well */ + let currentDateString = processDate.getUTCFullYear() + '-' + utilities.pad(processDate.getUTCMonth() + 1, 2) + '-' + utilities.pad(processDate.getUTCDate(), 2); + let currentDate = new Date(processDate) + bot.processHeartBeat(currentDateString, global.getPercentage(fromDate, currentDate, lastDate)) + periodsLoop(); } catch (err) { @@ -1620,7 +1627,9 @@ thisReport.file.beginingOfMarket = beginingOfMarket.toUTCString() thisReport.save(callBack); - logger.newInternalLoop(bot.codeName, bot.process, lastFileDate); + 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 f0e976090..a8f1d8f15 100644 --- a/Multi-Period-Market/User.Bot.js +++ b/Multi-Period-Market/User.Bot.js @@ -23,6 +23,7 @@ }; let statusDependencies; + let utilities = UTILITIES.newCloudUtilities(bot, logger); let fileStorage = FILE_STORAGE.newFileStorage(logger); return thisObject; @@ -793,6 +794,15 @@ thisReport.file.lastExecution = bot.processDatetime; thisReport.save(callBack); + if (global.areEqualDates(bot.processDatetime, new Date()) === false) { + logger.newInternalLoop(bot.codeName, bot.process, bot.processDatetime); + } + + /* Telling the world we are alive and doing well */ + let currentDateString = bot.processDatetime.getUTCFullYear() + '-' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '-' + utilities.pad(bot.processDatetime.getUTCDate(), 2); + let currentDate = new Date(bot.processDatetime) + let lastDate = new Date() + bot.processHeartBeat(currentDateString, global.getPercentage(currentDate, currentDate, lastDate)) } catch (err) { logger.write(MODULE_NAME, "[ERROR] start -> writeStatusReport -> err = " + err.stack);