From 55ed967bd5c8a327275cdd78496392c9cf0c55f3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 17 Mar 2019 15:48:51 +0100 Subject: [PATCH] Time Period refactored --- Commons.js | 16 +++++----- Multi-Period-Daily/User.Bot.js | 28 ++++++++--------- Multi-Period-Market/User.Bot.js | 28 ++++++++--------- this.bot.config.json | 54 ++++++++++++++++++++++++++++++--- 4 files changed, 86 insertions(+), 40 deletions(-) diff --git a/Commons.js b/Commons.js index 15f5190d0..58597556f 100644 --- a/Commons.js +++ b/Commons.js @@ -45,7 +45,7 @@ recordsArray, conditionsArray, simulationLogic, - outputPeriod, + timePeriod, callback) { try { @@ -873,7 +873,7 @@ hitRatio = hits / roundtrips; let miliSecondsPerDay = 24 * 60 * 60 * 1000; - days = periods * outputPeriod / miliSecondsPerDay; + days = periods * timePeriod / miliSecondsPerDay; anualizedRateOfReturn = ROI / days * 365; addRecord(); @@ -970,7 +970,7 @@ } } - function buildLRC(dataFile) { + function buildLRC(dataFile, callBackFunction) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] buildLRC -> Entering function."); } @@ -1017,7 +1017,7 @@ } } - function buildPercentageBandwidthMap(dataFile) { + function buildPercentageBandwidthMap(dataFile, callBackFunction) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] buildPercentageBandwidthMap -> Entering function."); } @@ -1056,7 +1056,7 @@ } } - function buildBollingerBandsMap(dataFile) { + function buildBollingerBandsMap(dataFile, callBackFunction) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] buildBollingerBandsMap -> Entering function."); } @@ -1095,7 +1095,7 @@ } } - function buildBollingerChannelsArray(dataFile) { + function buildBollingerChannelsArray(dataFile, callBackFunction) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] buildBollingerChannelsArray -> Entering function."); } @@ -1129,7 +1129,7 @@ } } - function buildBollingerSubChannelsArray(dataFile) { + function buildBollingerSubChannelsArray(dataFile, callBackFunction) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] buildBollingerSubChannelsArray -> Entering function."); } @@ -1164,7 +1164,7 @@ } } - function buildCandles(dataFile) { + function buildCandles(dataFile, callBackFunction) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] buildCandles -> Entering function."); } diff --git a/Multi-Period-Daily/User.Bot.js b/Multi-Period-Daily/User.Bot.js index f1ca93728..dce80df1e 100644 --- a/Multi-Period-Daily/User.Bot.js +++ b/Multi-Period-Daily/User.Bot.js @@ -18,7 +18,7 @@ }; let utilities = UTILITIES.newCloudUtilities(bot, logger); - let jasonStorage = BLOB_STORAGE.newBlobStorage(bot, logger); + let thisBotStorage = BLOB_STORAGE.newBlobStorage(bot, logger); let dataDependencies; @@ -35,7 +35,7 @@ dataDependencies = pDataDependencies; - jasonStorage.initialize(bot.devTeam, onStorageInizialized); + thisBotStorage.initialize(bot.devTeam, onStorageInizialized); function onStorageInizialized(err) { @@ -54,7 +54,7 @@ } } - function start(dataFiles, outputPeriod, timePeriod, currentDate, callBackFunction) { + function start(dataFiles, timePeriod, outputPeriodLabel, currentDate, callBackFunction) { try { @@ -77,27 +77,27 @@ switch (i) { case 0: { - commons.buildLRC(dataFile); + commons.buildLRC(dataFile, callBackFunction); break; } case 1: { - commons.buildPercentageBandwidthMap(dataFile); + commons.buildPercentageBandwidthMap(dataFile, callBackFunction); break; } case 2: { - commons.buildBollingerBandsMap(dataFile); + commons.buildBollingerBandsMap(dataFile, callBackFunction); break; } case 3: { - commons.buildBollingerChannelsArray(dataFile); + commons.buildBollingerChannelsArray(dataFile, callBackFunction); break; } case 4: { - commons.buildBollingerSubChannelsArray(dataFile); + commons.buildBollingerSubChannelsArray(dataFile, callBackFunction); break; } case 5: { - commons.buildCandles(dataFile); + commons.buildCandles(dataFile, callBackFunction); break; } } @@ -107,7 +107,7 @@ recordsArray, conditionsArray, simulationLogic, - outputPeriod, + timePeriod, writeRecordsFile) function writeRecordsFile() { @@ -167,9 +167,9 @@ let fileName = '' + market.assetA + '_' + market.assetB + '.json'; let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion; - let filePath = filePathRoot + "/Output/" + SIMULATED_RECORDS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + timePeriod; + let filePath = filePathRoot + "/Output/" + SIMULATED_RECORDS_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel; - jasonStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); + thisBotStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -246,9 +246,9 @@ let fileName = '' + market.assetA + '_' + market.assetB + '.json'; let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion; - let filePath = filePathRoot + "/Output/" + CONDITIONS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + timePeriod; + let filePath = filePathRoot + "/Output/" + CONDITIONS_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel; - jasonStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); + thisBotStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); function onFileCreated(err) { diff --git a/Multi-Period-Market/User.Bot.js b/Multi-Period-Market/User.Bot.js index 0b7c78a56..63bb2135b 100644 --- a/Multi-Period-Market/User.Bot.js +++ b/Multi-Period-Market/User.Bot.js @@ -18,7 +18,7 @@ }; let utilities = UTILITIES.newCloudUtilities(bot, logger); - let jasonStorage = BLOB_STORAGE.newBlobStorage(bot, logger); + let thisBotStorage = BLOB_STORAGE.newBlobStorage(bot, logger); let dataDependencies; @@ -35,7 +35,7 @@ dataDependencies = pDataDependencies; - jasonStorage.initialize(bot.devTeam, onStorageInizialized); + thisBotStorage.initialize(bot.devTeam, onStorageInizialized); function onStorageInizialized(err) { @@ -54,7 +54,7 @@ } } - function start(dataFiles, outputPeriod, timePeriod, callBackFunction) { + function start(dataFiles, timePeriod, outputPeriodLabel, callBackFunction) { try { @@ -77,27 +77,27 @@ switch (i) { case 0: { - commons.buildLRC(dataFile); + commons.buildLRC(dataFile, callBackFunction); break; } case 1: { - commons.buildPercentageBandwidthMap(dataFile); + commons.buildPercentageBandwidthMap(dataFile, callBackFunction); break; } case 2: { - commons.buildBollingerBandsMap(dataFile); + commons.buildBollingerBandsMap(dataFile, callBackFunction); break; } case 3: { - commons.buildBollingerChannelsArray(dataFile); + commons.buildBollingerChannelsArray(dataFile, callBackFunction); break; } case 4: { - commons.buildBollingerSubChannelsArray(dataFile); + commons.buildBollingerSubChannelsArray(dataFile, callBackFunction); break; } case 5: { - commons.buildCandles(dataFile); + commons.buildCandles(dataFile, callBackFunction); break; } } @@ -107,7 +107,7 @@ recordsArray, conditionsArray, simulationLogic, - outputPeriod, + timePeriod, writeRecordsFile) function writeRecordsFile() { @@ -163,9 +163,9 @@ let fileName = '' + market.assetA + '_' + market.assetB + '.json'; let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion; - let filePath = filePathRoot + "/Output/" + SIMULATED_RECORDS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + timePeriod; + let filePath = filePathRoot + "/Output/" + SIMULATED_RECORDS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + outputPeriodLabel; - jasonStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); + thisBotStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); function onFileCreated(err) { @@ -238,9 +238,9 @@ let fileName = '' + market.assetA + '_' + market.assetB + '.json'; let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion; - let filePath = filePathRoot + "/Output/" + CONDITIONS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + timePeriod; + let filePath = filePathRoot + "/Output/" + CONDITIONS_FOLDER_NAME + "/" + "Multi-Period-Market" + "/" + outputPeriodLabel; - jasonStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); + thisBotStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated); function onFileCreated(err) { diff --git a/this.bot.config.json b/this.bot.config.json index dfa2f6ce8..cf3733691 100644 --- a/this.bot.config.json +++ b/this.bot.config.json @@ -153,12 +153,12 @@ "major": 1, "minor": 0 }, - "process": "Poloniex-Historic-Records", + "process": "Poloniex-Historic-Trades", "dataSetVersion": "dataSet.V1" }, { "devTeam": "AAMasters", - "bot": "AAChris", + "bot": "AAOlivia", "botVersion": { "major": 1, "minor": 0 @@ -177,6 +177,8 @@ "dataSetVersion": "dataSet.V1" } ], + "statusDependenciesIndexBegingOfMarket": 0, + "statusDependenciesIndexEndOfMarket": 1, "dataDependencies": [ { "devTeam": "AAVikings", @@ -187,7 +189,51 @@ }, "product": "LRC-Points", "dataSetVersion": "dataSet.V1", - "dataSet": "Multi-Period-Daily" + "dataSet": "Multi-Period-Market" + }, + { + "devTeam": "AAMasters", + "bot": "AAChris", + "botVersion": { + "major": 1, + "minor": 0 + }, + "product": "Percentage-Bandwidth", + "dataSetVersion": "dataSet.V1", + "dataSet": "Multi-Period-Market" + }, + { + "devTeam": "AAMasters", + "bot": "AAChris", + "botVersion": { + "major": 1, + "minor": 0 + }, + "product": "Bollinger-Bands", + "dataSetVersion": "dataSet.V1", + "dataSet": "Multi-Period-Market" + }, + { + "devTeam": "AAMasters", + "bot": "AAPaula", + "botVersion": { + "major": 1, + "minor": 0 + }, + "product": "Bollinger-Channels", + "dataSetVersion": "dataSet.V1", + "dataSet": "Multi-Period-Market" + }, + { + "devTeam": "AAMasters", + "bot": "AAPaula", + "botVersion": { + "major": 1, + "minor": 0 + }, + "product": "Bollinger-Sub-Channels", + "dataSetVersion": "dataSet.V1", + "dataSet": "Multi-Period-Market" }, { "devTeam": "AAMasters", @@ -198,7 +244,7 @@ }, "product": "Candles", "dataSetVersion": "dataSet.V1", - "dataSet": "Multi-Period-Daily" + "dataSet": "Multi-Period-Market" } ], "framework": "Multi-Period-Daily"