fixes
This commit is contained in:
1 parent
59ab3e06c5
commit
aabf49dccb
2 files changed
+9
-8
No files matched your search
@@ -138,6 +138,8 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> loop -> Candle Begin @ ' + (new Date(candle.begin)).toLocaleString()) }
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> loop -> Candle End @ ' + (new Date(candle.end)).toLocaleString()) }
|
||||
|
||||
tradingEngineModule.setCurrentCandle(candle) // We move the current candle we are standing at, to the trading engine data structure to make it available to anyone, including conditions and formulas.
|
||||
|
||||
if (checkIfWeAreAtTheHeadOfTheMarket() === false) {
|
||||
afterLoop()
|
||||
return
|
||||
@@ -154,8 +156,6 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT
|
||||
}
|
||||
|
||||
heartBeat()
|
||||
|
||||
tradingEngineModule.setCurrentCandle(candle) // We move the current candle we are standing at, to the trading engine data structure to make it available to anyone, including conditions and formulas.
|
||||
positionChartAtCurrentCandle()
|
||||
|
||||
tradingEngineModule.updateEpisodeCountersAndStatistics()
|
||||
@@ -422,11 +422,11 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT
|
||||
|
||||
function checkInitialAndFinalDatetime() {
|
||||
/* Here we check that the current candle is not outside of user-defined time range at the session parameters.*/
|
||||
if (candle.end < sessionParameters.timeRange.config.initialDatetime.valueOf()) {
|
||||
if (tradingEngine.current.candle.end.value < sessionParameters.timeRange.config.initialDatetime.valueOf()) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> checkInitialAndFinalDatetime -> Skipping Candle before the sessionParameters.timeRange.config.initialDatetime.') }
|
||||
return false
|
||||
}
|
||||
if (candle.begin > sessionParameters.timeRange.config.finalDatetime.valueOf()) {
|
||||
if (tradingEngine.current.candle.begin.value > sessionParameters.timeRange.config.finalDatetime.valueOf()) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> checkInitialAndFinalDatetime -> Skipping Candle after the sessionParameters.timeRange.config.finalDatetime.') }
|
||||
return false
|
||||
}
|
||||
@@ -457,7 +457,7 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT
|
||||
maximumBalance = sessionParameters.sessionQuotedAsset.config.maximumBalance
|
||||
}
|
||||
|
||||
let stopRunningDate = new Date(candle.begin)
|
||||
let stopRunningDate = new Date(tradingEngine.current.candle.begin.value)
|
||||
if (balance <= minimumBalance) {
|
||||
tradingSystem.error = 'Min Balance @ ' + stopRunningDate.toLocaleString()
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> checkMinimunAndMaximunBalance -> ' + tradingSystem.error) }
|
||||
|
||||
+4
-3
@@ -213,6 +213,7 @@
|
||||
bot.sessionError(bot.SESSION.parameters.timeFrame, errorMessage)
|
||||
return false
|
||||
}
|
||||
bot.SESSION.parameters.timeFrame.config.value = getTimeFrameFromLabel(bot.SESSION.parameters.timeFrame.config.label)
|
||||
|
||||
/* Session Base Asset */
|
||||
if (bot.SESSION.parameters.sessionBaseAsset === undefined) {
|
||||
@@ -314,7 +315,7 @@
|
||||
bot.resumeExecution = false;
|
||||
bot.tradingProcessDate = new Date(bot.SESSION.parameters.timeRange.config.initialDatetime.valueOf())
|
||||
bot.hasTheBotJustStarted = true
|
||||
pProcessConfig.liveWaitTime = getTimeFrameFromLabel(bot.SESSION.parameters.timeFrame.config.label)
|
||||
pProcessConfig.liveWaitTime = sessionParameters.timeFrame.config.value
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -347,7 +348,7 @@
|
||||
bot.SESSION.parameters.sessionBaseAsset.config.maximumBalance = bot.SESSION.parameters.sessionBaseAsset.config.maximumBalance * balancePercentage / 100
|
||||
bot.SESSION.parameters.sessionQuotedAsset.config.maximumBalance = bot.SESSION.parameters.sessionQuotedAsset.config.maximumBalance * balancePercentage / 100
|
||||
|
||||
pProcessConfig.normalWaitTime = getTimeFrameFromLabel(bot.SESSION.parameters.timeFrame.config.label)
|
||||
pProcessConfig.normalWaitTime = sessionParameters.timeFrame.config.value
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -357,7 +358,7 @@
|
||||
bot.resumeExecution = false;
|
||||
bot.hasTheBotJustStarted = true
|
||||
bot.tradingProcessDate = new Date(bot.SESSION.parameters.timeRange.config.initialDatetime.valueOf())
|
||||
pProcessConfig.normalWaitTime = getTimeFrameFromLabel(bot.SESSION.parameters.timeFrame.label)
|
||||
pProcessConfig.normalWaitTime = sessionParameters.timeFrame.config.value
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user