From 11ad478ee59e11c5daad430bc471eaf5493b792f Mon Sep 17 00:00:00 2001 From: Matias Date: Sat, 22 Jun 2019 19:29:34 -0300 Subject: [PATCH] File storage dependency --- Multi-Period-Daily/User.Bot.js | 17 +++++++---------- Multi-Period-Market/User.Bot.js | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Multi-Period-Daily/User.Bot.js b/Multi-Period-Daily/User.Bot.js index 1b03337f1..7f2baca56 100644 --- a/Multi-Period-Daily/User.Bot.js +++ b/Multi-Period-Daily/User.Bot.js @@ -1,4 +1,4 @@ -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES) { +exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileStorage) { const FULL_LOG = true; const LOG_FILE_CONTENT = false; @@ -19,9 +19,6 @@ let utilities = UTILITIES.newCloudUtilities(bot, logger); - const FILE_STORAGE = require('./Integrations/FileStorage.js'); - let botStorage = FILE_STORAGE.newFileStorage(); - let dataDependencies; return thisObject; @@ -113,7 +110,7 @@ function writeFiles(pTradingSystem) { tradingSystem = pTradingSystem - writeRecordsFile() + writeRecordsFile() } function writeRecordsFile() { @@ -168,7 +165,7 @@ record.maximunBalanceA + "," + record.initialBalanceB + "," + record.minimunBalanceB + "," + - record.maximunBalanceB + "]"; + record.maximunBalanceB + "]"; if (separator === "") { separator = ","; } @@ -185,7 +182,7 @@ let filePath = filePathRoot + "/Output/" + SIMULATED_RECORDS_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -273,7 +270,7 @@ let filePath = filePathRoot + "/Output/" + CONDITIONS_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -350,7 +347,7 @@ let filePath = filePathRoot + "/Output/" + STRATEGIES_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -430,7 +427,7 @@ let filePath = filePathRoot + "/Output/" + TRADES_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) { diff --git a/Multi-Period-Market/User.Bot.js b/Multi-Period-Market/User.Bot.js index 699cfc583..52658e30e 100644 --- a/Multi-Period-Market/User.Bot.js +++ b/Multi-Period-Market/User.Bot.js @@ -1,4 +1,4 @@ -exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES) { +exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileStorage) { const FULL_LOG = true; const LOG_FILE_CONTENT = false; @@ -17,9 +17,6 @@ start: start }; - const FILE_STORAGE = require('./Integrations/FileStorage.js'); - let botStorage = FILE_STORAGE.newFileStorage(); - let dataDependencies; return thisObject; @@ -164,8 +161,8 @@ record.maximunBalanceA + "," + record.initialBalanceB + "," + record.minimunBalanceB + "," + - record.maximunBalanceB + "]"; - + record.maximunBalanceB + "]"; + if (separator === "") { separator = ","; } fileRecordCounter++; @@ -180,7 +177,7 @@ let filePath = filePathRoot + "/Output/" + SIMULATED_RECORDS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + outputPeriodLabel; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -258,7 +255,7 @@ let filePath = filePathRoot + "/Output/" + CONDITIONS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + outputPeriodLabel; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -328,7 +325,7 @@ let filePath = filePathRoot + "/Output/" + STRATEGIES_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + outputPeriodLabel; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -401,7 +398,7 @@ let filePath = filePathRoot + "/Output/" + TRADES_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + outputPeriodLabel; filePath += '/' + fileName - botStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); + fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated); function onFileCreated(err) {