Rename to Cloud
This commit is contained in:
1 parent
15c0e2d15d
commit
a8da33e9e8
8 files changed
+36
-5
No files matched your search
Binary file not shown.
Binary file not shown.
File renamed without changes.
+29
-2
@@ -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) {
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user