Merge pull request #138 from AAMasters/develop
Bug Fixes and Mantainance
This commit is contained in:
7 files changed
+102
-57
No files matched your search
+10
-7
@@ -71,6 +71,7 @@
|
||||
let statusDependencies;
|
||||
|
||||
let runIndex; // This is the index for this run and depends on the startMode.
|
||||
let sessionPath = ''
|
||||
|
||||
return thisObject;
|
||||
|
||||
@@ -82,11 +83,13 @@
|
||||
|
||||
statusDependencies = pStatusDependencies;
|
||||
|
||||
/*
|
||||
if (bot.SESSION !== undefined) {
|
||||
sessionPath = bot.SESSION.id + "/"
|
||||
}
|
||||
|
||||
/*
|
||||
Here we get the positions the bot did and that are recorded at the bot storage account. We will use them through out the rest
|
||||
of the process.
|
||||
|
||||
*/
|
||||
thisObject.newHistoryRecord.date = bot.processDatetime;
|
||||
|
||||
@@ -163,7 +166,7 @@
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> getExecutionHistory -> Entering function."); }
|
||||
|
||||
let fileName = "Execution.History." + bot.startMode + "." + runIndex + ".json";
|
||||
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName;
|
||||
let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + fileName;
|
||||
|
||||
fileStorage.getTextFile(bot.devTeam, filePath, onFileReceived);
|
||||
|
||||
@@ -224,7 +227,7 @@
|
||||
|
||||
let fileName = "/Execution.Context." + bot.startMode + "." + runIndex + ".json";
|
||||
let dateForPath = date.getUTCFullYear() + '/' + utilities.pad(date.getUTCMonth() + 1, 2) + '/' + utilities.pad(date.getUTCDate(), 2) + '/' + utilities.pad(date.getUTCHours(), 2) + '/' + utilities.pad(date.getUTCMinutes(), 2);
|
||||
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + dateForPath + fileName;
|
||||
let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + dateForPath + fileName;
|
||||
|
||||
fileStorage.getTextFile(bot.devTeam, filePath, onFileReceived);
|
||||
|
||||
@@ -398,7 +401,7 @@
|
||||
|
||||
let fileName = "/Execution.Context." + bot.startMode + "." + runIndex +".json";
|
||||
let dateForPath = bot.processDatetime.getUTCFullYear() + '/' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.processDatetime.getUTCDate(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCHours(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCMinutes(), 2);
|
||||
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + dateForPath + fileName;
|
||||
let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + dateForPath + fileName;
|
||||
let fileContent = JSON.stringify(thisObject.executionContext);
|
||||
|
||||
if(fileContent === undefined){
|
||||
@@ -438,7 +441,7 @@
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] saveThemAll -> writeExucutionHistory -> Entering function."); }
|
||||
|
||||
let fileName = "Execution.History." + bot.startMode + "." + runIndex + ".json";
|
||||
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName;
|
||||
let filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + fileName;
|
||||
|
||||
let newRecord = [
|
||||
thisObject.newHistoryRecord.date.valueOf(),
|
||||
@@ -489,7 +492,7 @@
|
||||
|
||||
fileContent = runIndex;
|
||||
fileName = "Execution.History." + bot.startMode + "." + "Sequence" + ".json";
|
||||
filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName;
|
||||
filePath = bot.filePathRoot + "/Output/" + sessionPath + "Trading-Process/" + fileName;
|
||||
|
||||
fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onSequenceFileCreated);
|
||||
|
||||
|
||||
+15
-15
@@ -435,7 +435,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
bot.multiPeriodDailyProcessDatetime = new Date(contextVariables.lastFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
|
||||
bot.multiPeriodProcessDatetime = new Date(contextVariables.lastFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
|
||||
|
||||
advanceTime();
|
||||
|
||||
@@ -445,21 +445,21 @@
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriodsDailyFiles -> advanceTime -> Entering function."); }
|
||||
|
||||
bot.multiPeriodDailyProcessDatetime = new Date(bot.multiPeriodDailyProcessDatetime.valueOf() + ONE_DAY_IN_MILISECONDS);
|
||||
previousDay = new Date(bot.multiPeriodDailyProcessDatetime.valueOf() - ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " " + "bot.multiPeriodDailyProcessDatetime = " + bot.multiPeriodDailyProcessDatetime.toISOString());
|
||||
bot.multiPeriodProcessDatetime = new Date(bot.multiPeriodProcessDatetime.valueOf() + ONE_DAY_IN_MILISECONDS);
|
||||
previousDay = new Date(bot.multiPeriodProcessDatetime.valueOf() - ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " " + "bot.multiPeriodProcessDatetime = " + bot.multiPeriodProcessDatetime.toISOString());
|
||||
|
||||
if (global.WRITE_LOGS_TO_FILES === 'true') {
|
||||
logger.newInternalLoop(bot.codeName, bot.process);
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriodsDailyFiles -> advanceTime -> bot.multiPeriodDailyProcessDatetime = " + bot.multiPeriodDailyProcessDatetime); }
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriodsDailyFiles -> advanceTime -> bot.multiPeriodProcessDatetime = " + bot.multiPeriodProcessDatetime); }
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriodsDailyFiles -> advanceTime -> previousDay = " + previousDay); }
|
||||
|
||||
/* Validation that we are not going past the user defined end date. */
|
||||
|
||||
if (bot.multiPeriodDailyProcessDatetime.valueOf() >= bot.VALUES_TO_USE.timeRange.finalDatetime.valueOf()) {
|
||||
if (bot.multiPeriodProcessDatetime.valueOf() >= bot.VALUES_TO_USE.timeRange.finalDatetime.valueOf()) {
|
||||
|
||||
const logText = "User Defined End Datetime reached @ " + previousDay.getUTCFullYear() + "/" + (previousDay.getUTCMonth() + 1) + "/" + previousDay.getUTCDate() + ".";
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriodsDailyFiles -> advanceTime -> " + logText); }
|
||||
@@ -472,7 +472,7 @@
|
||||
|
||||
/* Validation that we are not going past the head of the market. */
|
||||
|
||||
if (bot.multiPeriodDailyProcessDatetime.valueOf() > contextVariables.dateEndOfMarket.valueOf()) {
|
||||
if (bot.multiPeriodProcessDatetime.valueOf() > contextVariables.dateEndOfMarket.valueOf()) {
|
||||
|
||||
const logText = "Head of the market found @ " + previousDay.getUTCFullYear() + "/" + (previousDay.getUTCMonth() + 1) + "/" + previousDay.getUTCDate() + ".";
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriodsDailyFiles -> advanceTime -> " + logText); }
|
||||
@@ -543,7 +543,7 @@
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriodsDailyFiles -> periodsLoop -> Entering function."); }
|
||||
|
||||
/* Telling the world we are alive and doing well */
|
||||
let processingDate = bot.multiPeriodDailyProcessDatetime.getUTCFullYear() + '-' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCMonth() + 1, 2) + '-' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCDate(), 2);
|
||||
let processingDate = bot.multiPeriodProcessDatetime.getUTCFullYear() + '-' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCMonth() + 1, 2) + '-' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCDate(), 2);
|
||||
bot.processHeartBeat(processingDate)
|
||||
|
||||
/*
|
||||
@@ -606,7 +606,7 @@
|
||||
let previousFile;
|
||||
let currentFile;
|
||||
|
||||
if (bot.multiPeriodDailyProcessDatetime.valueOf() > contextVariables.dateBeginOfMarket.valueOf()) {
|
||||
if (bot.multiPeriodProcessDatetime.valueOf() > contextVariables.dateBeginOfMarket.valueOf()) {
|
||||
getPreviousFile();
|
||||
} else {
|
||||
previousFile = [];
|
||||
@@ -702,7 +702,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
let dateForPath = bot.multiPeriodDailyProcessDatetime.getUTCFullYear() + '/' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCDate(), 2);
|
||||
let dateForPath = bot.multiPeriodProcessDatetime.getUTCFullYear() + '/' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCDate(), 2);
|
||||
let filePath
|
||||
if (dependency.dataSet === "Multi-Period-Daily") {
|
||||
filePath = dependency.product + '/' + dependency.dataSet + "/" + outputPeriodLabel + "/" + dateForPath;
|
||||
@@ -836,7 +836,7 @@
|
||||
multiPeriodDataFiles,
|
||||
currentTimePeriod,
|
||||
currentOutputPeriodLabel,
|
||||
bot.multiPeriodDailyProcessDatetime,
|
||||
bot.multiPeriodProcessDatetime,
|
||||
interExecutionMemoryArray[n],
|
||||
onBotFinished);
|
||||
|
||||
@@ -872,7 +872,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
writeDailyStatusReport(bot.multiPeriodDailyProcessDatetime, onDailyStatusReport);
|
||||
writeDailyStatusReport(bot.multiPeriodProcessDatetime, onDailyStatusReport);
|
||||
|
||||
} catch (err) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriodsDailyFiles -> callTheBot -> onBotFinished -> onWritten -> err = " + err.stack);
|
||||
@@ -951,7 +951,7 @@
|
||||
|
||||
let folderName = bot.products[productIndex].codeName;
|
||||
|
||||
writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodDailyProcessDatetime, folderName, controlLoop);
|
||||
writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodProcessDatetime, folderName, controlLoop);
|
||||
}
|
||||
|
||||
function controlLoop() {
|
||||
@@ -986,7 +986,7 @@
|
||||
let fileContent = JSON.stringify(dataRange);
|
||||
|
||||
let fileName = '/Data.Range.' + market.assetA + '_' + market.assetB + '.json';
|
||||
let filePath = bot.filePathRoot + "/Output/" + pProductFolder + "/" + 'Multi-Period-Daily' + fileName;
|
||||
let filePath = bot.filePathRoot + "/Output/" + bot.SESSION.id + "/" + pProductFolder + "/" + 'Multi-Period-Daily' + fileName;
|
||||
|
||||
fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated);
|
||||
|
||||
|
||||
+12
-12
@@ -306,7 +306,7 @@
|
||||
let n;
|
||||
let botNeverRan = true;
|
||||
|
||||
bot.multiPeriodProcessDatetime = new Date(contextVariables.lastFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
|
||||
bot.multiPeriodDailyProcessDatetime = new Date(contextVariables.lastFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
|
||||
|
||||
advanceTime();
|
||||
|
||||
@@ -316,21 +316,21 @@
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> Entering function."); }
|
||||
|
||||
bot.multiPeriodProcessDatetime = new Date(bot.multiPeriodProcessDatetime.valueOf() + ONE_DAY_IN_MILISECONDS);
|
||||
previousDay = new Date(bot.multiPeriodProcessDatetime.valueOf() - ONE_DAY_IN_MILISECONDS);
|
||||
bot.multiPeriodDailyProcessDatetime = new Date(bot.multiPeriodDailyProcessDatetime.valueOf() + ONE_DAY_IN_MILISECONDS);
|
||||
previousDay = new Date(bot.multiPeriodDailyProcessDatetime.valueOf() - ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " " + "bot.multiPeriodProcessDatetime = " + bot.multiPeriodProcessDatetime.toISOString());
|
||||
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " " + "bot.multiPeriodDailyProcessDatetime = " + bot.multiPeriodDailyProcessDatetime.toISOString());
|
||||
|
||||
if (global.WRITE_LOGS_TO_FILES === 'true') {
|
||||
logger.newInternalLoop(bot.codeName, bot.process);
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> bot.multiPeriodProcessDatetime = " + bot.multiPeriodProcessDatetime); }
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> bot.multiPeriodDailyProcessDatetime = " + bot.multiPeriodDailyProcessDatetime); }
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> previousDay = " + previousDay); }
|
||||
|
||||
/* Validation that we are not going past the head of the market. */
|
||||
|
||||
if (bot.multiPeriodProcessDatetime.valueOf() > contextVariables.dateEndOfMarket.valueOf()) {
|
||||
if (bot.multiPeriodDailyProcessDatetime.valueOf() > contextVariables.dateEndOfMarket.valueOf()) {
|
||||
|
||||
const logText = "Head of the market found @ " + previousDay.getUTCFullYear() + "/" + (previousDay.getUTCMonth() + 1) + "/" + previousDay.getUTCDate() + ".";
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> " + logText); }
|
||||
@@ -355,7 +355,7 @@
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> periodsLoop -> Entering function."); }
|
||||
|
||||
/* Telling the world we are alive and doing well */
|
||||
let processingDate = bot.multiPeriodProcessDatetime.getUTCFullYear() + '-' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCMonth() + 1, 2) + '-' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCDate(), 2);
|
||||
let processingDate = bot.multiPeriodDailyProcessDatetime.getUTCFullYear() + '-' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCMonth() + 1, 2) + '-' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCDate(), 2);
|
||||
bot.processHeartBeat(processingDate)
|
||||
|
||||
/*
|
||||
@@ -414,7 +414,7 @@
|
||||
let previousFile;
|
||||
let currentFile;
|
||||
|
||||
if (bot.multiPeriodProcessDatetime.valueOf() > contextVariables.dateBeginOfMarket.valueOf()) {
|
||||
if (bot.multiPeriodDailyProcessDatetime.valueOf() > contextVariables.dateBeginOfMarket.valueOf()) {
|
||||
getPreviousFile();
|
||||
} else {
|
||||
previousFile = [];
|
||||
@@ -497,7 +497,7 @@
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> periodsLoopBody -> dependencyLoopBody -> getCurrentFile -> Entering function."); }
|
||||
|
||||
let dateForPath = bot.multiPeriodProcessDatetime.getUTCFullYear() + '/' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.multiPeriodProcessDatetime.getUTCDate(), 2);
|
||||
let dateForPath = bot.multiPeriodDailyProcessDatetime.getUTCFullYear() + '/' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCDate(), 2);
|
||||
let filePath
|
||||
if (dependency.dataSet === "Multi-Period-Daily") {
|
||||
filePath = dependency.product + '/' + dependency.dataSet + "/" + outputPeriodLabel + "/" + dateForPath;
|
||||
@@ -604,7 +604,7 @@
|
||||
dataFiles,
|
||||
timePeriod,
|
||||
outputPeriodLabel,
|
||||
bot.multiPeriodProcessDatetime,
|
||||
bot.multiPeriodDailyProcessDatetime,
|
||||
contextVariables.dateBeginOfMarket,
|
||||
contextVariables.dateEndOfMarket,
|
||||
interExecutionMemoryArray[n],
|
||||
@@ -673,7 +673,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
writeStatusReport(bot.multiPeriodProcessDatetime, advanceTime);
|
||||
writeStatusReport(bot.multiPeriodDailyProcessDatetime, advanceTime);
|
||||
|
||||
} catch (err) {
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriods -> controlLoop -> onWritten -> err = "+ err.stack);
|
||||
@@ -708,7 +708,7 @@
|
||||
|
||||
let folderName = bot.products[productIndex].codeName;
|
||||
|
||||
writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodProcessDatetime, folderName, controlLoop);
|
||||
writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodDailyProcessDatetime, folderName, controlLoop);
|
||||
}
|
||||
|
||||
function controlLoop() {
|
||||
|
||||
@@ -138,9 +138,9 @@
|
||||
const FILE_STORAGE = require('./FileStorage.js');
|
||||
let fileStorage = FILE_STORAGE.newFileStorage();
|
||||
|
||||
let filePath = global.TASK_NODE.bot.processes[processIndex].code.team + '/bots/' + global.TASK_NODE.bot.processes[processIndex].code.repo + '/this.bot.config.json';
|
||||
let filePath = global.TASK_NODE.bot.code.team + '/bots/' + global.TASK_NODE.bot.code.repo + '/this.bot.config.json';
|
||||
|
||||
fileStorage.getTextFile(global.TASK_NODE.bot.processes[processIndex].code.team, filePath, onFileReceived);
|
||||
fileStorage.getTextFile(global.TASK_NODE.bot.code.team, filePath, onFileReceived);
|
||||
|
||||
function onFileReceived(err, text) {
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
|
||||
try {
|
||||
botConfig = JSON.parse(text);
|
||||
botConfig.repo = global.TASK_NODE.bot.processes[processIndex].code.repo;
|
||||
botConfig.repo = global.TASK_NODE.bot.code.repo;
|
||||
findProcess(processIndex);
|
||||
} catch (err) {
|
||||
console.log(logDisplace + "Root : [ERROR] start -> getBotConfig -> onInizialized -> onFileReceived -> err = " + JSON.stringify(err));
|
||||
|
||||
+45
-1
@@ -163,7 +163,7 @@
|
||||
bot.VALUES_TO_USE.baseAsset = code.name;
|
||||
}
|
||||
|
||||
if (baseAsset === 'BTC') {
|
||||
if (bot.VALUES_TO_USE.baseAsset === 'BTC') {
|
||||
if (code.initialBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.initialBalanceA = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceB = 0
|
||||
@@ -264,6 +264,50 @@
|
||||
if (bot.SESSION !== undefined) {
|
||||
if (bot.SESSION.parameters !== undefined) {
|
||||
|
||||
/* Base Asset and Initial Balances. */
|
||||
{
|
||||
if (bot.SESSION.parameters.baseAsset !== undefined) {
|
||||
let code
|
||||
try {
|
||||
code = JSON.parse(bot.SESSION.parameters.baseAsset.code);
|
||||
|
||||
if (code.name !== undefined) {
|
||||
bot.VALUES_TO_USE.baseAsset = code.name;
|
||||
}
|
||||
|
||||
if (bot.VALUES_TO_USE.baseAsset === 'BTC') {
|
||||
if (code.initialBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.initialBalanceA = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceB = 0
|
||||
}
|
||||
if (code.minimumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.minimumBalanceA = code.minimumBalance;
|
||||
bot.VALUES_TO_USE.minimumBalanceB = 0
|
||||
}
|
||||
if (code.maximumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.maximumBalanceA = code.maximumBalance;
|
||||
bot.VALUES_TO_USE.maximumBalanceB = 0
|
||||
}
|
||||
} else {
|
||||
if (code.initialBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.initialBalanceB = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceA = 0
|
||||
}
|
||||
if (code.minimumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.minimumBalanceB = code.minimumBalance;
|
||||
bot.VALUES_TO_USE.minimumBalanceA = 0
|
||||
}
|
||||
if (code.maximumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.maximumBalanceB = code.maximumBalance;
|
||||
bot.VALUES_TO_USE.maximumBalanceA = 0
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
parentLogger.write(MODULE_NAME, "[WARN] initialize -> startLiveTrading -> Invalid Base Asset Value -> err = " + err.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Time Period */
|
||||
if (bot.SESSION.parameters.timePeriod !== undefined) {
|
||||
bot.VALUES_TO_USE.timePeriod = bot.SESSION.parameters.timePeriod.code
|
||||
|
||||
+8
-10
@@ -35,6 +35,7 @@
|
||||
let month;
|
||||
let year;
|
||||
let timePath = '';
|
||||
let sessionPath = ''
|
||||
|
||||
return thisObject;
|
||||
|
||||
@@ -49,10 +50,12 @@
|
||||
month = pMonth;
|
||||
year = pYear;
|
||||
|
||||
if (bot.SESSION !== undefined && pOwner.type === "Trading Engine") {
|
||||
sessionPath = bot.SESSION.id + "/"
|
||||
}
|
||||
|
||||
if (owner.dataSetSection === "Month") {
|
||||
|
||||
logger.fileName = MODULE_NAME + "." + pOwner.bot + "." + pOwner.process + "." + year + "." + month;
|
||||
|
||||
timePath = "/" + year + "/" + month;
|
||||
}
|
||||
|
||||
@@ -113,15 +116,10 @@
|
||||
let botId = bot.devTeam + "-" + bot.codeName + "-" + bot.version.major + "-" + bot.version.minor + "-" + bot.process + "-" + bot.dataSetVersion;
|
||||
|
||||
if (ownerId !== botId) {
|
||||
|
||||
let rootPath = owner.devTeam + "/" + owner.bot + "." + owner.botVersion.major + "." + owner.botVersion.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + owner.dataSetVersion;
|
||||
|
||||
filePath = rootPath + "/Reports/" + owner.process + timePath;
|
||||
|
||||
filePath = rootPath + "/Reports/" + sessionPath + owner.process + timePath;
|
||||
} else {
|
||||
|
||||
filePath = bot.filePathRoot + "/Reports/" + owner.process + timePath;
|
||||
|
||||
filePath = bot.filePathRoot + "/Reports/" + sessionPath + owner.process + timePath;
|
||||
}
|
||||
|
||||
if (owner.type === 'Trading') {
|
||||
@@ -213,7 +211,7 @@
|
||||
}
|
||||
|
||||
let fileName = "Status.Report." + global.MARKET.assetA + '_' + global.MARKET.assetB + ".json";
|
||||
let filePath = bot.filePathRoot + "/Reports/" + owner.process + timePath;
|
||||
let filePath = bot.filePathRoot + "/Reports/" + sessionPath + owner.process + timePath;
|
||||
|
||||
if (bot.type === 'Trading' ) {
|
||||
fileName = bot.startMode + "." + fileName;
|
||||
|
||||
@@ -72,7 +72,7 @@ if (global.TASK_NODE !== undefined) {
|
||||
|
||||
}
|
||||
else { // I use this section to debug in standalone mode.
|
||||
let argument = ' {"type":"Task","name":"Runs Backtests, Fordwardtests & Live Trades ","bot":{"type":"Trading Engine","processes":[{"type":"Process","subType":"Trading Engine Process","name":"Multi Period","code":{"team":"AAMasters","bot":"AAJason","process":"Multi-Period","repo":"AAJason-Trading-Engine-Bot"},"session":{"type":"Backtesting Session","name":"1 Hour","id":"1381b048-7795-4e60-84a4-cf02e7385ba1"},"id":"072065fc-a57c-439c-94cf-f3f9c901ed37"}]},"id":"cddc97dd-ca2d-4b14-95ce-f15b6149996f"}'
|
||||
let argument = '{"type":"Task","name":"Runs Backtests","bot":{"type":"Trading Engine","code":{"team":"AAMasters","bot":"AAJason","repo":"AAJason-Trading-Engine-Bot"},"processes":[{"type":"Process","subType":"Trading Engine Process","name":"Multi Period","code":{"process":"Multi-Period"},"session":{"type":"Backtesting Session","name":"10 Minutes","id":"121202ea-6735-4bf3-8a95-aaa55f00f6e7"},"id":"3f483482-d8a1-4755-ba50-7cac6296fa5f"}],"id":"25fe9099-b53d-4757-8a63-3f8a15875f33"},"id":"5b21d2d2-0f52-4408-83eb-ddaa844ec58c"}'
|
||||
/* charly argument = '{"type":"Task","name":"Brings Trades Records from the Exchange","bot":{"type":"Sensor","name":"Charly","processes":[{"type":"Process","name":"Live Trades","code":{"team":"AAMasters","bot":"AACharly","process":"Live-Trades"},"id":"5846ebc7-1979-4a80-9cc7-94bb4b8659dc"},{"type":"Process","name":"Hole Fixing","code":{"team":"AAMasters","bot":"AACharly","process":"Hole-Fixing"},"id":"31fc4f05-75d4-419a-9fb0-73e25e856f15"}]},"id":"5bfef4dc-54c1-44db-ace6-1ab27a86746e"}'
|
||||
// olivia argument = '{"type":"Task","name":"Generates 1 min to 24 hs Candles & Volumes","bot":{"type":"Indicator","name":"Olivia","processes":[{"type":"Process","name":"Daily","code":{"team":"AAMasters","bot":"AAOlivia","process":"Multi-Period-Daily"},"id":"68cc8e1b-e94a-477e-82d0-15ecc9f1b9e2"},{"type":"Process","name":"Market","code":{"team":"AAMasters","bot":"AAOlivia","process":"Multi-Period-Market"},"id":"e1ac5e3d-d491-4e90-baf4-d4e5b71a8b1a"}]},"id":"efe36e05-75ea-41b5-8d92-c6b27635c834"}'
|
||||
// bruce argument = ' {"type":"Task","name":"Converts Trades into 1 min Candles & Volumes","bot":{"type":"Indicator","name":"Bruce","processes":[{"type":"Process","name":"New Process","code":{"team":"AAMasters","bot":"AABruce","process":"Single-Period-Daily"},"id":"e184744f-5de0-41c1-ad4c-36960f4ced90"}]},"id":"42758590-a7bd-4712-a5c9-80a3a820c5b3"}'
|
||||
@@ -127,7 +127,7 @@ global.EXIT_NODE_PROCESS = function exitProcess() {
|
||||
|
||||
/* Delete the event handler for each process. */
|
||||
|
||||
let key = code.team + "-" + code.bot + "-" + code.process
|
||||
let key = global.TASK_NODE.bot.code.team + "-" + global.TASK_NODE.bot.code.bot + "-" + code.process
|
||||
|
||||
global.SYSTEM_EVENT_HANDLER.deleteEventHandler(key)
|
||||
|
||||
@@ -174,13 +174,13 @@ function bootLoader() {
|
||||
|
||||
/* Validate that the minimun amount of parameters required are defined. */
|
||||
|
||||
if (global.TASK_NODE.bot.processes[processIndex].code.bot === undefined) {
|
||||
console.log("[INFO] Task Server -> server -> bootLoader -> Parameter 'bot' is undefined. This process will not be executed. -> Process = " + global.TASK_NODE.bot.processes[processIndex].name);
|
||||
if (global.TASK_NODE.bot.code.bot === undefined) {
|
||||
console.log("[INFO] Task Server -> server -> bootLoader -> Parameter 'bot' at the Indicator | Sensor | Trading Engine is undefined. This process will not be executed. -> Process = " + global.TASK_NODE.bot.processes[processIndex].name);
|
||||
continue
|
||||
}
|
||||
|
||||
if (global.TASK_NODE.bot.processes[processIndex].code.team === undefined) {
|
||||
console.log("[INFO] Task Server -> server -> bootLoader -> Parameter 'team' is undefined. This process will not be executed. -> Process = " + global.TASK_NODE.bot.processes[processIndex].name);
|
||||
if (global.TASK_NODE.bot.code.team === undefined) {
|
||||
console.log("[INFO] Task Server -> server -> bootLoader -> Parameter 'team' at the bot is undefined. This process will not be executed. -> Process = " + global.TASK_NODE.bot.processes[processIndex].name);
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -191,11 +191,11 @@ function bootLoader() {
|
||||
|
||||
/* Create the event handler for each process. This event handlers are where the status reports updated events are raised. */
|
||||
|
||||
let key = code.team + "-" + code.bot + "-" + code.process
|
||||
let key = global.TASK_NODE.bot.code.team + "-" + global.TASK_NODE.bot.code.bot + "-" + code.process
|
||||
global.SYSTEM_EVENT_HANDLER.createEventHandler(key)
|
||||
|
||||
if (global.TASK_NODE.bot.processes[processIndex].code.repo === undefined) {
|
||||
global.TASK_NODE.bot.processes[processIndex].code.repo = global.TASK_NODE.bot.processes[processIndex].code.bot + "-" + global.TASK_NODE.bot.type + "-Bot"
|
||||
if (global.TASK_NODE.bot.code.repo === undefined) {
|
||||
global.TASK_NODE.bot.code.repo = global.TASK_NODE.bot.code.bot + "-" + global.TASK_NODE.bot.type + "-Bot"
|
||||
}
|
||||
|
||||
startRoot(processIndex);
|
||||
|
||||
Reference in new issue
Block a user