From e200c42b7296ac7dce45f3d4e4ec9fafb040f6cb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 19 Mar 2019 17:45:49 +0100 Subject: [PATCH] Bug fixed edcase when we start we dont have a previous file --- MultiPeriodDaily.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MultiPeriodDaily.js b/MultiPeriodDaily.js index d40f4952c..47293e621 100644 --- a/MultiPeriodDaily.js +++ b/MultiPeriodDaily.js @@ -243,12 +243,11 @@ } else { /* - In the case when there is no status report, we take the date of the file with the first trades as the begining of the market. Then we will - go one day further in time, so that the previous day does fine a file at the begining of the market. + In the case when there is no status report, we assume like the last processed file is the one on the date of Begining of Market. */ contextVariables.lastFile = new Date(contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" + (contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" + contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" + GMT_SECONDS); - contextVariables.lastFile = new Date(contextVariables.lastFile.valueOf() + ONE_DAY_IN_MILISECONDS); + //contextVariables.lastFile = new Date(contextVariables.lastFile.valueOf() + ONE_DAY_IN_MILISECONDS); if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> thisReport.lastFile === undefined"); } if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> contextVariables.lastFile = " + contextVariables.lastFile); } @@ -376,7 +375,12 @@ let previousFile; let currentFile; - getPreviousFile(); + if (currentDay.valueOf() > contextVariables.dateBeginOfMarket.valueOf()) { + getPreviousFile(); + } else { + previousFile = []; + getCurrentFile() + } function getPreviousFile() {