From 9badedfbdb7313bbb3adca212b487ac109d81192 Mon Sep 17 00:00:00 2001 From: Ferrox85 <64791738+Ferrox85@users.noreply.github.com> Date: Wed, 22 Sep 2021 19:27:19 +0200 Subject: [PATCH] Update Snapshots.js Minor tweak for if on finalize there is no data / running trade (and a small typo) --- .../Trading-Bot/Low-Frequency-Trading/Snapshots.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/Snapshots.js b/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/Snapshots.js index 065b6833c..1af896627 100644 --- a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/Snapshots.js +++ b/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/Snapshots.js @@ -63,9 +63,10 @@ exports.newFoundationsBotModulesSnapshots = function(processIndex) { function finalize() { //trigger exits added for extra save moment for datapreserve - strategyExit() - positionExit() - + if (tradingEngine.tradingCurrent.strategy.begin.value > 0) { + strategyExit() + positionExit() + } writeSnapshotFiles() tradingEngine = undefined tradingSystem = undefined @@ -449,7 +450,7 @@ exports.newFoundationsBotModulesSnapshots = function(processIndex) { function onFileReceived(err, text) { if (err.result === TS.projects.foundations.globals.standardResponses.DEFAULT_OK_RESPONSE.result) { try { - // remove the last linebreak and seperator wich is introduced extra during save + // remove the last linebreak and seperator which is introduced extra during save text = text.replace(/\n$/, '') text = text.replace(/\r\n$/, '') writeOutput(text)