Fixing Paula not running
This commit is contained in:
1 parent
f78c861c4a
commit
39ce982afe
5 files changed
+31
-13
No files matched your search
@@ -369,22 +369,27 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
/* If any of the needed indicators is missing, then that period is not calculated */
|
||||
|
||||
if (candle.begin < initialDate.valueOf()) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> loop -> Skipping Record before the initialDate."); }
|
||||
controlLoop();
|
||||
return
|
||||
}
|
||||
if (bollingerBand === undefined) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> loop -> Skipping Record because Bollinger Band is undefined."); }
|
||||
controlLoop();
|
||||
return
|
||||
}
|
||||
if (percentageBandwidth === undefined) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> loop -> Skipping Record because %B is undefined."); }
|
||||
controlLoop();
|
||||
return
|
||||
} // percentageBandwidth might start after the first few candles.
|
||||
if (bollingerChannel === undefined) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> loop -> Skipping Record because Bollingeer Channel is undefined."); }
|
||||
controlLoop();
|
||||
return
|
||||
}
|
||||
if (bollingerSubChannel === undefined) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> loop -> Skipping Record because Bollingeer Sub Channel is undefined."); }
|
||||
controlLoop();
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const readFileAsync = promisify(fs.readFile)
|
||||
const writeFileAsync = promisify(fs.writeFile)
|
||||
const path = require('path')
|
||||
|
||||
exports.newFileStorage = function newFileStorage() {
|
||||
exports.newFileStorage = function newFileStorage(logger) {
|
||||
const MODULE_NAME = 'FileStorage'
|
||||
const MAX_RETRY = 30
|
||||
let currentRetryGetTextFile = 0
|
||||
@@ -37,7 +37,11 @@ exports.newFileStorage = function newFileStorage() {
|
||||
log('[INFO] ' + message)
|
||||
}
|
||||
function log(message) {
|
||||
console.log("['" + new Date().toISOString() + "', 0,'" + MODULE_NAME + "','" + message + "']")
|
||||
if (logger) {
|
||||
logger.write(MODULE_NAME, message);
|
||||
} else {
|
||||
console.log("['" + new Date().toISOString() + "', 0,'" + MODULE_NAME + "','" + message + "']")
|
||||
}
|
||||
}
|
||||
|
||||
function logError(message) {
|
||||
@@ -46,7 +50,6 @@ exports.newFileStorage = function newFileStorage() {
|
||||
|
||||
async function getTextFile(container, filePath, callBackFunction) {
|
||||
|
||||
|
||||
try {
|
||||
let host = await getDevTeamHost(container)
|
||||
|
||||
|
||||
+9
-4
@@ -21,7 +21,7 @@
|
||||
let usertBot;
|
||||
|
||||
const FILE_STORAGE = require('./Integrations/FileStorage.js');
|
||||
let fileStorage = FILE_STORAGE.newFileStorage();
|
||||
let fileStorage = FILE_STORAGE.newFileStorage(logger);
|
||||
|
||||
let processConfig;
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
|
||||
/* The starting date is fixed, we will start from there. */
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> We have got a user defined startDate. -> startDate = " + processConfig.framework.startDate.fixedDate); }
|
||||
contextVariables.dateBeginOfMarket = new Date(processConfig.framework.startDate.fixedDate);
|
||||
|
||||
} else {
|
||||
@@ -152,7 +153,7 @@
|
||||
if (processConfig.framework.endDate.fixedDate !== undefined) {
|
||||
|
||||
/* The ending date is fixed, we will end there. */
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> We have got a user defined endDate. -> endDate = " + processConfig.framework.endDate.fixedDate); }
|
||||
contextVariables.dateEndOfMarket = new Date(processConfig.framework.endDate.fixedDate);
|
||||
|
||||
} else {
|
||||
@@ -222,6 +223,7 @@
|
||||
|
||||
if (bot.hasTheBotJustStarted === true && processConfig.framework.startDate.resumeExecution === false) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> Starting from the begining because bot has just started and resume execution was true."); }
|
||||
startFromBegining();
|
||||
return;
|
||||
}
|
||||
@@ -237,7 +239,7 @@
|
||||
/*
|
||||
In the case when there is no status report, we assume like the last processed file is the one on the date of Begining of Market.
|
||||
*/
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> Starting from the begining of the market because own status report not found or lastFile was undefined."); }
|
||||
startFromBegining();
|
||||
return;
|
||||
}
|
||||
@@ -246,7 +248,6 @@
|
||||
|
||||
contextVariables.lastFile = new Date(contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" + (contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" + contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" + GMT_SECONDS);
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> startFromBegining -> thisReport.lastFile === undefined"); }
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getContextVariables -> startFromBegining -> contextVariables.lastFile = " + contextVariables.lastFile); }
|
||||
|
||||
/*
|
||||
@@ -365,6 +366,7 @@
|
||||
if (period === outputPeriodLabel) { validPeriod = true }
|
||||
}
|
||||
if (validPeriod === false) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> periodsLoopBody -> Discarding period for not being listed as a valid period. -> outputPeriodLabel = " + outputPeriodLabel); }
|
||||
periodsControlLoop();
|
||||
return;
|
||||
}
|
||||
@@ -373,6 +375,7 @@
|
||||
let timePeriodFilter = global.EXECUTION_CONFIG.timePeriodFileStorage
|
||||
if (timePeriodFilter !== undefined) {
|
||||
if (timePeriodFilter.indexOf(outputPeriodLabel) === -1) {
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> periodsLoopBody -> Discarding period for being filtered out. -> outputPeriodLabel = " + outputPeriodLabel); }
|
||||
periodsControlLoop();
|
||||
return;
|
||||
}
|
||||
@@ -499,6 +502,8 @@
|
||||
if ((err.result === "Fail Because" && err.message === "File does not exist.") || err.code === 'The specified key does not exist.') {
|
||||
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriods -> periodsLoopBody -> dependencyLoopBody -> getCurrentFile -> onFileReceived -> err = " + err.code);
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriods -> periodsLoopBody -> dependencyLoopBody -> getCurrentFile -> onFileReceived -> filePath = " + filePath);
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriods -> periodsLoopBody -> dependencyLoopBody -> getCurrentFile -> onFileReceived -> fileName = " + fileName);
|
||||
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ let sequenceList = require('./sequence');
|
||||
let isRunSequence = false;
|
||||
let sequenceStep = 0;
|
||||
let processedSteps = new Map()
|
||||
notFirstSequence = false
|
||||
let notFirstSequence = false
|
||||
|
||||
if (process.env.RUN_SEQUENCE !== undefined) {
|
||||
isRunSequence = JSON.parse(process.env.RUN_SEQUENCE)
|
||||
@@ -53,7 +53,7 @@ function sequenceExecution(currentStep) {
|
||||
execution.devTeam ? process.env.DEV_TEAM = execution.devTeam : undefined;
|
||||
execution.bot ? process.env.BOT = execution.bot : undefined;
|
||||
execution.mode ? process.env.START_MODE = execution.mode : undefined;
|
||||
execution.resumeExecution = notFirstSequence
|
||||
execution.resumeExecution = true;
|
||||
execution.type ? process.env.TYPE = execution.type : undefined;
|
||||
execution.process ? process.env.PROCESS = execution.process : undefined;
|
||||
execution.startYear ? process.env.MIN_YEAR = execution.startYear : undefined;
|
||||
@@ -142,6 +142,11 @@ async function readExecutionConfiguration(execution) {
|
||||
|
||||
if (execution.type === 'Trading-Engine') {
|
||||
|
||||
/* The Trading Engine only resumes its execution after the first sequence was completed. */
|
||||
if (notFirstSequence === false) {
|
||||
execution.resumeExecution = false
|
||||
}
|
||||
|
||||
/* We set the START MODE of the Trading Engine */
|
||||
if (process.env.KEY === undefined || process.env.SECRET === undefined) {
|
||||
process.env.START_MODE = "backtest" // if we dont have keys, we swtich to backtest mode to avoid exchange errors.
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
}
|
||||
|
||||
USER_BOT_MODULE = {}
|
||||
USER_BOT_MODULE.newUserBot = require(ROOT_DIR + 'User.Bot').newUserBot // Use this for a better debugging experience. You need to bring this js module to this folder in order to work.
|
||||
//USER_BOT_MODULE.newUserBot = eval(text); // Use this for production
|
||||
//USER_BOT_MODULE.newUserBot = require(ROOT_DIR + 'User.Bot').newUserBot // Use this for a better debugging experience. You need to bring this js module to this folder in order to work.
|
||||
USER_BOT_MODULE.newUserBot = eval(text); // Use this for production
|
||||
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo;
|
||||
filePath += "/Commons.js"
|
||||
@@ -70,8 +70,8 @@
|
||||
return;
|
||||
}
|
||||
COMMONS_MODULE = {}
|
||||
COMMONS_MODULE.newCommons = require(ROOT_DIR + 'Commons').newCommons // Use this for a better debugging experience. You need to bring this js module to this folder in order to work.
|
||||
//COMMONS_MODULE.newCommons = eval(text); // Use this for production
|
||||
//COMMONS_MODULE.newCommons = require(ROOT_DIR + 'Commons').newCommons // Use this for a better debugging experience. You need to bring this js module to this folder in order to work.
|
||||
COMMONS_MODULE.newCommons = eval(text); // Use this for production
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user