From 67ad17177c3f515c6b95153707f2a38702f46987 Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 27 Mar 2019 10:37:27 +0100 Subject: [PATCH] Changing default daily files data dependency config --- AABrowserAPI/CopySimulator.js | 32 +++++++++----------------------- AABrowserAPI/TeamSetup.js | 13 +++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/AABrowserAPI/CopySimulator.js b/AABrowserAPI/CopySimulator.js index 29097c067..1d45d1307 100644 --- a/AABrowserAPI/CopySimulator.js +++ b/AABrowserAPI/CopySimulator.js @@ -1,13 +1,4 @@ - -// let financialBeingsCopy = newFinancialBeingClone() - -// const simulatorTemplatePath = "aaplatform/AATemplate/bots/AAJason-Indicator-Bot1"; -// const blobName = "this.bot.config.json"; - -// financialBeingsCopy.copySimulator("team-a", "team a", "matias", "bot-a", "bot a") -// async function copySimulator(pTeamCodeName, pTeamDisplayName, pUserName, pBotCodeName, pBotDisplayName, pUserId) { - -const { +const { Aborter, BlobURL, BlockBlobURL, @@ -77,8 +68,8 @@ exports.newCopySimulator = function newCopySimulator() { if (parsedConfig.processes[0].statusDependencies[i].devTeam === "AAMasters" && parsedConfig.processes[0].statusDependencies[i].bot === "AAJason") { - parsedConfig.processes[0].statusDependencies[i].devTeam = parsedConfig.devTeam; - parsedConfig.processes[0].statusDependencies[i].bot = parsedConfig.codeName; + parsedConfig.processes[0].statusDependencies[i].devTeam = parsedConfig.devTeam; + parsedConfig.processes[0].statusDependencies[i].bot = parsedConfig.codeName; } } @@ -87,8 +78,8 @@ exports.newCopySimulator = function newCopySimulator() { if (parsedConfig.processes[1].statusDependencies[i].devTeam === "AAMasters" && parsedConfig.processes[1].statusDependencies[i].bot === "AAJason") { - parsedConfig.processes[1].statusDependencies[i].devTeam = parsedConfig.devTeam; - parsedConfig.processes[1].statusDependencies[i].bot = parsedConfig.codeName; + parsedConfig.processes[1].statusDependencies[i].devTeam = parsedConfig.devTeam; + parsedConfig.processes[1].statusDependencies[i].bot = parsedConfig.codeName; } } @@ -104,8 +95,8 @@ exports.newCopySimulator = function newCopySimulator() { parsedConfig.products[1].dataSets[1].dataRange.filePath = pTeamCodeName + "/" + parsedConfig.codeName + ".1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Conditions/Multi-Period-Daily" // Write the new files - let newSimulatorName = "simulator-"+ pBotCodeName + "-Indicator-Bot" - let newSimulatorPath = "aaplatform/"+ pTeamCodeName + "/bots/" + newSimulatorName + let newSimulatorName = "simulator-" + pBotCodeName + "-Indicator-Bot" + let newSimulatorPath = "aaplatform/" + pTeamCodeName + "/bots/" + newSimulatorName await writeFileContent(newSimulatorPath, "Commons.js", commons) await writeFileContent(newSimulatorPath, "this.bot.config.json", beautify(parsedConfig, null, 2, 80)) await writeFileContent(newSimulatorPath + "/Multi-Period-Daily", "User.Bot.js", codeDaily) @@ -125,7 +116,7 @@ exports.newCopySimulator = function newCopySimulator() { // Delete simulator code let newSimulatorName = "simulator-" + pBotCodeName + "-Indicator-Bot" - let newSimulatorPath = "aaplatform/"+ pTeamCodeName + "/bots/" + newSimulatorName + let newSimulatorPath = "aaplatform/" + pTeamCodeName + "/bots/" + newSimulatorName await deleteBlob(newSimulatorPath, "Commons.js") await deleteBlob(newSimulatorPath, "this.bot.config.json") await deleteBlob(newSimulatorPath + "/Multi-Period-Daily", "User.Bot.js") @@ -158,7 +149,7 @@ exports.newCopySimulator = function newCopySimulator() { } async function deleteBlob(containerName, blobName) { - try{ + try { const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName) const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, blobName) await blockBlobURL.delete(Aborter.none) @@ -167,11 +158,6 @@ exports.newCopySimulator = function newCopySimulator() { } } - async function deleteContainer(containerName) { - const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName) - let containerRemoveResponse = await containerURL.delete(Aborter.none) - } - // A helper method used to read a Node.js readable stream into string async function streamToString(readableStream) { return new Promise((resolve, reject) => { diff --git a/AABrowserAPI/TeamSetup.js b/AABrowserAPI/TeamSetup.js index c13b035b3..b0e57c176 100644 --- a/AABrowserAPI/TeamSetup.js +++ b/AABrowserAPI/TeamSetup.js @@ -214,6 +214,7 @@ } } + // Market Files for (let i = 0; i < botConfig.processes[0].dataDependencies.length; i++) { // Add a copy of the simulator indicator in the configuration @@ -225,6 +226,18 @@ } } + // Daily Files + for (let i = 0; i < botConfig.processes[1].dataDependencies.length; i++) { + + // Add a copy of the simulator indicator in the configuration + if ( botConfig.processes[1].dataDependencies[i].devTeam === "AAMasters" && + botConfig.processes[1].dataDependencies[i].bot === "AAJason" ) { + + botConfig.processes[1].dataDependencies[i].devTeam = pTeamCodeName; + botConfig.processes[1].dataDependencies[i].bot = "simulator-" + pBotCodeName; + } + } + botConfig.displayName = pBotDisplayName; botConfig.codeName = pBotCodeName; botConfig.devTeam = pTeamCodeName;