diff --git a/TaskServer/LowFrequencyTrading/TradingProcess.js b/TaskServer/LowFrequencyTrading/TradingProcess.js index aee4a0f74..7e66fe1e9 100644 --- a/TaskServer/LowFrequencyTrading/TradingProcess.js +++ b/TaskServer/LowFrequencyTrading/TradingProcess.js @@ -797,7 +797,7 @@ let dataRecord = dataFile[i] let begin = dataRecord[beginIndex] let end = dataRecord[endIndex] - if (end < bot.SESSION.parameters.timeRange.config.initialDatetime) { continue } + if (end < bot.SESSION.parameters.timeRange.config.initialDatetime - 1) { continue } // /1 because we need the previous closed element if (begin > bot.SESSION.parameters.timeRange.config.finalDatetime) { continue } result.push(dataRecord) } diff --git a/TaskServer/LowFrequencyTrading/TradingSimulation.js b/TaskServer/LowFrequencyTrading/TradingSimulation.js index 58470f756..4e8f655b2 100644 --- a/TaskServer/LowFrequencyTrading/TradingSimulation.js +++ b/TaskServer/LowFrequencyTrading/TradingSimulation.js @@ -240,8 +240,12 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT if (dataDependencyNode.referenceParent.config.codeName !== 'Multi-Period-Daily') { continue } let singularVariableName = dataDependencyNode.referenceParent.parentNode.config.singularVariableName let pluralVariableName = dataDependencyNode.referenceParent.parentNode.config.pluralVariableName - let currentElement = getElement(thisChart[pluralVariableName], 'Daily' + '-' + mapKey + '-' + pluralVariableName) - thisChart[singularVariableName] = currentElement + if (thisChart[pluralVariableName] !== undefined) { + let currentElement = getElement(thisChart[pluralVariableName], 'Daily' + '-' + mapKey + '-' + pluralVariableName) + if (currentElement !== undefined) { + thisChart[singularVariableName] = currentElement + } + } } } } @@ -257,8 +261,12 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT if (dataDependencyNode.referenceParent.config.codeName !== 'Multi-Period-Market') { continue } let singularVariableName = dataDependencyNode.referenceParent.parentNode.config.singularVariableName let pluralVariableName = dataDependencyNode.referenceParent.parentNode.config.pluralVariableName - let currentElement = getElement(thisChart[pluralVariableName], 'Market' + '-' + mapKey + '-' + pluralVariableName) - thisChart[singularVariableName] = currentElement + if (thisChart[pluralVariableName] !== undefined) { + let currentElement = getElement(thisChart[pluralVariableName], 'Market' + '-' + mapKey + '-' + pluralVariableName) + if (currentElement !== undefined) { + thisChart[singularVariableName] = currentElement + } + } } }