From eb03011f4869625244c7b1c1d4567de6dbe03c5e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 29 Jun 2018 15:50:49 +0200 Subject: [PATCH] Competition ignores config at browser --- TradingBotProcessMainLoop.js | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/TradingBotProcessMainLoop.js b/TradingBotProcessMainLoop.js index 7d7e98685..ee4c2998c 100644 --- a/TradingBotProcessMainLoop.js +++ b/TradingBotProcessMainLoop.js @@ -307,28 +307,31 @@ } - let beginDatetime = new Date(bot.competition.beginDatetime); + if (global.CURRENT_EXECUTION_AT === "Cloud") { - if (bot.processDatetime.valueOf() < beginDatetime.valueOf()) { + let beginDatetime = new Date(bot.competition.beginDatetime); - if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> Competition not started yet. Wainting for the competition to start."); } + if (bot.processDatetime.valueOf() < beginDatetime.valueOf()) { - nextWaitTime = 'Normal'; - loopControl(nextWaitTime); - return; - } + if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> Competition not started yet. Wainting for the competition to start."); } - let endDatetime = new Date(bot.competition.endDatetime); + nextWaitTime = 'Normal'; + loopControl(nextWaitTime); + return; + } - if (bot.processDatetime.valueOf() > endDatetime.valueOf()) { + let endDatetime = new Date(bot.competition.endDatetime); - if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> End of Competition Period reached. Exiting Bot Process Loop."); } + if (bot.processDatetime.valueOf() > endDatetime.valueOf()) { - logger.persist(); - clearInterval(intervalHandle); - clearTimeout(timeoutHandle); - callBackFunction(global.DEFAULT_OK_RESPONSE); - return; + if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> End of Competition Period reached. Exiting Bot Process Loop."); } + + logger.persist(); + clearInterval(intervalHandle); + clearTimeout(timeoutHandle); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return; + } } break; @@ -949,6 +952,10 @@ function checkLoopHealth(pLastLoop) { + if (global.CURRENT_EXECUTION_AT !== "Cloud") { + return; + } + if (bot.startMode === 'Backtest') { return;} if (bot.loopCounter <= pLastLoop + 1) { // This means that the next loop started but also stopped executing abruptally.