time constants implemented as global file
This commit is contained in:
1 parent
658dc4714a
commit
09f043fb51
13 files changed
+44
-33
No files matched your search
@@ -113,7 +113,7 @@ exports.newTradingEpisode = function newTradingEpisode(bot, logger, tradingEngin
|
||||
tradingEngine.current.episode.episodeStatistics.days.value =
|
||||
tradingEngine.current.episode.episodeCounters.periods.value *
|
||||
sessionParameters.timeFrame.config.value /
|
||||
global.ONE_DAY_IN_MILISECONDS
|
||||
TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
|
||||
function cycleBasedStatistics() {
|
||||
|
||||
@@ -1036,7 +1036,7 @@ exports.newTradingOrders = function newTradingOrders(bot, logger, tradingEngineM
|
||||
}
|
||||
|
||||
function updateStatistics(tradingEngineOrder) {
|
||||
tradingEngineOrder.orderStatistics.days.value = tradingEngineOrder.orderCounters.periods.value * sessionParameters.timeFrame.config.value / global.ONE_DAY_IN_MILISECONDS
|
||||
tradingEngineOrder.orderStatistics.days.value = tradingEngineOrder.orderCounters.periods.value * sessionParameters.timeFrame.config.value / TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
tradingEngineOrder.orderStatistics.days.value = global.PRECISE(tradingEngineOrder.orderStatistics.days.value, 10)
|
||||
}
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ exports.newTradingPosition = function newTradingPosition(bot, logger, tradingEng
|
||||
/* Days Calculation */
|
||||
tradingEngine.current.position.positionStatistics.days.value =
|
||||
tradingEngine.current.position.positionCounters.periods.value *
|
||||
sessionParameters.timeFrame.config.value / global.ONE_DAY_IN_MILISECONDS
|
||||
sessionParameters.timeFrame.config.value / TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
|
||||
tradingEngine.current.position.positionStatistics.days.value = global.PRECISE(tradingEngine.current.position.positionStatistics.days.value, 10)
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@
|
||||
async function writeDataRange(productCodeName) {
|
||||
let dataRange = {
|
||||
begin: contextVariables.dateBeginOfMarket.valueOf(),
|
||||
end: tradingProcessDate.valueOf() + global.ONE_DAY_IN_MILISECONDS
|
||||
end: tradingProcessDate.valueOf() + TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
|
||||
let fileContent = JSON.stringify(dataRange);
|
||||
|
||||
@@ -258,7 +258,7 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, tradin
|
||||
if (sessionParameters.heartbeats.config.date === true || sessionParameters.heartbeats.config.candleIndex === true) {
|
||||
/* We will produce a simulation level heartbeat in order to inform the user this is running. */
|
||||
|
||||
heartBeatDate = new Date(Math.trunc(tradingEngine.current.episode.candle.begin.value / global.ONE_DAY_IN_MILISECONDS) * global.ONE_DAY_IN_MILISECONDS)
|
||||
heartBeatDate = new Date(Math.trunc(tradingEngine.current.episode.candle.begin.value / TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
let fromDate = new Date(sessionParameters.timeRange.config.initialDatetime)
|
||||
let lastDate = new Date(sessionParameters.timeRange.config.finalDatetime)
|
||||
@@ -424,7 +424,7 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, tradin
|
||||
the day, we will advance current process day one day. By doing so, during the next execution, the
|
||||
simulation will receive the candles and indicators files of the next day.
|
||||
*/
|
||||
let candlesPerDay = global.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
|
||||
let candlesPerDay = TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
|
||||
if (
|
||||
bot.processingDailyFiles &&
|
||||
tradingEngine.current.episode.candle.index.value + 1 + 1 === candlesPerDay
|
||||
@@ -438,7 +438,7 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, tradin
|
||||
*/
|
||||
tradingEngine.current.episode.candle.index.value = 0
|
||||
tradingEngine.current.episode.processDate.value =
|
||||
tradingEngine.current.episode.processDate.value + global.ONE_DAY_IN_MILISECONDS
|
||||
tradingEngine.current.episode.processDate.value + TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user