Keys taken from parameters

This commit is contained in:
Luis Fernando Molina committed 2019-10-11 14:41:59 +02:00
1 parent 38208e3457
commit f37d16b797
2 files changed
+25 -2

No files matched your search

+24 -1
View File
@@ -67,6 +67,7 @@
function startLiveTrading(message) {
/* The last place where we can find a key to use is the key pool at the exchange account. */
if (bot.DEFINITION.personalData) {
if (bot.DEFINITION.personalData.exchangeAccounts) {
if (bot.DEFINITION.personalData.exchangeAccounts.length > 0) {
@@ -84,8 +85,30 @@
}
}
/* This is the primary fallback, when there is no key defined at the parameters at the session level. */
if (bot.DEFINITION.tradingSystem) {
if (bot.DEFINITION.tradingSystem.parameters) {
if (bot.DEFINITION.tradingSystem.parameters.key !== undefined) {
let key = bot.DEFINITION.tradingSystem.parameters.key
process.env.KEY = key.name
process.env.SECRET = key.code
}
}
}
/* Key defined at the parameters at the session level. */
if (bot.SESSION.parameters) {
if (bot.SESSION.parameters.key !== undefined) {
let key = bot.SESSION.parameters.key
process.env.KEY = key.name
process.env.SECRET = key.code
}
}
if (process.env.KEY === undefined || process.env.SECRET === undefined) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[WARN] initialize -> startLiveTrading -> Key name or Secret not provided, not possible to run the process in Live mode."); }
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."); }
return
}
+1 -1
View File
@@ -72,7 +72,7 @@ if (global.TASK_NODE !== undefined) {
}
else { // I use this section to debug in standalone mode.
let argument = '{"type":"Task","name":"Runs Backtests","bot":{"type":"Trading Engine","code":{"team":"AAMasters","bot":"AAJason","repo":"AAJason-Trading-Engine-Bot"},"processes":[{"type":"Process","subType":"Trading Engine Process","name":"Multi Period","code":{"process":"Multi-Period"},"session":{"type":"Backtesting Session","name":"10 Minutes","id":"121202ea-6735-4bf3-8a95-aaa55f00f6e7"},"id":"3f483482-d8a1-4755-ba50-7cac6296fa5f"}],"id":"25fe9099-b53d-4757-8a63-3f8a15875f33"},"id":"5b21d2d2-0f52-4408-83eb-ddaa844ec58c"}'
let argument = '{"type":"Task","name":"New Task","bot":{"type":"Trading Engine","code":{"team":"AAMasters","bot":"AAJason","repo":"AAJason-Trading-Engine-Bot"},"processes":[{"type":"Process","subType":"Trading Engine Process","name":"Trading Engine Process","code":{"process":"Multi-Period"},"session":{"type":"Live Trading Session","name":"New Live Trading Session","id":"1be42eb3-bfaf-432f-8da6-15f15d547f50"},"id":"16d02098-221f-4d83-9682-a5f83262bb74"}],"id":"72cdfb23-b7c6-4feb-ba2d-d56415d30162"},"id":"c6fb2087-d2a2-49a0-9790-2c4d1cb015d7"}'
/* charly argument = '{"type":"Task","name":"Brings Trades Records from the Exchange","bot":{"type":"Sensor","name":"Charly","processes":[{"type":"Process","name":"Live Trades","code":{"team":"AAMasters","bot":"AACharly","process":"Live-Trades"},"id":"5846ebc7-1979-4a80-9cc7-94bb4b8659dc"},{"type":"Process","name":"Hole Fixing","code":{"team":"AAMasters","bot":"AACharly","process":"Hole-Fixing"},"id":"31fc4f05-75d4-419a-9fb0-73e25e856f15"}]},"id":"5bfef4dc-54c1-44db-ace6-1ab27a86746e"}'
// olivia argument = '{"type":"Task","name":"Generates 1 min to 24 hs Candles & Volumes","bot":{"type":"Indicator","name":"Olivia","processes":[{"type":"Process","name":"Daily","code":{"team":"AAMasters","bot":"AAOlivia","process":"Multi-Period-Daily"},"id":"68cc8e1b-e94a-477e-82d0-15ecc9f1b9e2"},{"type":"Process","name":"Market","code":{"team":"AAMasters","bot":"AAOlivia","process":"Multi-Period-Market"},"id":"e1ac5e3d-d491-4e90-baf4-d4e5b71a8b1a"}]},"id":"efe36e05-75ea-41b5-8d92-c6b27635c834"}'
// bruce argument = ' {"type":"Task","name":"Converts Trades into 1 min Candles & Volumes","bot":{"type":"Indicator","name":"Bruce","processes":[{"type":"Process","name":"New Process","code":{"team":"AAMasters","bot":"AABruce","process":"Single-Period-Daily"},"id":"e184744f-5de0-41c1-ad4c-36960f4ced90"}]},"id":"42758590-a7bd-4712-a5c9-80a3a820c5b3"}'