diff --git a/.vs/AABruce-Indicator-Bot/v15/.suo b/.vs/AABruce-Indicator-Bot/v15/.suo
index 1234d51b6..7b3d52fa8 100644
Binary files a/.vs/AABruce-Indicator-Bot/v15/.suo and b/.vs/AABruce-Indicator-Bot/v15/.suo differ
diff --git a/Commons.js b/Commons.js
new file mode 100644
index 000000000..8602f65bf
--- /dev/null
+++ b/Commons.js
@@ -0,0 +1,73 @@
+exports.newCommons = function newCommons(BOT, DEBUG_MODULE, UTILITIES) {
+
+ const FULL_LOG = true;
+ const LOG_FILE_CONTENT = false;
+
+ const MODULE_NAME = "Commons";
+
+ const ONE_DAY_IN_MILISECONDS = 24 * 60 * 60 * 1000;
+ const GMT_SECONDS = ':00.000 GMT+0000';
+
+ let thisObject = {
+ initializeStorage: initializeStorage
+ };
+
+ let bot = BOT;
+
+ const logger = DEBUG_MODULE.newDebugLog();
+ logger.fileName = MODULE_NAME;
+ logger.bot = bot;
+
+ let utilities = UTILITIES.newUtilities(bot);
+
+ return thisObject;
+
+ function initializeStorage(charlyFileStorage, bruceFileStorage, callBackFunction) {
+
+ try {
+
+ if (FULL_LOG === true) { logger.write("[INFO] initializeStorage -> Entering function."); }
+
+ initializeBruceStorage();
+
+ function initializeBruceStorage() {
+
+ bruceFileStorage.initialize("AABruce", onBruceInizialized);
+
+ function onBruceInizialized(err) {
+
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
+
+ initializeCharlyStorage();
+
+ } else {
+ logger.write("[ERROR] initializeStorage -> initializeBruceStorage -> onBruceInizialized -> err = " + err.message);
+ callBackFunction(err);
+ }
+ }
+ }
+
+ function initializeCharlyStorage() {
+
+ charlyFileStorage.initialize("AACharly", onCharlyInizialized);
+
+ function onCharlyInizialized(err) {
+
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
+
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
+
+ } else {
+ logger.write("[ERROR] initializeStorage -> initializeCharlyStorage -> onCharlyInizialized -> err = " + err.message);
+ callBackFunction(err);
+ }
+ }
+ }
+ }
+ catch (err) {
+ logger.write("[ERROR] initializeStorage -> err = " + err.message);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
+ }
+ }
+
+};
\ No newline at end of file
diff --git a/One-Min-Daily-Candles-Volumes/Interval.js b/One-Min-Daily-Candles-Volumes/User.bot.js
similarity index 96%
rename from One-Min-Daily-Candles-Volumes/Interval.js
rename to One-Min-Daily-Candles-Volumes/User.bot.js
index 26037f4fa..72e7cc17a 100644
--- a/One-Min-Daily-Candles-Volumes/Interval.js
+++ b/One-Min-Daily-Candles-Volumes/User.bot.js
@@ -25,6 +25,8 @@
logger.fileName = MODULE_NAME;
logger.bot = bot;
+ const commons = COMMONS.newCommons(bot, DEBUG_MODULE, UTILITIES);
+
thisObject = {
initialize: initialize,
start: start
@@ -42,44 +44,48 @@
return thisObject;
- function initialize(yearAssigend, monthAssigned, callBackFunction) {
+ function initialize(pDependencies, pMonth, pYear, callBackFunction) {
try {
- year = yearAssigend;
- month = monthAssigned;
-
+ year = pYear;
+ month = pMonth;
month = utilities.pad(month, 2); // Adding a left zero when needed.
+ dependencies = pDependencies;
logger.fileName = MODULE_NAME + "-" + year + "-" + month;
- const logText = "[INFO] initialize - Entering function 'initialize' " + " @ " + year + "-" + month;
- console.log(logText);
- logger.write(logText);
+ if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
+ if (FULL_LOG === true) { logger.write("[INFO] initialize -> pYear = " + year); }
+ if (FULL_LOG === true) { logger.write("[INFO] initialize -> pMonth = " + month); }
- charlyFileStorage.initialize("Charly");
- bruceFileStorage.initialize("Bruce");
+ dependencies = pDependencies;
- markets = MARKETS_MODULE.newMarkets(bot);
- markets.initialize(callBackFunction);
+ commons.initializeStorage(charlyFileStorage, bruceFileStorage, onInizialized);
+ function onInizialized(err) {
+
+ if (err.result === global.DEFAULT_OK_RESPONSE.result) {
+
+ if (FULL_LOG === true) { logger.write("[INFO] initialize -> onInizialized -> Initialization Succeed."); }
+ callBackFunction(global.DEFAULT_OK_RESPONSE);
+
+ } else {
+ logger.write("[ERROR] initialize -> onInizialized -> err = " + err.message);
+ callBackFunction(err);
+ }
+ }
} catch (err) {
-
- const logText = "[ERROR] initialize - ' ERROR : " + err.message;
- console.log(logText);
- logger.write(logText);
-
+ logger.write("[ERROR] initialize -> err = " + err.message);
+ callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
-/*
-
-This process is going to do the following:
-
-Read the trades from Charly's Output and pack them into daily files with candles of one minute.
-
-*/
+ /*
+ This process is going to do the following:
+ Read the trades from Charly's Output and pack them into daily files with candles of one minute.
+ */
function start(callBackFunction) {
diff --git a/Project.njsproj b/Project.njsproj
index 8a269f3c9..b4ee6a319 100644
--- a/Project.njsproj
+++ b/Project.njsproj
@@ -21,7 +21,10 @@
-
+
+ Code
+
+
diff --git a/this.bot.config.json b/this.bot.config.json
index 93bbe382d..132d337bb 100644
--- a/this.bot.config.json
+++ b/this.bot.config.json
@@ -61,7 +61,8 @@
"minor": 0
},
"process": "One-Min-Daily-Candles-Volumes",
- "dataSetVersion": "dataSet.V1"
+ "dataSetVersion": "dataSet.V1",
+ "dataSetSection": "Month"
}
]
}