From f99a1d2f5da6a5d4fd1457b7d60f8d0e7fdfca52 Mon Sep 17 00:00:00 2001 From: Brett Taylor Date: Tue, 16 Nov 2021 16:49:33 -0500 Subject: [PATCH 1/3] set brokerid for okex --- .../Low-Frequency-Trading/APIs/ExchangeAPI.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 5f7a3f76b..0150765ec 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 @@ -29,6 +29,7 @@ let secret let uid let password + let brokerId let sandBox = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.sandbox || false; if (TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference !== undefined) { @@ -37,8 +38,21 @@ secret = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.secret uid = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.uid password = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.password + brokerId = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.brokerId } } + + switch (exchangeId) { + case 'okex': + case 'okex3': + case 'okex5': + if (brokerId === undefined) { + brokerId = 'c77ccd60ec7b4cBC' + } + break; + } + options.brokerId = brokerId + const exchangeClass = ccxt[exchangeId] const exchangeConstructorParams = { 'apiKey': key, From 6260efcff61f4a2e27f03af278cf8c55cf56568e Mon Sep 17 00:00:00 2001 From: Brett Taylor Date: Tue, 16 Nov 2021 22:51:23 -0500 Subject: [PATCH 2/3] genericize the options hash more --- .../Trading-Bot/Low-Frequency-Trading/APIs/ExchangeAPI.js | 8 +++----- 1 file changed, 3 insertions(+), 5 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 0150765ec..1bba3d582 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 @@ -29,7 +29,6 @@ let secret let uid let password - let brokerId let sandBox = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.sandbox || false; if (TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference !== undefined) { @@ -38,7 +37,7 @@ secret = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.secret uid = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.uid password = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.password - brokerId = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.brokerId + options = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.options } } @@ -46,12 +45,11 @@ case 'okex': case 'okex3': case 'okex5': - if (brokerId === undefined) { - brokerId = 'c77ccd60ec7b4cBC' + if (options.brokerId === undefined) { + options.brokerId = 'c77ccd60ec7b4cBC' } break; } - options.brokerId = brokerId const exchangeClass = ccxt[exchangeId] const exchangeConstructorParams = { From ed59406d6a7e4a8bfe05d1d56c3ac1aec2d14993 Mon Sep 17 00:00:00 2001 From: Brett Taylor Date: Wed, 17 Nov 2021 09:54:25 -0500 Subject: [PATCH 3/3] move the options hash to the Exchange node configuration --- .../Trading-Bot/Low-Frequency-Trading/APIs/ExchangeAPI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1bba3d582..0d6638582 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 @@ -24,6 +24,7 @@ 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 key let secret @@ -37,7 +38,6 @@ secret = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.secret uid = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.uid password = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.password - options = TS.projects.foundations.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.options } }