diff --git a/src/DailyFiles.js b/src/DailyFiles.js index 9a5820253..37b7c7464 100644 --- a/src/DailyFiles.js +++ b/src/DailyFiles.js @@ -49,11 +49,7 @@ function newDailyFiles () { try { callBackWhenFileReceived = callBackFunction - let exchange = ecosystem.getExchange(pProduct, pExchange) - - if (exchange === undefined) { - throw 'Exchange not supoorted by this product of the ecosystem! - pDataMine.code.codeName = ' + pDataMine.code.codeName + ', pBot.code.codeName = ' + pBot.code.codeName + ', pProduct.code.codeName = ' + pProduct.code.codeName + ', pExchange = ' + pExchange - } + let exchange = pExchange fileCloud = newFileCloud() fileCloud.initialize(pBot) @@ -107,7 +103,7 @@ function newDailyFiles () { let periodTime = dailyFilePeriods[i][0] let periodName = dailyFilePeriods[i][1] - if (pDataset.validPeriods.includes(periodName) === true) { + if (pDataset.code.validTimeFrames.includes(periodName) === true) { let fileCursor = newFileCursor() fileCursor.eventHandler = thisObject.eventHandler // We share our event handler with each file cursor, so that they can raise events there when files are changed.s fileCursor.initialize(fileCloud, pDataMine, pBot, pSession, pProduct, pDataset, exchange, pMarket, periodName, periodTime, pDatetime, pTimeFrame, beginDateRange, endDateRange, onInitialized) @@ -143,7 +139,7 @@ function newDailyFiles () { let periodTime = dailyFilePeriods[i][0] let periodName = dailyFilePeriods[i][1] - if (pDataset.validPeriods.includes(periodName) === true) { + if (pDataset.code.validTimeFrames.includes(periodName) === true) { let fileCursor = fileCursors.get(periodTime) fileCursor.reload(onFileReceived) } diff --git a/src/FileCloud.js b/src/FileCloud.js index 97b3885f5..3cb31e8d5 100644 --- a/src/FileCloud.js +++ b/src/FileCloud.js @@ -36,18 +36,18 @@ function newFileCloud () { function getFileRecursively (pRetryCounter, pDataMine, pBot, pSession, pDataset, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) { try { if (INFO_LOG === true) { logger.write('[INFO] getFile -> getFileRecursively -> Entering function.') } - if (INFO_LOG === true) { logger.write('[INFO] getFile -> getFileRecursively -> key = ' + pDataMine.code.codeName + '-' + pBot.code.codeName + '-' + pDataset.filePath + '-' + pDataset.fileName) } + if (INFO_LOG === true) { logger.write('[INFO] getFile -> getFileRecursively -> key = ' + pDataMine.code.codeName + '-' + pBot.code.codeName + '-' + pDataset.code.filePath + '-' + pDataset.code.fileName) } let fileName let filePath if (pDataRange === undefined) { - fileName = pDataset.fileName - filePath = pDataset.filePath + fileName = pDataset.code.fileName + filePath = pDataset.code.filePath } else { - if (pDataset.dataRange !== undefined) { - fileName = pDataset.dataRange.fileName - filePath = pDataset.dataRange.filePath + if (pDataset.code.dataRange !== undefined) { + fileName = pDataset.code.dataRange.fileName + filePath = pDataset.code.dataRange.filePath } else { let customErr = { result: GLOBAL.CUSTOM_FAIL_RESPONSE.result, @@ -84,11 +84,7 @@ function newFileCloud () { } if (pBot !== undefined) { - if (pBot.cloneId !== undefined) { - filePath = filePath.replace('@Bot', pBot.code.codeName + '-' + pBot.cloneId) - } else { - filePath = filePath.replace('@Bot', pBot.code.codeName) - } + filePath = filePath.replace('@Bot', pBot.code.codeName) } if (pSession !== undefined) { @@ -108,7 +104,7 @@ function newFileCloud () { } if (pExchange !== undefined) { - filePath = filePath.replace('@Exchange', pExchange.code.code.codeName) + filePath = filePath.replace('@Exchange', pExchange.code.codeName) } filePath = filePath.replace('@Period', pPeriodName) @@ -130,7 +126,7 @@ function newFileCloud () { let containerName - containerName = pDataMine.code.codeName.toLowerCase() + containerName = pDataMine.codeName.toLowerCase() blobService.getBlobToText(containerName, filePath + '/' + fileName, pDataMine.host, onFileReceived) diff --git a/src/FileSequence.js b/src/FileSequence.js index cc9682be7..3646cfcc1 100644 --- a/src/FileSequence.js +++ b/src/FileSequence.js @@ -61,12 +61,7 @@ function newFileSequence () { function initialize (pDataMine, pBot, pSession, pProduct, pDataset, pExchange, pMarket, callBackFunction) { try { - exchange = ecosystem.getExchange(pProduct, pExchange) - - if (exchange === undefined) { - throw 'Exchange not supoorted by this pProduct of the ecosystem! - pDataMine.code.codeName = ' + pDataMine.code.codeName + ', pBot.code.codeName = ' + pBot.code.codeName + ', pProduct.code.codeName = ' + pProduct.code.codeName + ', pExchange = ' + pExchange - } - + exchange = pExchange market = pMarket dataMine = pDataMine bot = pBot diff --git a/src/MarketFiles.js b/src/MarketFiles.js index e9c6f961c..272f35476 100644 --- a/src/MarketFiles.js +++ b/src/MarketFiles.js @@ -67,12 +67,7 @@ function newMarketFiles () { function initialize (pDataMine, pBot, pSession, pProduct, pDataset, pExchange, pMarket, callBackFunction) { try { - exchange = ecosystem.getExchange(pProduct, pExchange) - - if (exchange === undefined) { - throw 'Exchange not supoorted by this pProduct of the ecosystem! - pDataMine.code.codeName = ' + pDataMine.code.codeName + ', pBot.code.codeName = ' + pBot.code.codeName + ', pProduct.code.codeName = ' + pProduct.code.codeName + ', pExchange = ' + pExchange - } - + exchange = pExchange market = pMarket dataMine = pDataMine bot = pBot @@ -89,7 +84,7 @@ function newMarketFiles () { let periodTime = marketFilesPeriods[i][0] let periodName = marketFilesPeriods[i][1] - if (dataset.validPeriods.includes(periodName) === true) { + if (dataset.code.validTimeFrames.includes(periodName) === true) { fileCloud.getFile(dataMine, bot, session, dataset, exchange, market, periodName, undefined, undefined, undefined, onFileReceived) function onFileReceived (err, file) { @@ -136,7 +131,7 @@ function newMarketFiles () { let periodTime = marketFilesPeriods[i][0] let periodName = marketFilesPeriods[i][1] - if (dataset.validPeriods.includes(periodName) === true) { + if (dataset.code.validTimeFrames.includes(periodName) === true) { fileCloud.getFile(dataMine, bot, session, dataset, exchange, market, periodName, undefined, undefined, undefined, onFileReceived) function onFileReceived (err, file) { diff --git a/src/SingleFile.js b/src/SingleFile.js index 031a553c9..1b12b44ef 100644 --- a/src/SingleFile.js +++ b/src/SingleFile.js @@ -21,13 +21,7 @@ function newSingleFile () { if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') } if (INFO_LOG === true) { logger.write('[INFO] initialize -> key = ' + pDataMine.code.codeName + '-' + pBot.code.codeName + '-' + pProduct.code.codeName) } - let exchange = ecosystem.getExchange(pProduct, pExchange) - - if (pExchange !== undefined && exchange === undefined) { - // We support no exchange as a parameter, but if provided, then it must be at the list of exchanges of that product. - - throw 'Exchange not supoorted by this pProduct of the ecosystem! - pDataMine.code.codeName = ' + pDataMine.code.codeName + ', pBot.code.codeName = ' + pBot.code.codeName + ', pProduct.code.codeName = ' + pProduct.code.codeName + ', pExchange = ' + pExchange - } + let exchange = pExchange fileCloud = newFileCloud() fileCloud.initialize(pBot)