Tested with Olivia running well
This commit is contained in:
1 parent
ed1c4f075f
commit
fda24f934c
7 files changed
+56
-34
No files matched your search
Binary file not shown.
+4
-4
@@ -27,7 +27,7 @@
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pDependenciesConfig, callBackFunction) {
|
||||
function initialize(pDependenciesConfig, pMonth, pYear, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
let statusReportModule = STATUS_REPORT.newStatusReport(BOT, DEBUG_MODULE, FILE_STORAGE, UTILITIES);
|
||||
|
||||
statusReportModule.initialize(pDependenciesConfig[i], onInitilized);
|
||||
statusReportModule.initialize(pDependenciesConfig[i], pMonth, pYear, onInitilized);
|
||||
|
||||
function onInitilized(err) {
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
switch (err.result) {
|
||||
case global.DEFAULT_OK_RESPONSE.result: {
|
||||
logger.write("[INFO] initialize -> onLoad -> Execution finished well. :-)");
|
||||
logger.write("[INFO] initialize -> onLoad -> Execution finished well -> bot = " + pDependenciesConfig[i].bot);
|
||||
|
||||
addReport();
|
||||
return;
|
||||
@@ -80,7 +80,7 @@
|
||||
if (err.message === "Status Report was never created.") {
|
||||
|
||||
logger.write("[ERROR] initialize -> onLoad -> err.message = " + err.message);
|
||||
logger.write("[ERROR] initialize -> onLoad -> pDependenciesConfig[i] = " + JSON.stringify(pDependenciesConfig[i]));
|
||||
logger.write("[ERROR] initialize -> onLoad -> Report Not Found. -> bot = " + pDependenciesConfig[i].bot);
|
||||
addReport();
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function run(callBackFunction) {
|
||||
function run(pMonth, pYear, callBackFunction) {
|
||||
|
||||
try {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> Entering function."); }
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
dependencies = DEPENDENCIES.newDependencies(bot, DEBUG_MODULE, STATUS_REPORT, FILE_STORAGE, UTILITIES);
|
||||
|
||||
dependencies.initialize(processConfig.dependencies, onInizialized);
|
||||
dependencies.initialize(processConfig.dependencies, pMonth, pYear, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
usertBot = USER_BOT_MODULE.newUserBot(bot, COMMONS_MODULE, UTILITIES, DEBUG_MODULE, FILE_STORAGE, STATUS_REPORT, POLONIEX_CLIENT_MODULE);
|
||||
|
||||
usertBot.initialize(dependencies, onInizialized, undefined, undefined);
|
||||
usertBot.initialize(dependencies, pMonth, pYear, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function run(callBackFunction) {
|
||||
function run(pMonth, pYear, callBackFunction) {
|
||||
|
||||
try {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> Entering function."); }
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
dependencies = DEPENDENCIES.newDependencies(bot, DEBUG_MODULE, STATUS_REPORT, FILE_STORAGE, UTILITIES);
|
||||
|
||||
dependencies.initialize(processConfig.dependencies, onInizialized);
|
||||
dependencies.initialize(processConfig.dependencies, pMonth, pYear, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
usertBot = USER_BOT_MODULE.newUserBot(bot, COMMONS_MODULE, UTILITIES, DEBUG_MODULE, FILE_STORAGE);
|
||||
|
||||
usertBot.initialize(dependencies, onInizialized, undefined, undefined);
|
||||
usertBot.initialize(dependencies, pMonth, pYear, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<Name>Project</Name>
|
||||
<ScriptArguments>Multi-Period-Market</ScriptArguments>
|
||||
<ScriptArguments>Multi-Period-Daily</ScriptArguments>
|
||||
<NodeExePath>C:\Program Files\nodejs\node.exe</NodeExePath>
|
||||
<StartWebBrowser>False</StartWebBrowser>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -148,6 +148,13 @@ global.FILE_PATH_ROOT = botConfig.devTeam + "/" + botConfig.codeName + "." + bot
|
||||
|
||||
global.loopCointer = 0;
|
||||
|
||||
/* Small Function to fix numbers into strings in a cool way. */
|
||||
|
||||
function pad(str, max) {
|
||||
str = str.toString();
|
||||
return str.length < max ? pad("0" + str, max) : str;
|
||||
}
|
||||
|
||||
/* Some LAGACY code starts here. Pending for clean up. */
|
||||
|
||||
const INTERVAL_EXECUTOR_MODULE = require('./Interval Executor');
|
||||
@@ -215,24 +222,25 @@ for (let i = 0; i < botConfig.processes.length; i++) {
|
||||
|
||||
if (processConfig.startMode.noTime.run === "true") {
|
||||
|
||||
startProcess();
|
||||
|
||||
function startProcess() {
|
||||
switch (bot.type) {
|
||||
case 'Extraction': {
|
||||
runExtractionBot(processConfig);
|
||||
return;
|
||||
}
|
||||
case 'Indicator': {
|
||||
runIndicatorBot(processConfig);
|
||||
return;
|
||||
}
|
||||
case 'Trading': {
|
||||
runTradingBot(processConfig);
|
||||
return;
|
||||
}
|
||||
let month = pad((new Date()).getUTCMonth() + 1, 2);
|
||||
let year = (new Date()).getUTCFullYear();
|
||||
|
||||
switch (bot.type) {
|
||||
case 'Extraction': {
|
||||
runExtractionBot(processConfig, month, year);
|
||||
return;
|
||||
}
|
||||
case 'Indicator': {
|
||||
runIndicatorBot(processConfig, month, year);
|
||||
return;
|
||||
}
|
||||
case 'Trading': {
|
||||
runTradingBot(processConfig);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
@@ -242,7 +250,7 @@ for (let i = 0; i < botConfig.processes.length; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
function runExtractionBot(pProcessConfig) {
|
||||
function runExtractionBot(pProcessConfig, pMonth, pYear) {
|
||||
|
||||
try {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runExtractionBot -> Entering function."); }
|
||||
@@ -254,7 +262,7 @@ function runExtractionBot(pProcessConfig) {
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
extractionBotMainLoop.run(whenRunFinishes);
|
||||
extractionBotMainLoop.run(pMonth, pYear, whenRunFinishes);
|
||||
|
||||
function whenRunFinishes(err) {
|
||||
|
||||
@@ -282,7 +290,7 @@ function runExtractionBot(pProcessConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
function runIndicatorBot(pProcessConfig) {
|
||||
function runIndicatorBot(pProcessConfig, pMonth, pYear) {
|
||||
|
||||
try {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runIndicatorBot -> Entering function."); }
|
||||
@@ -294,7 +302,7 @@ function runIndicatorBot(pProcessConfig) {
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
indicatorBotMainLoop.run(whenRunFinishes);
|
||||
indicatorBotMainLoop.run(pMonth, pYear, whenRunFinishes);
|
||||
|
||||
function whenRunFinishes(err) {
|
||||
|
||||
|
||||
+18
-4
@@ -35,17 +35,31 @@
|
||||
|
||||
let cloudStorage = FILE_STORAGE.newFileStorage(bot);
|
||||
|
||||
let month;
|
||||
let year;
|
||||
let timePath = '';
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pOwner, callBackFunction) {
|
||||
function initialize(pOwner, pMonth, pYear, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
logger.fileName = MODULE_NAME + "." + pOwner.bot;
|
||||
|
||||
owner = pOwner;
|
||||
month = pMonth;
|
||||
year = pYear;
|
||||
|
||||
if (owner.dataSetSection === "Month") {
|
||||
|
||||
logger.fileName = MODULE_NAME + "." + pOwner.bot + "." + year + "." + month;
|
||||
|
||||
timePath = "/" + year + "/" + month;
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
owner = pOwner;
|
||||
|
||||
initializeStorage();
|
||||
|
||||
@@ -80,7 +94,7 @@
|
||||
|
||||
let rootPath = owner.devTeam + "/" + owner.bot + "." + owner.botVersion.major + "." + owner.botVersion.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + owner.dataSetVersion;
|
||||
let fileName = "Status.Report.json"
|
||||
let filePath = rootPath + "/Reports/" + owner.process;
|
||||
let filePath = rootPath + "/Reports/" + owner.process + timePath;
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> load -> fileName = " + fileName); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> load -> filePath = " + filePath); }
|
||||
@@ -159,7 +173,7 @@
|
||||
}
|
||||
|
||||
let fileName = "Status.Report.json"
|
||||
let filePath = global.FILE_PATH_ROOT + "/Reports/" + owner.process;
|
||||
let filePath = global.FILE_PATH_ROOT + "/Reports/" + owner.process + timePath;
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] save -> fileName = " + fileName); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] save -> filePath = " + filePath); }
|
||||
|
||||
Reference in new issue
Block a user