Merge pull request #16 from AAVikings/master
Email and minor enhacements
This commit is contained in:
4 files changed
+15
-19
No files matched your search
+6
-11
@@ -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
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -7,7 +7,7 @@
|
||||
<ProjectHome />
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<StartupFile>Run.js</StartupFile>
|
||||
<WorkingDirectory>C:\Users\Luis\source\repos\AACloud</WorkingDirectory>
|
||||
<WorkingDirectory>.\</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
@@ -16,6 +16,7 @@
|
||||
<ScriptArguments>Trading-Process</ScriptArguments>
|
||||
<NodeExePath>C:\Program Files\nodejs\node.exe</NodeExePath>
|
||||
<StartWebBrowser>False</StartWebBrowser>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
|
||||
|
||||
@@ -132,7 +132,7 @@ exports.newRoot = function newRoot() {
|
||||
logInfo: true,
|
||||
logWarnings: false,
|
||||
logErrors: true,
|
||||
logContent: true,
|
||||
logContent: false,
|
||||
intensiveLogging: false
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user