diff --git a/Assistant.js b/Assistant.js index adf3bc209..4c2fe181a 100644 --- a/Assistant.js +++ b/Assistant.js @@ -87,7 +87,7 @@ if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> getMarketRateFromExchange -> Entering function."); } - exchangeAPI.getTicker(global.MARKET, onTicker); + exchangeAPI.getTicker(bot.market, onTicker); return; @@ -144,7 +144,7 @@ let dataSet = thisObject.dataDependencies.dataSets.get(key); let dateForPath = bot.processDatetime.getUTCFullYear() + '/' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.processDatetime.getUTCDate(), 2); - let fileName = '' + global.MARKET.assetA + '_' + global.MARKET.assetB + '.json'; + let fileName = '' + bot.market.assetA + '_' + bot.market.assetB + '.json'; let filePath = bot.marketRateProvider.product + "/" + bot.marketRateProvider.dataSet + "/" + dateForPath; dataSet.getTextFile(filePath, fileName, onFileReceived); @@ -345,7 +345,7 @@ case "Live": { if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] getPositionsAtExchange -> Live Mode Detected."); } - exchangeAPI.getOpenPositions(global.MARKET, onResponse); + exchangeAPI.getOpenPositions(bot.market, onResponse); break; } @@ -360,7 +360,7 @@ case "Competition": { if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] getPositionsAtExchange -> Competition Mode Detected."); } - exchangeAPI.getOpenPositions(global.MARKET, onResponse); + exchangeAPI.getOpenPositions(bot.market, onResponse); break; } @@ -977,7 +977,7 @@ case "Live": { - exchangeAPI.putPosition(global.MARKET, pType, pRate, pAmountA, pAmountB, onResponse); + exchangeAPI.putPosition(bot.market, pType, pRate, pAmountA, pAmountB, onResponse); return; } @@ -997,7 +997,7 @@ case "Competition": { - exchangeAPI.putPosition(global.MARKET, pType, pRate, pAmountA, pAmountB, onResponse); + exchangeAPI.putPosition(bot.market, pType, pRate, pAmountA, pAmountB, onResponse); return; } diff --git a/Commons.js b/Commons.js index 3ff44b220..e08233d12 100644 --- a/Commons.js +++ b/Commons.js @@ -468,7 +468,7 @@ if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFile -> Entering function."); } - let market = global.MARKET; + let market = bot.market; let fileName = '' + market.assetA + '_' + market.assetB + '.json'; let dateForPath = '' diff --git a/MultiPeriod.js b/MultiPeriod.js index 52a7b427b..f0d3c59fa 100644 --- a/MultiPeriod.js +++ b/MultiPeriod.js @@ -93,7 +93,7 @@ let currentTimeFrame let currentOutputPeriodName - let market = global.MARKET; + let market = bot.market; let botNeverRan = true; /* Context Variables */ diff --git a/MultiPeriodDaily.js b/MultiPeriodDaily.js index 0fd6552f7..4432f7247 100644 --- a/MultiPeriodDaily.js +++ b/MultiPeriodDaily.js @@ -88,7 +88,7 @@ if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> Entering function."); } - let market = global.MARKET; + let market = bot.market; /* Context Variables */ diff --git a/MultiPeriodMarket.js b/MultiPeriodMarket.js index f4c056225..914ba0314 100644 --- a/MultiPeriodMarket.js +++ b/MultiPeriodMarket.js @@ -81,7 +81,7 @@ if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> Entering function."); } - let market = global.MARKET; + let market = bot.market; /* Context Variables */ diff --git a/Root.js b/Root.js index 79715c6f5..6881da5a5 100644 --- a/Root.js +++ b/Root.js @@ -209,6 +209,10 @@ /* Simplifying the access to basic info */ botConfig.dataMine = global.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.parentNode.code.codeName botConfig.exchange = global.TASK_NODE.bot.processes[processIndex].marketInstance.referenceParent.parentNode.parentNode.code.codeName + botConfig.market = { + assetA: global.TASK_NODE.bot.processes[processIndex].marketInstance.referenceParent.baseAsset.referenceParent.code.codeName, + assetB: global.TASK_NODE.bot.processes[processIndex].marketInstance.referenceParent.quotedAsset.referenceParent.code.codeName + } /* This stuff is still hardcoded and unresolved. */ botConfig.version = { diff --git a/StatusReport.js b/StatusReport.js index 603c82d53..b5d26862c 100644 --- a/StatusReport.js +++ b/StatusReport.js @@ -148,7 +148,7 @@ if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] load -> Entering function."); } - let fileName = "Status.Report." + global.MARKET.assetA + '_' + global.MARKET.assetB + ".json"; + let fileName = "Status.Report." + bot.market.assetA + '_' + bot.market.assetB + ".json"; let filePath; let ownerId = statusDependencyNode.dataMine + "-" + statusDependencyNode.bot + "-" + statusDependencyNode.botVersion.major + "-" + statusDependencyNode.botVersion.minor + "-" + statusDependencyNode.process + "-" + statusDependencyNode.dataSetVersion; @@ -245,7 +245,7 @@ return; } - let fileName = "Status.Report." + global.MARKET.assetA + '_' + global.MARKET.assetB + ".json"; + let fileName = "Status.Report." + bot.market.assetA + '_' + bot.market.assetB + ".json"; let filePath = bot.filePathRoot + "/Reports/" + sessionPath + statusDependencyNode.process + timePath; filePath += '/' + fileName diff --git a/TradingBot.js b/TradingBot.js index e1884d63b..cd3f71f92 100644 --- a/TradingBot.js +++ b/TradingBot.js @@ -107,7 +107,7 @@ const TRADING_SIMULATION = require('./TradingSimulation.js'); let tradingSimulation = TRADING_SIMULATION.newTradingSimulation(bot, logger, UTILITIES); - let market = global.MARKET; + let market = bot.market; const SIMULATED_RECORDS_FOLDER_NAME = "Trading-Simulation"; const CONDITIONS_FOLDER_NAME = "Simulation-Conditions"; diff --git a/server.js b/server.js index 72a013ce4..8e67c9460 100644 --- a/server.js +++ b/server.js @@ -92,7 +92,6 @@ global.WRITE_LOGS_TO_FILES = process.env.WRITE_LOGS_TO_FILES /* Default parameters can be changed by the execution configuration */ -global.MARKET = { assetA: 'USDT', assetB: 'BTC' } global.CLONE_EXECUTOR = { codeName: 'AACloud', version: '1.1' } // NOTE: To refactor the name of this variable you would need to go through the bots code that are using it. /*