From c3a5a051e4e85f6bd279cffeb08490b6eddaeec7 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 12 Jun 2020 11:19:40 +0200 Subject: [PATCH] Simulation cycle complete --- LowFrequencyTrading/TradingProcess.js | 8 +++++--- LowFrequencyTrading/TradingSimulation.js | 7 +------ LowFrequencyTrading/TradingSystem.js | 6 +++--- Root.js | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/LowFrequencyTrading/TradingProcess.js b/LowFrequencyTrading/TradingProcess.js index 188b93060..712d9d35a 100644 --- a/LowFrequencyTrading/TradingProcess.js +++ b/LowFrequencyTrading/TradingProcess.js @@ -607,7 +607,6 @@ if (currentTimeFrame > global.dailyFilePeriods[0][0]) { writeMarketStatusReport(onMarketStatusReport) - } else { writeDataRanges(currentTimeFrameLabel, onWritten); } @@ -645,6 +644,9 @@ callBackFunction(global.DEFAULT_OK_RESPONSE); return; } + if (bot.SESSION.type === 'Backtesting Session') { + bot.STOP_SESSION = true + } callBackFunction(global.DEFAULT_OK_RESPONSE); } } @@ -709,7 +711,7 @@ } function writeDailyStatusReport(lastFileDate, callBack) { - let reportKey = bot.dataMine + "-" + bot.codeName + "-" + "Multi-Period" + "-" + "dataSet.V1"; + let reportKey = bot.dataMine + "-" + bot.codeName + "-" + bot.processNode.referenceParent.config.codeName + "-" + "dataSet.V1"; let thisReport = statusDependencies.statusReports.get(reportKey); thisReport.file.lastExecution = bot.currentDaytime; @@ -721,7 +723,7 @@ } function writeMarketStatusReport(callBack) { - let reportKey = bot.dataMine + "-" + bot.codeName + "-" + "Multi-Period" + "-" + "dataSet.V1"; + let reportKey = bot.dataMine + "-" + bot.codeName + "-" + bot.processNode.referenceParent.config.codeName + "-" + "dataSet.V1"; let thisReport = statusDependencies.statusReports.get(reportKey); thisReport.file.lastExecution = bot.processDatetime; diff --git a/LowFrequencyTrading/TradingSimulation.js b/LowFrequencyTrading/TradingSimulation.js index 39e8f5cb7..77a0d7e63 100644 --- a/LowFrequencyTrading/TradingSimulation.js +++ b/LowFrequencyTrading/TradingSimulation.js @@ -88,8 +88,6 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT initializeLoop() function initializeLoop() { - if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> initializeLoop -> Entering function.') } - if (bot.RESUME === true && tradingEngine.last.candle !== undefined) { /* Estimate the Initial Candle based on the last candle saved at tradingEngine */ let firstBegin = candles[0].begin @@ -266,8 +264,6 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT } function afterLoop() { - if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> afterLoop -> Entering function.') } - tradingEngineModule.finalize() tradingExecutionModule.finalize() tradingSystemModule.finalize() @@ -275,8 +271,7 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT snapshotsModule.finalize() announcementsModule.finalize() - - callback(tradingSystem, snapshots.headers, snapshots.triggerOn, snapshots.takePosition) + callback() } function heartBeat() { diff --git a/LowFrequencyTrading/TradingSystem.js b/LowFrequencyTrading/TradingSystem.js index 02732f1d9..558683b3b 100644 --- a/LowFrequencyTrading/TradingSystem.js +++ b/LowFrequencyTrading/TradingSystem.js @@ -44,9 +44,6 @@ exports.newTradingSystem = function newTradingSystem(bot, logger) { function finalize() { chart = undefined - tradingSystem = undefined - tradingEngine = undefined - conditions = undefined tradingSystem.highlights = undefined tradingSystem.conditionsErrors = undefined @@ -54,6 +51,9 @@ exports.newTradingSystem = function newTradingSystem(bot, logger) { formulas = undefined tradingSystem.formulasValues = undefined tradingSystem.formulasErrors = undefined + + tradingSystem = undefined + tradingEngine = undefined } function setChart(pChart) { diff --git a/Root.js b/Root.js index e31c5ab48..279601849 100644 --- a/Root.js +++ b/Root.js @@ -252,7 +252,7 @@ let processConfig = global.TASK_NODE.bot.processes[processIndex].referenceParent.config if (processConfig.framework !== undefined) { - if (processConfig.framework.name === "Multi-Period-Daily" || processConfig.framework.name === "Multi-Period-Market" || processConfig.framework.name === "Multi-Period") { + if (processConfig.framework.name === "Multi-Period-Daily" || processConfig.framework.name === "Multi-Period-Market" || processConfig.framework.name === "Low-Frequency-Trading-Process") { if (processConfig.framework.startDate !== undefined) { processConfig.framework.startDate.resumeExecution = true; if (processConfig.startMode.noTime !== undefined) {