diff --git a/Assistant.js b/Assistant.js index 7ddf29b58..8f9bed000 100644 --- a/Assistant.js +++ b/Assistant.js @@ -1342,14 +1342,11 @@ } function sendMessage(pRelevance, pTitle, pBody) { + let runIndex = context.statusReport.runs.length - 1; context.newHistoryRecord.messageRelevance = pRelevance; - context.newHistoryRecord.messageTitle = pTitle; + context.newHistoryRecord.messageTitle = bot.startMode + "." + runIndex +": "+ pTitle; context.newHistoryRecord.messageBody = pBody; - - if(pRelevance > 6){ - sendEmail(pTitle, pBody, false); - } } @@ -1377,12 +1374,10 @@ } - function sendEmail(pTitle, pBody, pSendToAdmins) { + function sendEmail(pTitle, pBody, pTo) { try { - let emailList = global.EMAIL_CONFIG.distributionList; - if (pSendToAdmins) { - emailList = global.EMAIL_CONFIG.adminList; - } + let emailList = pTo; //TODO Pending to add spam controller + let runIndex = context.statusReport.runs.length - 1; let transporter = nodemailer.createTransport({ service: global.EMAIL_CONFIG.service, @@ -1395,7 +1390,7 @@ let mailOptions = { from: global.EMAIL_CONFIG.from, bcc: emailList, - subject: bot.startMode + ' - ' + pTitle, + subject: bot.startMode + "." + runIndex + ' - ' + pTitle, text: pBody }; diff --git a/Project.njsproj b/Project.njsproj index 34e1c0483..a7e60900f 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -7,7 +7,7 @@ ShowAllFiles Run.js - C:\Users\Luis\source\repos\AACloud + .\ . {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} 14.0 @@ -16,6 +16,7 @@ Trading-Process C:\Program Files\nodejs\node.exe False + Debug|Any CPU diff --git a/Root.js b/Root.js index 1fe0135d1..cf2dd5839 100644 --- a/Root.js +++ b/Root.js @@ -132,7 +132,7 @@ exports.newRoot = function newRoot() { logInfo: true, logWarnings: false, logErrors: true, - logContent: true, + logContent: false, intensiveLogging: false } }; diff --git a/TradingBotProcessMainLoop.js b/TradingBotProcessMainLoop.js index 80d259ab8..53d88c752 100644 --- a/TradingBotProcessMainLoop.js +++ b/TradingBotProcessMainLoop.js @@ -247,11 +247,11 @@ } /* - We will standarize the backtesting execution time, setting the exact time at the middle of the candle or timePeriod. + We will standarize the backtesting execution time, setting the exact time a fraction after the start of the candle or timePeriod. */ let totalMiliseconds = bot.processDatetime.valueOf(); - totalMiliseconds = Math.trunc(totalMiliseconds / timePeriod) * timePeriod + timePeriod / 2; + totalMiliseconds = Math.trunc(totalMiliseconds / timePeriod) * timePeriod + timePeriod / 6; bot.processDatetime = new Date(totalMiliseconds); @@ -855,7 +855,7 @@ clearTimeout(nextLoopTimeoutHandle); clearTimeout(checkLoopHealthHandle); bot.enableCheckLoopHealth = false; - assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true); + assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, emailList = global.EMAIL_CONFIG.adminList); callBackFunction(err); return; } @@ -868,7 +868,7 @@ clearTimeout(nextLoopTimeoutHandle); clearTimeout(checkLoopHealthHandle); bot.enableCheckLoopHealth = false; - assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true); + assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, emailList = global.EMAIL_CONFIG.adminList); callBackFunction(global.DEFAULT_FAIL_RESPONSE); return; } @@ -881,7 +881,7 @@ clearTimeout(nextLoopTimeoutHandle); clearTimeout(checkLoopHealthHandle); bot.enableCheckLoopHealth = false; - assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true); + assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, emailList = global.EMAIL_CONFIG.adminList); callBackFunction(err); } } @@ -893,7 +893,7 @@ clearTimeout(nextLoopTimeoutHandle); clearTimeout(checkLoopHealthHandle); bot.enableCheckLoopHealth = false; - assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true); + assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, emailList = global.EMAIL_CONFIG.adminList); callBackFunction(err); } }