More cleaning
This commit is contained in:
1 parent
33ed646549
commit
0b11d14559
7 files changed
+18
-25
No files matched your search
@@ -115,11 +115,7 @@ exports.newDebugLog = function (processIndex) {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_FOLDER_NAME !== undefined) {
|
||||
filePath = filePath + TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_FOLDER_NAME + "/" + executionDatetime;
|
||||
} else {
|
||||
if (thisObject.bot.LEARNING_SESSION !== undefined) {
|
||||
filePath = filePath + thisObject.bot.LEARNING_SESSION.folderName + "/" + executionDatetime;
|
||||
} else {
|
||||
filePath = filePath + executionDatetime;
|
||||
}
|
||||
filePath = filePath + executionDatetime;
|
||||
}
|
||||
|
||||
let fileName;
|
||||
|
||||
@@ -31,9 +31,9 @@ exports.newTradingOutput = function (processIndex, bot, logger, tradingEngineMod
|
||||
try {
|
||||
|
||||
if (timeFrame > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) {
|
||||
bot.processingDailyFiles = false
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES = false
|
||||
} else {
|
||||
bot.processingDailyFiles = true
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES = true
|
||||
}
|
||||
|
||||
/* Preparing everything for the Simulation */
|
||||
@@ -43,7 +43,7 @@ exports.newTradingOutput = function (processIndex, bot, logger, tradingEngineMod
|
||||
let outputDatasets = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasetsMap = new Map()
|
||||
|
||||
if (bot.processingDailyFiles === true) {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES === true) {
|
||||
/*
|
||||
For Daily Files, we are going to initialize the outputs at the first execution
|
||||
if we are not resuming, but also at every following execution except when
|
||||
@@ -83,7 +83,7 @@ exports.newTradingOutput = function (processIndex, bot, logger, tradingEngineMod
|
||||
return
|
||||
|
||||
async function initializeOutputs() {
|
||||
if (bot.processingDailyFiles) {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
|
||||
await initializeDailyFiles()
|
||||
} else {
|
||||
await initializeMarketFiles()
|
||||
@@ -118,7 +118,7 @@ exports.newTradingOutput = function (processIndex, bot, logger, tradingEngineMod
|
||||
files in order to later append more information after the execution is over. Here in this function we are going to
|
||||
read those output files and get them ready for appending content during the simulation.
|
||||
*/
|
||||
if (bot.processingDailyFiles) {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
|
||||
await readDailyFiles()
|
||||
} else {
|
||||
await readMarketFiles()
|
||||
@@ -175,7 +175,7 @@ exports.newTradingOutput = function (processIndex, bot, logger, tradingEngineMod
|
||||
/*
|
||||
The output of files which were appended with information during the simulation execution, now needs to be saved.
|
||||
*/
|
||||
if (bot.processingDailyFiles) {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
|
||||
await writeDailyFiles()
|
||||
} else {
|
||||
await writeMarketFiles()
|
||||
|
||||
@@ -45,11 +45,11 @@ exports.newTradingRecords = function (processIndex, bot, logger) {
|
||||
let product = dataset.parentNode
|
||||
let outputDatasetArray = outputDatasetsMap.get(product.config.codeName)
|
||||
|
||||
if (bot.processingDailyFiles === true && dataset.config.type === 'Daily Files') {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES === true && dataset.config.type === 'Daily Files') {
|
||||
persistRecords()
|
||||
}
|
||||
|
||||
if (bot.processingDailyFiles === false && dataset.config.type === 'Market Files') {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES === false && dataset.config.type === 'Market Files') {
|
||||
persistRecords()
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ exports.newTradingRecords = function (processIndex, bot, logger) {
|
||||
if (recordProperty.config.codeName === product.config.propertyNameThatDefinesObject) {
|
||||
let propertyValue = record[j]
|
||||
|
||||
if (bot.processingDailyFiles) {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
|
||||
if (product.config.doNotCutObjectInDays !== true) {
|
||||
/*
|
||||
By default we will cut objects in days.
|
||||
|
||||
@@ -317,7 +317,7 @@ exports.newTradingSimulation = function (processIndex, bot, logger, tradingEngin
|
||||
dataDependencies = TS.projects.superalgos.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
|
||||
|
||||
/* Finding the Current Element on Market Files */
|
||||
if (bot.processingDailyFiles) {
|
||||
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
|
||||
for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; j++) {
|
||||
let mapKey = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[j][1]
|
||||
let propertyName = 'at' + mapKey.replace('-', '')
|
||||
@@ -426,7 +426,7 @@ exports.newTradingSimulation = function (processIndex, bot, logger, tradingEngin
|
||||
*/
|
||||
let candlesPerDay = TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
|
||||
if (
|
||||
bot.processingDailyFiles &&
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES &&
|
||||
tradingEngine.current.episode.candle.index.value + 1 + 1 === candlesPerDay
|
||||
) {
|
||||
/*
|
||||
|
||||
@@ -106,10 +106,6 @@
|
||||
sessionPath = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_FOLDER_NAME + "/"
|
||||
}
|
||||
|
||||
if (bot.LEARNING_SESSION !== undefined && statusDependencyNode.bottype === "Learning Bot") {
|
||||
sessionPath = bot.LEARNING_SESSION.folderName + "/"
|
||||
}
|
||||
|
||||
/* Now we will see where do we need to fetch this status report from. */
|
||||
let network = TS.projects.superalgos.globals.taskConstants.NETWORK_NODE
|
||||
let processThisDependsOn = statusDependencyNode.referenceParent.parentNode
|
||||
@@ -274,7 +270,7 @@
|
||||
On the contraty, if we are running a Sensor bot or an Indicator bot, we might, if necesary, use a previous version of a Status Report since
|
||||
there will be no big impact, just some reprocessing.
|
||||
*/
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE !== undefined || bot.LEARNING_SESSION !== undefined) {
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE !== undefined) {
|
||||
canUserPrevious = false
|
||||
} else {
|
||||
canUserPrevious = true
|
||||
|
||||
@@ -373,25 +373,25 @@
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference === undefined) {
|
||||
let errorMessage = "Key Reference not defined. Please check that and try again."
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, bot.LEARNING_SESSION, errorMessage, parentLogger)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage, parentLogger)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent === undefined) {
|
||||
let errorMessage = "Key Reference not referencing an Exchange Account Key. Please check that and try again."
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, bot.LEARNING_SESSION, errorMessage, parentLogger)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage, parentLogger)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.codeName === undefined) {
|
||||
let errorMessage = "Key 'codeName' undefined. Paste there you key. Please check that and try again."
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, bot.LEARNING_SESSION, errorMessage, parentLogger)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage, parentLogger)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.secret === undefined) {
|
||||
let errorMessage = "Key 'secret' undefined. Paste there you key secret. Please check that and try again."
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, bot.LEARNING_SESSION, errorMessage, parentLogger)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE, errorMessage, parentLogger)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
Reference in new issue
Block a user