From 8bd9ebf0d95ffa85751a104b28f29e3f879a1ad8 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 5 Jan 2020 11:25:46 +0100 Subject: [PATCH] Exchange taken from UI --- Historic-Trades/User.Bot.js | 18 +++++++++--------- Live-Trades/User.Bot.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Historic-Trades/User.Bot.js b/Historic-Trades/User.Bot.js index ce9fa60cc..266d7358a 100644 --- a/Historic-Trades/User.Bot.js +++ b/Historic-Trades/User.Bot.js @@ -268,7 +268,7 @@ This process complements the Live Trades process and write historical trades fil logger.write(MODULE_NAME, "[INFO] Entering function 'getMarketStatusReport'"); } - let reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process; + let reportFilePath = bot.exchange + "/Processes/" + bot.process; let fileName = "Status.Report." + market.assetA + '_' + market.assetB + ".json"; charlyStorage.getTextFile(reportFilePath, fileName, onFileReceived); @@ -324,7 +324,7 @@ This process complements the Live Trades process and write historical trades fil logger.write(MODULE_NAME, "[INFO] Entering function 'getMarketStatusReport'"); } - let reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process + "/" + year + "/" + month; + let reportFilePath = bot.exchange + "/Processes/" + bot.process + "/" + year + "/" + month; let fileName = "Status.Report." + market.assetA + '_' + market.assetB + ".json"; charlyStorage.getTextFile(reportFilePath, fileName, onFileReceived); @@ -411,7 +411,7 @@ This process complements the Live Trades process and write historical trades fil exchangeCallTime = new Date(); - let poloniexApiClient = POLONIEX_CLIENT_MODULE.newPoloniexAPIClient(global.EXCHANGE_KEYS[global.EXCHANGE_NAME].Key, global.EXCHANGE_KEYS[global.EXCHANGE_NAME].Secret); + let poloniexApiClient = POLONIEX_CLIENT_MODULE.newPoloniexAPIClient(global.EXCHANGE_KEYS[bot.exchange].Key, global.EXCHANGE_KEYS[bot.exchange].Secret); poloniexApiClient.API.returnPublicTradeHistory(market.assetA, market.assetB, startTime, endTime, onExchangeCallReturned); @@ -718,7 +718,7 @@ This process complements the Live Trades process and write historical trades fil dateForPath = date.getUTCFullYear() + '/' + utilities.pad(date.getUTCMonth() + 1, 2) + '/' + utilities.pad(date.getUTCDate(), 2) + '/' + utilities.pad(date.getUTCHours(), 2) + '/' + utilities.pad(date.getUTCMinutes(), 2); - filePath = global.EXCHANGE_NAME + "/Output/" + TRADES_FOLDER_NAME + '/' + dateForPath; + filePath = bot.exchange + "/Output/" + TRADES_FOLDER_NAME + '/' + dateForPath; utilities.createFolderIfNeeded(filePath, charlyStorage, onFolderCreated); @@ -840,7 +840,7 @@ This process complements the Live Trades process and write historical trades fil logger.write(MODULE_NAME, "[INFO] Entering function 'writeStatusReport'"); } - let reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process + "/" + year + "/" + month; + let reportFilePath = bot.exchange + "/Processes/" + bot.process + "/" + year + "/" + month; utilities.createFolderIfNeeded(reportFilePath, charlyStorage, onFolderCreated); @@ -871,7 +871,7 @@ This process complements the Live Trades process and write historical trades fil if (isBeginingOfMarket === true) { - reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process; + reportFilePath = bot.exchange + "/Processes/" + bot.process; utilities.createFolderIfNeeded(reportFilePath, charlyStorage, onFolderCreated); @@ -954,7 +954,7 @@ This process complements the Live Trades process and write historical trades fil let finalYear = (new Date()).getUTCFullYear(); let finalMonth = (new Date()).getUTCMonth() + 1; - let reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process; + let reportFilePath = bot.exchange + "/Processes/" + bot.process; let fileName = "Status.Report." + market.assetA + '_' + market.assetB + ".json"; /* Lets read the main status report */ @@ -992,7 +992,7 @@ This process complements the Live Trades process and write historical trades fil */ let paddedInitialMonth = utilities.pad(initialMonth, 2); - let reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process + "/" + initialYear + "/" + paddedInitialMonth; + let reportFilePath = bot.exchange + "/Processes/" + bot.process + "/" + initialYear + "/" + paddedInitialMonth; let fileName = "Status.Report." + market.assetA + '_' + market.assetB + ".json"; charlyStorage.getTextFile(reportFilePath, fileName, onStatusReportFileReceived); @@ -1058,7 +1058,7 @@ This process complements the Live Trades process and write historical trades fil /* We will read the current file to preserve its data, and save it again with market complete = true */ - let reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process; + let reportFilePath = bot.exchange + "/Processes/" + bot.process; let fileName = "Status.Report." + market.assetA + '_' + market.assetB + ".json"; charlyStorage.getTextFile(reportFilePath, fileName, onFileReceived); diff --git a/Live-Trades/User.Bot.js b/Live-Trades/User.Bot.js index 69235cd43..cac0872a6 100644 --- a/Live-Trades/User.Bot.js +++ b/Live-Trades/User.Bot.js @@ -83,7 +83,7 @@ let filePathA; let filePathB; - let reportFilePath = global.EXCHANGE_NAME + "/Processes/" + bot.process; + let reportFilePath = bot.exchange + "/Processes/" + bot.process; let exchangeCallTime;