From 6fd383265e6fafc9f21c97f9ee83ce20d93034d4 Mon Sep 17 00:00:00 2001 From: Brett Taylor Date: Thu, 18 Nov 2021 09:27:12 -0500 Subject: [PATCH] update config options object parsing --- .../Low-Frequency-Trading/APIs/ExchangeAPI.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/APIs/ExchangeAPI.js b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/APIs/ExchangeAPI.js index 0d6638582..baf7fb074 100644 --- a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/APIs/ExchangeAPI.js +++ b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/APIs/ExchangeAPI.js @@ -22,15 +22,18 @@ function initialize() { tradingSystem = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingSystem - - exchangeId = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.codeName - options = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.options - + + let exchangeConfig = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config + exchangeId = exchangeConfig.codeName + if (exchangeConfig.options !== undefined) { + options = exchangeConfig.options + } + let key let secret let uid let password - let sandBox = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.sandbox || false; + let sandBox = exchangeConfig.sandbox || false; if (TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference !== undefined) { if (TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent !== undefined) { @@ -45,7 +48,7 @@ case 'okex': case 'okex3': case 'okex5': - if (options.brokerId === undefined) { + if (!('brokerId' in options)) { options.brokerId = 'c77ccd60ec7b4cBC' } break;