Merge pull request #993 from Luis-Fernando-Molina/develop

Contribution: bug fixed Bollinger Bands with hardcoded Data Mine Name
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-05-26 16:12:11 -04:00
commit 2a35196c64
3 files changed
+23 -41

No files matched your search

@@ -12,15 +12,15 @@
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let statusDependencies;
let statusDependenciesModule;
let beginingOfMarket
return thisObject;
function initialize(pStatusDependencies, callBackFunction) {
function initialize(pStatusDependenciesModule, callBackFunction) {
try {
statusDependencies = pStatusDependencies;
statusDependenciesModule = pStatusDependenciesModule;
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE);
} catch (err) {
@@ -52,16 +52,11 @@
function getContextVariables() {
try {
let thisReport;
let reportKey;
let statusReport;
let thisReport
let statusReport
/* We look first for Exchange Raw Data in order to get when the market starts. */
reportKey = "Masters" + "-" + "Exchange-Raw-Data" + "-" + "Historic-OHLCVs"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getContextVariables -> reportKey = " + reportKey)
statusReport = statusDependencies.statusReports.get(reportKey);
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Starting Point')
if (statusReport === undefined) { // This means the status report does not exist, that could happen for instance at the begining of a month.
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
@@ -77,11 +72,9 @@
return;
}
thisReport = statusDependencies.statusReports.get(reportKey).file;
thisReport = statusReport.file
if (thisReport.beginingOfMarket === undefined) {
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[WARN] start -> getContextVariables -> Undefined Last File. -> reportKey = " + reportKey);
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[HINT] start -> getContextVariables -> It is too early too run this process since the trade history of the market is not there yet.");
@@ -103,12 +96,8 @@
thisReport.beginingOfMarket.minutes +
TS.projects.superalgos.globals.timeConstants.GMT_SECONDS);
/* Second, we get the report from Candles Volumes, to know when the marted ends. */
reportKey = "Masters" + "-" + "Candles-Volumes" + "-" + "Multi-Time-Frame-Daily"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getContextVariables -> reportKey = " + reportKey)
statusReport = statusDependencies.statusReports.get(reportKey);
/* Second, we get the report from Exchange Raw Data, to know when the marted ends. */
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Ending Point')
if (statusReport === undefined) { // This means the status report does not exist, that could happen for instance at the begining of a month.
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
@@ -124,11 +113,9 @@
return;
}
thisReport = statusDependencies.statusReports.get(reportKey).file;
thisReport = statusReport.file
if (thisReport.lastFile === undefined) {
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[WARN] start -> getContextVariables -> Undefined Last File. -> reportKey = " + reportKey);
let customOK = {
result: TS.projects.superalgos.globals.standardResponses.CUSTOM_OK_RESPONSE.result,
@@ -143,11 +130,7 @@
contextVariables.maxBandFile = new Date(thisReport.lastFile.valueOf());
/* Finally we get our own Status Report. */
reportKey = "Masters" + "-" + "Bollinger-Bands" + "-" + "Multi-Time-Frame-Daily"
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getContextVariables -> reportKey = " + reportKey)
statusReport = statusDependencies.statusReports.get(reportKey);
statusReport = statusDependenciesModule.reportsByMainUtility.get('Self Reference')
if (statusReport === undefined) { // This means the status report does not exist, that could happen for instance at the begining of a month.
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
@@ -163,15 +146,13 @@
return;
}
thisReport = statusDependencies.statusReports.get(reportKey).file;
thisReport = statusReport.file
if (thisReport.lastFile !== undefined) {
beginingOfMarket = new Date(thisReport.beginingOfMarket);
if (beginingOfMarket.valueOf() !== contextVariables.datetimeBeginingOfMarketFile.valueOf()) { // Reset Mechanism for Begining of the Market
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getContextVariables -> Reset Mechanism for Begining of the Market Activated. -> reportKey = " + reportKey);
beginingOfMarket = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
@@ -244,9 +225,9 @@
"[ERROR] start -> getContextVariables -> err = " + err.stack);
if (err.message === "Cannot read property 'file' of undefined") {
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[HINT] start -> getContextVariables -> Check the bot configuration to see if all of its statusDependencies declarations are correct. ");
"[HINT] start -> getContextVariables -> Check the bot configuration to see if all of its statusDependenciesModule declarations are correct. ");
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[HINT] start -> getContextVariables -> Dependencies loaded -> keys = " + JSON.stringify(statusDependencies.keys));
"[HINT] start -> getContextVariables -> Dependencies loaded -> keys = " + JSON.stringify(statusDependenciesModule.keys));
}
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
@@ -841,8 +822,7 @@
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> writeStatusReport -> lastFileDate = " + lastFileDate)
try {
let reportKey = "Masters" + "-" + "Bollinger-Bands" + "-" + "Multi-Time-Frame-Daily"
let thisReport = statusDependencies.statusReports.get(reportKey);
let thisReport = statusDependenciesModule.reportsByMainUtility.get('Self Reference')
thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME;
thisReport.file.lastFile = lastFileDate;
@@ -10,14 +10,14 @@
start: start
}
let statusDependencies
let statusDependenciesModule
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex)
return thisObject
function initialize(pStatusDependencies, callBackFunction) {
function initialize(pStatusDependenciesModule, callBackFunction) {
try {
statusDependencies = pStatusDependencies;
statusDependenciesModule = pStatusDependenciesModule;
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE);
} catch (err) {
@@ -396,8 +396,7 @@
function writeStatusReport(callBack) {
try {
let reportKey = "Masters" + "-" + "Bollinger-Bands" + "-" + "Multi-Time-Frame-Market"
let thisReport = statusDependencies.statusReports.get(reportKey);
let thisReport = statusDependenciesModule.reportsByMainUtility.get('Self Reference')
thisReport.file.lastExecution = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME;
thisReport.save(callBack);
@@ -67,7 +67,8 @@
return;
}
thisReport = statusReport.file;
thisReport = statusReport.file
if (thisReport.beginingOfMarket === undefined) {
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[HINT] start -> getContextVariables -> It is too early too run this process since the trade history of the market is not there yet.");
@@ -108,6 +109,7 @@
}
thisReport = statusReport.file
if (thisReport.lastFile === undefined) {
let customOK = {
result: TS.projects.superalgos.globals.standardResponses.CUSTOM_OK_RESPONSE.result,
@@ -143,6 +145,7 @@
}
thisReport = statusReport.file
if (thisReport.lastFile !== undefined) {
beginingOfMarket = new Date(thisReport.beginingOfMarket)
if (beginingOfMarket.valueOf() !== contextVariables.datetimeBeginingOfMarketFile.valueOf()) { // Reset Mechanism for Begining of the Market