From 14c9e820ce7a2a3f2ff563d73a35805a46cbaa81 Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 8 Aug 2019 19:47:58 -0300 Subject: [PATCH 1/3] Adding trading bot parameters --- Run.js | 9 ++++++--- sequence.json | 14 ++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Run.js b/Run.js index 06de091d0..de46b976e 100644 --- a/Run.js +++ b/Run.js @@ -55,11 +55,14 @@ function sequenceExecution(currentStep) { execution.month ? process.env.MONTH = execution.month : undefined; execution.beginDatetime ? process.env.BEGIN_DATE_TIME = execution.beginDatetime : undefined; execution.dataSet ? process.env.DATA_SET = execution.dataSet : undefined; + execution.timePeriod ? process.env.TIME_PERIOD = execution.timePeriod : undefined; + execution.exchangeName ? global.EXCHANGE_NAME = execution.exchangeName : undefined; + execution.baseAsset ? global.BASE_ASSET = execution.baseAsset : undefined; + execution.balanceAssetA ? global.INITIAL_BALANCE_ASSET_A = execution.balanceAssetA : undefined; + execution.balanceAssetB ? global.INITIAL_BALANCE_ASSET_B = execution.balanceAssetB : undefined; + process.env.CLONE_ID = 1; - execution.timePeriod ? process.env.TIME_PERIOD = execution.timePeriod : undefined; - - execution.exchangeName ? global.EXCHANGE_NAME = execution.exchangeName : undefined; // global.FULL_LOG = execution.fullLog; let stepKey = execution.devTeam + '.' + execution.bot + '.' + execution.process; diff --git a/sequence.json b/sequence.json index 3e7206562..7baa8acf1 100644 --- a/sequence.json +++ b/sequence.json @@ -23,7 +23,6 @@ "endYear": 2021, "month": 1 }, - { "devTeam": "AAMasters", "bot": "AABruce", @@ -157,8 +156,8 @@ "month": 1 }, { - "devTeam": "vikingsalerts", - "bot": "simulator-bot-vikingsalerts", + "devTeam": "user", + "bot": "simulator-bot-user", "mode": "noTime", "resumeExecution": true, "type": "Indicator", @@ -168,8 +167,8 @@ "timePeriod": "05-min" }, { - "devTeam": "vikingsalerts", - "bot": "bot-vikingsalerts", + "devTeam": "user", + "bot": "bot-user", "mode": "live", "resumeExecution": true, "type": "Trading", @@ -177,6 +176,9 @@ "process": "Trading-Process", "beginDatetime": "2019-08-01T08:00:00.000Z", "timePeriod": "05-min", - "dataSet": "Multi-Period-Daily" + "dataSet": "Multi-Period-Daily", + "baseAsset": "assetB", + "balanceAssetA": 0, + "balanceAssetB": 0.001 } ] From c29d2ce460a4ac055aa9206056a7162fe4c5ff02 Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 9 Aug 2019 09:38:48 -0300 Subject: [PATCH 2/3] Fixing env variables --- Run.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Run.js b/Run.js index de46b976e..ad7c63333 100644 --- a/Run.js +++ b/Run.js @@ -56,13 +56,13 @@ function sequenceExecution(currentStep) { execution.beginDatetime ? process.env.BEGIN_DATE_TIME = execution.beginDatetime : undefined; execution.dataSet ? process.env.DATA_SET = execution.dataSet : undefined; execution.timePeriod ? process.env.TIME_PERIOD = execution.timePeriod : undefined; - execution.exchangeName ? global.EXCHANGE_NAME = execution.exchangeName : undefined; - execution.baseAsset ? global.BASE_ASSET = execution.baseAsset : undefined; - execution.balanceAssetA ? global.INITIAL_BALANCE_ASSET_A = execution.balanceAssetA : undefined; - execution.balanceAssetB ? global.INITIAL_BALANCE_ASSET_B = execution.balanceAssetB : undefined; + execution.baseAsset ? process.env.BASE_ASSET = execution.baseAsset : undefined; + execution.balanceAssetA ? process.env.INITIAL_BALANCE_ASSET_A = execution.balanceAssetA : undefined; + execution.balanceAssetB ? process.env.INITIAL_BALANCE_ASSET_B = execution.balanceAssetB : undefined; process.env.CLONE_ID = 1; + execution.exchangeName ? global.EXCHANGE_NAME = execution.exchangeName : undefined; // global.FULL_LOG = execution.fullLog; let stepKey = execution.devTeam + '.' + execution.bot + '.' + execution.process; From 98114e318aaf288678505cab9f36ad419ce2f674 Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 9 Aug 2019 09:49:00 -0300 Subject: [PATCH 3/3] Dynamic sequence reading --- Run.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Run.js b/Run.js index ad7c63333..f77ea6b03 100644 --- a/Run.js +++ b/Run.js @@ -1,5 +1,4 @@ require('dotenv').config(); -const sequenceList = require('./sequence'); global.SHALL_BOT_STOP = false; global.AT_BREAKPOINT = false; // This is used only when running at the browser. @@ -26,10 +25,9 @@ process.on('exit', function (code) { console.log('[INFO] Run -> process.on.exit -> About to exit -> code = ' + code); }); - +let sequenceList = require('./sequence'); let isRunSequence = false; let sequenceStep = 0; -let loopCount = 0; let processedSteps = new Map() if (process.env.RUN_SEQUENCE !== undefined) { isRunSequence = JSON.parse(process.env.RUN_SEQUENCE) @@ -59,11 +57,9 @@ function sequenceExecution(currentStep) { execution.baseAsset ? process.env.BASE_ASSET = execution.baseAsset : undefined; execution.balanceAssetA ? process.env.INITIAL_BALANCE_ASSET_A = execution.balanceAssetA : undefined; execution.balanceAssetB ? process.env.INITIAL_BALANCE_ASSET_B = execution.balanceAssetB : undefined; - - process.env.CLONE_ID = 1; + execution.type === 'Trading' ? process.env.CLONE_ID = 1 : undefined; execution.exchangeName ? global.EXCHANGE_NAME = execution.exchangeName : undefined; - // global.FULL_LOG = execution.fullLog; let stepKey = execution.devTeam + '.' + execution.bot + '.' + execution.process; if (processedSteps.has(stepKey)) { @@ -71,7 +67,7 @@ function sequenceExecution(currentStep) { } else { processedSteps.set(stepKey, 0); } - console.log("EXECUTION: "+JSON.stringify(execution)) + console.log("Sequence Execution Parameters: " + JSON.stringify(execution)) readExecutionConfiguration(); sequenceStep++; } @@ -86,7 +82,7 @@ function onExecutionFinish(result, finishStepKey) { } else { setTimeout(function () { console.log("[INFO] onExecutionFinish -> New round for sequence execution started."); - loopCount++; + sequenceList = require('./sequence'); // We read again the sequence after every loop sequenceStep = 0; processedSteps = new Map(); sequenceExecution(sequenceStep);