From 6e178fe3ec8614102f940ccdb36628729a9f073f Mon Sep 17 00:00:00 2001 From: Smidy13 <77650800+Smidy13@users.noreply.github.com> Date: Wed, 23 Jun 2021 23:13:56 +1200 Subject: [PATCH] Bug Fix: Accept Empty OHLCV if at the Current Minute --- .../Sensor-Bot/Exchange-Raw-Data/HistoricOHLCVs.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Projects/Foundations/TS/Bot-Modules/Sensor-Bot/Exchange-Raw-Data/HistoricOHLCVs.js b/Projects/Foundations/TS/Bot-Modules/Sensor-Bot/Exchange-Raw-Data/HistoricOHLCVs.js index 9feb26e82..a1f6f0253 100644 --- a/Projects/Foundations/TS/Bot-Modules/Sensor-Bot/Exchange-Raw-Data/HistoricOHLCVs.js +++ b/Projects/Foundations/TS/Bot-Modules/Sensor-Bot/Exchange-Raw-Data/HistoricOHLCVs.js @@ -418,18 +418,21 @@ await exchange.fetchOHLCV(symbol, '1m', since, limit, params) - if (OHLCVs.length === 0) { + if (OHLCVs.length === 0 && new Date(since).valueOf() !== (new Date).setSeconds(0,0)) { + /* - If OHLCVs is empty we might be dealing with extended maintenance longer than our OHLCV limit. + If OHLCVs is empty and we're not at the current minute we might + be dealing with extended maintenance longer than our OHLCV limit. If this is the case jump forward to the next valid OHLCV record. */ + since = await findNextValidOHLCV() } /* CCXT for certain Exchanges will return an empty or partial array if the since date is too far in the past if this occurs this function will recursively step backwards in the Exchange - and Market in 1D intervals until it finds the earliest date with values. + and Market in 1D intervals until it finds the earliest date with values. */ async function findMarketStart() {