diff --git a/.vs/AACloud/v15/.suo b/.vs/AACloud/v15/.suo new file mode 100644 index 000000000..b8cf5298c Binary files /dev/null and b/.vs/AACloud/v15/.suo differ diff --git a/.vs/AACloudPlatform/v15/.suo b/.vs/AACloudPlatform/v15/.suo deleted file mode 100644 index 1ba82e664..000000000 Binary files a/.vs/AACloudPlatform/v15/.suo and /dev/null differ diff --git a/AACloudPlatform.sln b/AACloud.sln similarity index 100% rename from AACloudPlatform.sln rename to AACloud.sln diff --git a/Assistant.js b/Assistant.js index d173949f6..e5df97d14 100644 --- a/Assistant.js +++ b/Assistant.js @@ -70,6 +70,15 @@ return; } + /* If we are in Exchange Simulation Mode then there is not much to do here. */ + + if (global.EXCHANGE_SIMULATION_MODE === true) { + + logger.write("[WARN] initialize -> Exchange Simulation Mode detected. -> Skipping all validations."); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return; + } + /* Procedure to validate we are in sync with the exchange. */ getPositionsAtExchange(onDone); @@ -591,7 +600,16 @@ /* All validations passed, we proceed. */ - exchangeAPI.putPosition(global.MARKET, pType, pRate, pAmountA, pAmountB, onResponse); + if (global.EXCHANGE_SIMULATION_MODE === false) { + + exchangeAPI.putPosition(global.MARKET, pType, pRate, pAmountA, pAmountB, onResponse); + + } else { + + let positionId = Math.trunc(Math.random(1) * 1000000); + if (FULL_LOG === true) { logger.write("[INFO] putPosition -> Simulating Exchange Response -> orderId = " + positionId); } + onResponse(global.DEFAULT_OK_RESPONSE, positionId); + } function onResponse(err, pPositionId) { @@ -674,7 +692,16 @@ if (FULL_LOG === true) { logger.write("[INFO] movePosition -> pPosition = " + JSON.stringify(pPosition)); } if (FULL_LOG === true) { logger.write("[INFO] movePosition -> pNewRate = " + pNewRate); } - exchangeAPI.movePosition(pPosition, pNewRate, onResponse); + if (global.EXCHANGE_SIMULATION_MODE === false) { + + exchangeAPI.movePosition(pPosition, pNewRate, onResponse); + + } else { + + let positionId = Math.trunc(Math.random(1) * 1000000); + if (FULL_LOG === true) { logger.write("[INFO] putPosition -> Simulating Exchange Response -> orderId = " + positionId); } + onResponse(global.DEFAULT_OK_RESPONSE, positionId); + } function onResponse(err, pPositionId) { diff --git a/Indicator Bot Main Loop.js b/Indicator Bot Main Loop.js index 8dc5bf631..b86e2e5f4 100644 --- a/Indicator Bot Main Loop.js +++ b/Indicator Bot Main Loop.js @@ -178,7 +178,7 @@ try { - global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('platform.config.json', 'utf8')); + global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('this.config.json', 'utf8')); return JSON.parse(global.PLATFORM_CONFIG.stopGracefully); } catch (err) { diff --git a/Run.js b/Run.js index ddcc3e6b0..07ca2dc98 100644 --- a/Run.js +++ b/Run.js @@ -5,13 +5,17 @@ const FULL_LOG = true; global.RUNNING_MODE = 'Production'; // 'Testnet' or 'Production' +/* You do not have funds at the exchange and still want run your bot? No problem activate the exchange simulation mode: */ + +global.EXCHANGE_SIMULATION_MODE = false; + /* First thing to do is to read the config and guess which bot we will be running. */ var fs = require('fs'); try { - global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('platform.config.json', 'utf8')); + global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('this.config.json', 'utf8')); } catch (err) { diff --git a/Trading Bot Main Loop.js b/Trading Bot Main Loop.js index bcefcef7e..cb90e7544 100644 --- a/Trading Bot Main Loop.js +++ b/Trading Bot Main Loop.js @@ -356,7 +356,7 @@ try { - global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('platform.config.json', 'utf8')); + global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('this.config.json', 'utf8')); return JSON.parse(global.PLATFORM_CONFIG.stopGracefully); } catch (err) { diff --git a/platform.config.json b/this.config.json similarity index 100% rename from platform.config.json rename to this.config.json