key instance changed

This commit is contained in:
Luis Fernando Molina committed 2020-01-27 21:16:51 +01:00
1 parent d093b10b84
commit 2350dc0b23
3 files changed
+24 -32

No files matched your search

+17
View File
@@ -235,6 +235,23 @@
/* Bot Type */
botConfig.type = global.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.type
/* Setting the Key to use */
process.env.KEY = undefined
process.env.SECRET = undefined
if (botConfig.processNode) {
if (botConfig.processNode.marketReference) {
if (botConfig.processNode.marketReference.keyInstance !== undefined) {
if (botConfig.processNode.marketReference.keyInstance.referenceParent !== undefined) {
let key = botConfig.processNode.marketReference.keyInstance.referenceParent
process.env.KEY = key.code.codeName
process.env.SECRET = key.code.secret
}
}
}
}
if (FULL_LOG === true) { console.log(logDisplace + "Root : [INFO] start -> bootingBot -> filePathRoot = " + botConfig.filePathRoot); }
if (FULL_LOG === true) { console.log(logDisplace + "Root : [INFO] start -> bootingBot -> Process found at the bot configuration file. -> process = " + global.TASK_NODE.bot.processes[processIndex].referenceParent.code.codeName); }
+6 -1
View File
@@ -59,7 +59,12 @@
if (bot.process === "Hole-Fixing") {
//USER_BOT_MODULE.newUserBot = require(process.env.BOTS_PATH + '/aamasters/AAMasters/bots/AACharly-Sensor-Bot/Hole-Fixing/User.Bot').newUserBot
}
USER_BOT_MODULE.newUserBot = eval(text); // TODO This needs to be changed function
try {
USER_BOT_MODULE.newUserBot = eval(text); // TODO This needs to be changed function
} catch (err) {
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onBotDownloaded -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
filePath = bot.dataMine + "/" + "bots" + "/" + bot.repo;
filePath += "/Commons.js"
+1 -31
View File
@@ -109,7 +109,7 @@
}
function startLiveTrading(message) {
setKeyToUse()
if (process.env.KEY === undefined || process.env.SECRET === undefined) {
if (FULL_LOG === true) { parentLogger.write(MODULE_NAME, "[WARN] initialize -> startLiveTrading -> Key name or Secret not provided, not possible to run the process in Live mode."); }
console.log("Key 'codeName' or 'secret' not provided. Plese check that and try again.")
@@ -128,8 +128,6 @@
function startFordwardTesting(message) {
setKeyToUse()
if (process.env.KEY === undefined || process.env.SECRET === undefined) {
if (FULL_LOG === true) { parentLogger.write(MODULE_NAME, "[WARN] initialize -> startLiveTrading -> Key name or Secret not provided, not possible to run the process in Forward Testing mode."); }
console.log("Key 'codeName' or 'secret' not provided. Plese check that and try again.")
@@ -175,34 +173,6 @@
return true
}
function setKeyToUse() {
/* This is the primary fallback, when there is no key defined at the parameters at the session level. */
if (bot.TRADING_SYSTEM) {
if (bot.TRADING_SYSTEM.parameters) {
if (bot.TRADING_SYSTEM.parameters.keyInstance !== undefined) {
if (bot.TRADING_SYSTEM.parameters.keyInstance.referenceParent !== undefined) {
let key = bot.TRADING_SYSTEM.parameters.keyInstance.referenceParent
process.env.KEY = key.code.codeName
process.env.SECRET = key.code.secret
}
}
}
}
/* Key defined at the parameters at the session level. */
if (bot.SESSION.parameters) {
if (bot.SESSION.parameters.keyInstance !== undefined) {
if (bot.SESSION.parameters.keyInstance.referenceParent !== undefined) {
let key = bot.SESSION.parameters.keyInstance.referenceParent
process.env.KEY = key.code.codeName
process.env.SECRET = key.code.secret
}
}
}
}
function setValuesToUse(message) {
/*
Base on the information received we will determined which values ultimatelly are going to be used,