diff --git a/Context.js b/Context.js index 6765c725a..3880cb649 100644 --- a/Context.js +++ b/Context.js @@ -71,6 +71,7 @@ let statusDependencies; let runIndex; // This is the index for this run and depends on the startMode. + let sessionPath = '' return thisObject; @@ -82,11 +83,13 @@ statusDependencies = pStatusDependencies; - /* + if (bot.SESSION !== undefined) { + sessionPath = bot.SESSION.id + "/" + } + /* Here we get the positions the bot did and that are recorded at the bot storage account. We will use them through out the rest of the process. - */ thisObject.newHistoryRecord.date = bot.processDatetime; @@ -163,7 +166,7 @@ if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> getExecutionHistory -> Entering function."); } let fileName = "Execution.History." + bot.startMode + "." + runIndex + ".json"; - let filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName; + let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + fileName; fileStorage.getTextFile(bot.devTeam, filePath, onFileReceived); @@ -224,7 +227,7 @@ let fileName = "/Execution.Context." + bot.startMode + "." + runIndex + ".json"; let dateForPath = date.getUTCFullYear() + '/' + utilities.pad(date.getUTCMonth() + 1, 2) + '/' + utilities.pad(date.getUTCDate(), 2) + '/' + utilities.pad(date.getUTCHours(), 2) + '/' + utilities.pad(date.getUTCMinutes(), 2); - let filePath = bot.filePathRoot + "/Output/Trading-Process/" + dateForPath + fileName; + let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + dateForPath + fileName; fileStorage.getTextFile(bot.devTeam, filePath, onFileReceived); @@ -398,7 +401,7 @@ let fileName = "/Execution.Context." + bot.startMode + "." + runIndex +".json"; let dateForPath = bot.processDatetime.getUTCFullYear() + '/' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.processDatetime.getUTCDate(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCHours(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCMinutes(), 2); - let filePath = bot.filePathRoot + "/Output/Trading-Process/" + dateForPath + fileName; + let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + dateForPath + fileName; let fileContent = JSON.stringify(thisObject.executionContext); if(fileContent === undefined){ @@ -438,7 +441,7 @@ if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] saveThemAll -> writeExucutionHistory -> Entering function."); } let fileName = "Execution.History." + bot.startMode + "." + runIndex + ".json"; - let filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName; + let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + fileName; let newRecord = [ thisObject.newHistoryRecord.date.valueOf(), @@ -489,7 +492,7 @@ fileContent = runIndex; fileName = "Execution.History." + bot.startMode + "." + "Sequence" + ".json"; - filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName; + filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + fileName; fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onSequenceFileCreated); diff --git a/MultiPeriod.js b/MultiPeriod.js index 7a8ae9af0..2c31ec399 100644 --- a/MultiPeriod.js +++ b/MultiPeriod.js @@ -986,7 +986,7 @@ let fileContent = JSON.stringify(dataRange); let fileName = '/Data.Range.' + market.assetA + '_' + market.assetB + '.json'; - let filePath = bot.filePathRoot + "/Output/" + pProductFolder + "/" + 'Multi-Period-Daily' + fileName; + let filePath = bot.filePathRoot + "/Output/" + bot.SESSION.id + "/" + pProductFolder + "/" + 'Multi-Period-Daily' + fileName; fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); diff --git a/StatusReport.js b/StatusReport.js index 1b6eb7446..65a6916e2 100644 --- a/StatusReport.js +++ b/StatusReport.js @@ -35,6 +35,7 @@ let month; let year; let timePath = ''; + let sessionPath = '' return thisObject; @@ -49,10 +50,12 @@ month = pMonth; year = pYear; + if (bot.SESSION !== undefined && pOwner.type === "Trading Engine") { + sessionPath = bot.SESSION.id + "/" + } + if (owner.dataSetSection === "Month") { - logger.fileName = MODULE_NAME + "." + pOwner.bot + "." + pOwner.process + "." + year + "." + month; - timePath = "/" + year + "/" + month; } @@ -113,15 +116,10 @@ let botId = bot.devTeam + "-" + bot.codeName + "-" + bot.version.major + "-" + bot.version.minor + "-" + bot.process + "-" + bot.dataSetVersion; if (ownerId !== botId) { - let rootPath = owner.devTeam + "/" + owner.bot + "." + owner.botVersion.major + "." + owner.botVersion.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + owner.dataSetVersion; - - filePath = rootPath + "/Reports/" + owner.process + timePath; - + filePath = rootPath + "/Reports/" + sessionPath + owner.process + timePath; } else { - - filePath = bot.filePathRoot + "/Reports/" + owner.process + timePath; - + filePath = bot.filePathRoot + "/Reports/" + sessionPath + owner.process + timePath; } if (owner.type === 'Trading') { @@ -213,7 +211,7 @@ } let fileName = "Status.Report." + global.MARKET.assetA + '_' + global.MARKET.assetB + ".json"; - let filePath = bot.filePathRoot + "/Reports/" + owner.process + timePath; + let filePath = bot.filePathRoot + "/Reports/" + sessionPath + owner.process + timePath; if (bot.type === 'Trading' ) { fileName = bot.startMode + "." + fileName;