From 35c0680bb05920f23ade628bf8d348c9a77fd23d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 9 Feb 2018 19:50:00 +0100 Subject: [PATCH] LastFile corrected at the last status report --- .vs/AABruce/v15/.suo | Bin 30208 -> 30208 bytes One-Min-Daily-Candles/Interval.js | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.vs/AABruce/v15/.suo b/.vs/AABruce/v15/.suo index fd10d74af88f9c9c5e120e789f139f563bc0686b..2c99f0fa5711fb69e09c5ed900d50dfaa8654c4a 100644 GIT binary patch delta 252 zcmZp8!`SeKae{#?0}Kc-Ft7vJOhEka|Ns9WVaCaYEXErX8W<-r<*+WOxWDt-=0c|5 z%&ZOd1 zvo@3@-T*S$+Qk@OZ2l?ppBF@FvGa4kU}s thisDatetime.getUTCMonth() + 1) || year > thisDatetime.getUTCFullYear()) { + if ((year === thisDatetime.getUTCFullYear() && parseInt(month) > thisDatetime.getUTCMonth() + 1) || year > thisDatetime.getUTCFullYear()) { logger.write("[INFO] We are too far in the future. Interval will not execute. Sorry."); return; @@ -114,7 +114,7 @@ Read the trades from Charly's Output and pack them into daily files with candles let atHeadOfMarket; // This tell us if we are at the month which includes the head of the market according to current datetime. - if ((year === thisDatetime.getUTCFullYear() && month === thisDatetime.getUTCMonth() + 1)) { + if ((year === thisDatetime.getUTCFullYear() && parseInt(month) === thisDatetime.getUTCMonth() + 1)) { atHeadOfMarket = true; @@ -302,7 +302,18 @@ Read the trades from Charly's Output and pack them into daily files with candles firstTradeFile = new Date(statusReport.lastFile.year + "-" + statusReport.lastFile.month + "-" + statusReport.lastFile.days + " " + statusReport.lastFile.hours + ":" + statusReport.lastFile.minutes + GMT_SECONDS); - getHoleFixing(); + if ((year === firstTradeFile.getUTCFullYear() && parseInt(month) < firstTradeFile.getUTCMonth() + 1) || year < firstTradeFile.getUTCFullYear()) { + + const logText = "[INFO] 'getStatusReport' - the requested month / year are before the begining of this market " + market.assetA + '_' + market.assetB + " . Skipping it. "; + logger.write(logText); + + closeAndOpenMarket(); + + } else { + + getHoleFixing(); + + } } catch (err) { @@ -589,6 +600,8 @@ Read the trades from Charly's Output and pack them into daily files with candles if (date.getUTCMonth() + 1 !== parseInt(month)) { + lastCandleFile = new Date(lastCandleFile.valueOf() - ONE_DAY_IN_MILISECONDS); + writeStatusReport(lastCandleFile, lastCandleClose, true, onStatusReportWritten); return;