From 3d8f92ff3b53e2a2b2d117ad7fbe00991f5ffdb2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 26 Feb 2020 14:40:04 +0100 Subject: [PATCH] Validations added --- src/DailyFiles.js | 8 ++++++++ src/MarketFiles.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/DailyFiles.js b/src/DailyFiles.js index 37b7c7464..3ea192514 100644 --- a/src/DailyFiles.js +++ b/src/DailyFiles.js @@ -54,6 +54,14 @@ function newDailyFiles () { fileCloud = newFileCloud() fileCloud.initialize(pBot) + /* Some Validations */ + if (pDataset.code.validTimeFrames === undefined) { + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = Can not initialize Market Files for bot ' + pBot.name) } + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = You need to define validTimeFrames at the Dataset config. ') } + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + return + } + /* First we will get the Data Range */ fileCloud.getFile(pDataMine, pBot, pSession, pDataset, exchange, pMarket, undefined, undefined, undefined, true, onDataRangeReceived) diff --git a/src/MarketFiles.js b/src/MarketFiles.js index 272f35476..dedf776c6 100644 --- a/src/MarketFiles.js +++ b/src/MarketFiles.js @@ -78,6 +78,14 @@ function newMarketFiles () { fileCloud = newFileCloud() fileCloud.initialize(pBot) + /* Some Validations */ + if (dataset.code.validTimeFrames === undefined) { + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = Can not initialize Market Files for bot ' + pBot.name) } + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = You need to define validTimeFrames at the Dataset config. ') } + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + return + } + /* Now we will get the market files */ for (let i = 0; i < marketFilesPeriods.length; i++) {