From ccbc1665f456a390e355aca29579008bbb783237 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 9 Aug 2019 17:39:37 +0200 Subject: [PATCH] Trading Engine in sequence --- Context.js | 2 +- Root.js | 1 + Run.js | 3 +- TradingEngineProcessMainLoop.js | 2 + sequence - all processes.json | 22 +++--- sequence.json | 132 ++------------------------------ 6 files changed, 22 insertions(+), 140 deletions(-) diff --git a/Context.js b/Context.js index 5bee4f029..19742d5db 100644 --- a/Context.js +++ b/Context.js @@ -170,7 +170,7 @@ function onFileReceived(err, text) { if (err.result !== global.DEFAULT_OK_RESPONSE.result) { - logger.write(MODULE_NAME, "[ERROR] initialize -> getExecutionHistory -> onFileReceived -> err = "+ err); + logger.write(MODULE_NAME, "[ERROR] initialize -> getExecutionHistory -> onFileReceived -> err = "+ JSON.stringify(err)); callBack(err); return; } diff --git a/Root.js b/Root.js index 84e3d4c8a..657b41f65 100644 --- a/Root.js +++ b/Root.js @@ -857,6 +857,7 @@ console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Bot execution finished with errors. Please check the logs."); logger.persist(); } + callback(err, pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process) } } else { diff --git a/Run.js b/Run.js index 5c97d04c6..9f8207c7d 100644 --- a/Run.js +++ b/Run.js @@ -1,6 +1,5 @@ require('dotenv').config() const strategy = require('./Integrations/Strategy') -const sequenceList = require('./sequence'); global.SHALL_BOT_STOP = false global.AT_BREAKPOINT = false // This is used only when running at the browser. @@ -156,7 +155,7 @@ async function readExecutionConfiguration() { backtest: backtest, competition: competition } - } else if (process.env.TYPE === 'Indicator' || process.env.TYPE === 'Sensor') { + } else if (process.env.TYPE === 'Indicator' || process.env.TYPE === 'Sensor' || process.env.TYPE === 'Trading-Engine') { let allMonths = { run: "false", minYear: process.env.MIN_YEAR, diff --git a/TradingEngineProcessMainLoop.js b/TradingEngineProcessMainLoop.js index 6c70bf3af..de6e93245 100644 --- a/TradingEngineProcessMainLoop.js +++ b/TradingEngineProcessMainLoop.js @@ -36,6 +36,8 @@ try { if (FULL_LOG === true) { parentLogger.write(MODULE_NAME, "[INFO] initialize -> Entering function."); } + bot.startMode = 'Live' // The Trading Engine does not support different start modes. Only live for background compatibility. + UI_COMMANDS = pUI_COMMANDS; processConfig = pProcessConfig; diff --git a/sequence - all processes.json b/sequence - all processes.json index 18933d9c7..e98ae87fd 100644 --- a/sequence - all processes.json +++ b/sequence - all processes.json @@ -131,6 +131,17 @@ "endYear": 2021, "month": 1 }, + { + "devTeam": "user", + "bot": "simulator-user", + "mode": "noTime", + "resumeExecution": true, + "type": "Trading-Engine", + "exchangeName": "Poloniex", + "process": "Multi-Period-Daily", + "beginDatetime": "2019-08-01T08:00:00.000Z", + "timePeriod": "05-min" + }, { "devTeam": "AAVikings", "bot": "AAGauss", @@ -177,16 +188,5 @@ "beginDatetime": "2019-08-01T08:00:00.000Z", "timePeriod": "05-min", "dataSet": "Multi-Period-Daily" - }, - { - "devTeam": "user", - "bot": "simulator-bot-user", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "beginDatetime": "2019-08-01T08:00:00.000Z", - "timePeriod": "05-min" } ] diff --git a/sequence.json b/sequence.json index d86893a32..3ee401586 100644 --- a/sequence.json +++ b/sequence.json @@ -1,134 +1,14 @@ [ + { - "devTeam": "AAMasters", - "bot": "AACharly", + "devTeam": "user", + "bot": "simulator-user", "mode": "noTime", "resumeExecution": true, - "type": "Sensor", - "exchangeName": "Poloniex", - "process": "Live-Trades", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AACharly", - "mode": "noTime", - "resumeExecution": true, - "type": "Sensor", - "exchangeName": "Poloniex", - "process": "Hole-Fixing", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AABruce", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Single-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAOlivia", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", + "type": "Trading-Engine", "exchangeName": "Poloniex", "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAOlivia", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AATom", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AATom", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAChris", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAChris", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAPaula", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAPaula", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 + "beginDatetime": "2019-08-01T08:00:00.000Z", + "timePeriod": "05-min" } ]