Bug Fixed, working again
This commit is contained in:
1 parent
6521befc27
commit
124e71d40c
2 files changed
+33
-30
No files matched your search
+22
-21
@@ -20,8 +20,7 @@
|
||||
TS.projects.superalgos.globals.processModuleObjects.MODULE_OBJECTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_ENGINE_MODULE_OBJECT = TS.projects.superalgos.botModules.tradingEngine.newSuperalgosBotModulesTradingEngine(processIndex)
|
||||
let tradingOutputModuleObject = TS.projects.superalgos.botModules.tradingOutput.newSuperalgosBotModulesTradingOutput(processIndex)
|
||||
|
||||
let currentTimeFrame
|
||||
let currentTimeFrameLabel
|
||||
let currentTimeFrame = {}
|
||||
|
||||
/* Context Variables */
|
||||
let contextVariables = {
|
||||
@@ -73,7 +72,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
if (await TS.projects.superalgos.functionLibraries.dataDependenciesFunctions.processMarketFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule) === false) {
|
||||
if (await TS.projects.superalgos.functionLibraries.dataDependenciesFunctions.processMarketFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule, currentTimeFrame) === false) {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waiting for Data Mining to be run')
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
@@ -88,10 +87,10 @@
|
||||
Here we check if we need to get Daily Files or not. As an optimization, when
|
||||
we are running on a Time Frame of 1hs or above, we are not going to load
|
||||
dependencies on Daily Files. The way we recognize that is by checking if
|
||||
we alreaady set a value to currentTimeFrame. We are also not going to loop
|
||||
we alreaady set a value to currentTimeFrame.value. We are also not going to loop
|
||||
through days if we are processing market files.
|
||||
*/
|
||||
if (currentTimeFrame) {
|
||||
if (currentTimeFrame.value) {
|
||||
/* We are processing Market Files */
|
||||
/*
|
||||
With all the indicators data files loaded, we will build the chart object
|
||||
@@ -102,6 +101,7 @@
|
||||
processIndex,
|
||||
dataDependenciesModule,
|
||||
multiTimeFrameDataFiles,
|
||||
currentTimeFrame,
|
||||
chart,
|
||||
market,
|
||||
exchange,
|
||||
@@ -136,7 +136,7 @@
|
||||
if (checkStopProcessing() === false) { break }
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waking up')
|
||||
if (await TS.projects.superalgos.functionLibraries.dataDependenciesFunctions.processDailyFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule, tradingProcessDate) === false) {
|
||||
if (await TS.projects.superalgos.functionLibraries.dataDependenciesFunctions.processDailyFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule, currentTimeFrame, tradingProcessDate) === false) {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waiting for Data Mining to be run')
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
@@ -149,6 +149,7 @@
|
||||
processIndex,
|
||||
dataDependenciesModule,
|
||||
multiTimeFrameDataFiles,
|
||||
currentTimeFrame,
|
||||
chart,
|
||||
market,
|
||||
exchange,
|
||||
@@ -341,8 +342,8 @@
|
||||
chart,
|
||||
market,
|
||||
exchange,
|
||||
currentTimeFrame,
|
||||
currentTimeFrameLabel,
|
||||
currentTimeFrame.value,
|
||||
currentTimeFrame.label,
|
||||
tradingProcessDate
|
||||
)
|
||||
|
||||
@@ -357,13 +358,13 @@
|
||||
async function writeProcessFiles() {
|
||||
let outputDatasets = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
|
||||
|
||||
await writeTimeFramesFiles(currentTimeFrame, currentTimeFrameLabel)
|
||||
await writeTimeFramesFiles()
|
||||
await writeDataRanges()
|
||||
|
||||
if (currentTimeFrame > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) {
|
||||
await writeMarketStatusReport(currentTimeFrameLabel)
|
||||
if (currentTimeFrame.value > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) {
|
||||
await writeMarketStatusReport()
|
||||
} else {
|
||||
await writeDailyStatusReport(currentTimeFrameLabel)
|
||||
await writeDailyStatusReport()
|
||||
}
|
||||
|
||||
async function writeDataRanges() {
|
||||
@@ -404,7 +405,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function writeTimeFramesFiles(currentTimeFrame, currentTimeFrameLabel) {
|
||||
async function writeTimeFramesFiles() {
|
||||
|
||||
for (
|
||||
let outputDatasetIndex = 0;
|
||||
@@ -412,13 +413,13 @@
|
||||
outputDatasetIndex++
|
||||
) {
|
||||
let productCodeName = outputDatasets[outputDatasetIndex].referenceParent.parentNode.config.codeName
|
||||
await writeTimeFramesFile(currentTimeFrameLabel, productCodeName, 'Multi-Period-Daily')
|
||||
await writeTimeFramesFile(currentTimeFrameLabel, productCodeName, 'Multi-Period-Market')
|
||||
await writeTimeFramesFile(productCodeName, 'Multi-Period-Daily')
|
||||
await writeTimeFramesFile(productCodeName, 'Multi-Period-Market')
|
||||
|
||||
async function writeTimeFramesFile(currentTimeFrameLabel, productCodeName, processType) {
|
||||
async function writeTimeFramesFile(productCodeName, processType) {
|
||||
|
||||
let timeFramesArray = []
|
||||
timeFramesArray.push(currentTimeFrameLabel)
|
||||
timeFramesArray.push(currentTimeFrame.label)
|
||||
|
||||
let fileContent = JSON.stringify(timeFramesArray)
|
||||
let fileName = '/Time.Frames.json'
|
||||
@@ -433,23 +434,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function writeDailyStatusReport(currentTimeFrameLabel) {
|
||||
async function writeDailyStatusReport() {
|
||||
let reportKey = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.parentNode.config.codeName + "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.config.codeName + "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.config.codeName
|
||||
let thisReport = statusDependencies.statusReports.get(reportKey)
|
||||
|
||||
thisReport.file.lastFile = tradingProcessDate
|
||||
thisReport.file.simulationState = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE
|
||||
thisReport.file.timeFrames = currentTimeFrameLabel
|
||||
thisReport.file.timeFrames = currentTimeFrame.label
|
||||
await thisReport.asyncSave()
|
||||
}
|
||||
|
||||
async function writeMarketStatusReport(currentTimeFrameLabel) {
|
||||
async function writeMarketStatusReport() {
|
||||
let reportKey = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.parentNode.config.codeName + "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.config.codeName + "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.config.codeName
|
||||
let thisReport = statusDependencies.statusReports.get(reportKey)
|
||||
|
||||
thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME
|
||||
thisReport.file.simulationState = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE
|
||||
thisReport.file.timeFrames = currentTimeFrameLabel
|
||||
thisReport.file.timeFrames = currentTimeFrame.label
|
||||
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.newInternalLoop(tradingProcessDate)
|
||||
await thisReport.asyncSave()
|
||||
|
||||
@@ -5,6 +5,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
data structures that will allow users to write conditions and formulas
|
||||
using these data structures.
|
||||
*/
|
||||
const MODULE_NAME = "Data Dependency Function"
|
||||
|
||||
let thisObject = {
|
||||
processSingleFiles: processSingleFiles,
|
||||
@@ -84,7 +85,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
}
|
||||
}
|
||||
|
||||
async function processMarketFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule) {
|
||||
async function processMarketFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule, currentTimeFrame) {
|
||||
/*
|
||||
We do market files first since if the simulation is run on daily files, there will
|
||||
be a loop to get each of those files and we do not need that loop to reload market files.
|
||||
@@ -111,8 +112,8 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
|
||||
/* Current Time Frame detection */
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeFrame.config.label === timeFrameLabel) {
|
||||
currentTimeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]
|
||||
currentTimeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]
|
||||
currentTimeFrame.value = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]
|
||||
currentTimeFrame.label = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]
|
||||
}
|
||||
|
||||
/* Loop across the list of curated dependencies */
|
||||
@@ -210,7 +211,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
return true
|
||||
}
|
||||
|
||||
async function processDailyFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule, tradingProcessDate) {
|
||||
async function processDailyFiles(processIndex, dataFiles, multiTimeFrameDataFiles, dataDependenciesModule, currentTimeFrame, tradingProcessDate) {
|
||||
/* Telling the world we are alive and doing well and which date we are processing right now. */
|
||||
let processingDateString = tradingProcessDate.getUTCFullYear() + '-' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCMonth() + 1, 2) + '-' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCDate(), 2)
|
||||
TS.projects.superalgos.functionLibraries.processFunctions.processHeartBeat(processIndex, processingDateString, undefined, "Running...")
|
||||
@@ -243,8 +244,8 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
}
|
||||
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters.timeFrame.config.label === timeFrameLabel) {
|
||||
currentTimeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0]
|
||||
currentTimeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]
|
||||
currentTimeFrame.value = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0]
|
||||
currentTimeFrame.label = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]
|
||||
}
|
||||
|
||||
dataFiles = new Map()
|
||||
@@ -334,6 +335,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
processIndex,
|
||||
dataDependenciesModule,
|
||||
multiTimeFrameDataFiles,
|
||||
currentTimeFrame,
|
||||
chart,
|
||||
market,
|
||||
exchange,
|
||||
@@ -396,7 +398,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
let products = {}
|
||||
|
||||
if (dataFiles !== undefined && dataFiles.size > 0) {
|
||||
TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(processIndex, dataFiles, dataDependencies, products, mainDependency, currentTimeFrame)
|
||||
TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(processIndex, dataFiles, dataDependencies, products, mainDependency, currentTimeFrame.value)
|
||||
|
||||
let propertyName = 'at' + timeFrameLabel.replace('-', '')
|
||||
addProducs(propertyName, products)
|
||||
@@ -410,7 +412,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
let products = {}
|
||||
|
||||
if (dataFiles !== undefined && dataFiles.size > 0) {
|
||||
TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(processIndex, dataFiles, dataDependencies, products, mainDependency, currentTimeFrame)
|
||||
TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(processIndex, dataFiles, dataDependencies, products, mainDependency, currentTimeFrame.value)
|
||||
|
||||
let propertyName = 'at' + timeFrameLabel.replace('-', '')
|
||||
addProducs(propertyName, products)
|
||||
@@ -423,7 +425,7 @@ exports.newSuperalgosFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
let products = {}
|
||||
|
||||
if (dataFiles !== undefined && dataFiles.size > 0) {
|
||||
TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(processIndex, dataFiles, dataDependencies, products, mainDependency, currentTimeFrame)
|
||||
TS.projects.superalgos.functionLibraries.singleMarketFunctions.inflateDatafiles(processIndex, dataFiles, dataDependencies, products, mainDependency, currentTimeFrame.value)
|
||||
|
||||
let propertyName = 'atAnyTimeFrame'
|
||||
addProducs(propertyName, products)
|
||||
|
||||
Reference in new issue
Block a user