FILE STORAGE done

This commit is contained in:
Luis Fernando Molina committed 2020-12-02 10:54:50 +01:00
1 parent 7515fd910e
commit 185f1b8f13
22 files changed
+54 -50

No files matched your search

+6
View File
@@ -433,6 +433,12 @@
"propertyName": "eventServerClient",
"functionName": "newSuperalgosTaskModulesEventServerClient",
"fileName": "EventServerClient.js"
},
{
"name": "File Storage",
"propertyName": "fileStorage",
"functionName": "newSuperalgosTaskModulesFileStorage",
"fileName": "FileStorage.js"
}
],
"processModules": [
@@ -1,4 +1,4 @@
exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE) {
exports.newUserBot = function (processIndex, COMMONS) {
const FULL_LOG = true;
const INTENSIVE_LOG = false;
@@ -21,7 +21,7 @@
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let statusDependencies;
let beginingOfMarket
@@ -1,4 +1,4 @@
exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE) {
exports.newUserBot = function (processIndex, COMMONS) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
@@ -18,7 +18,7 @@
let statusDependencies;
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
return thisObject;
@@ -1,4 +1,4 @@
exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE) {
exports.newUserBot = function (processIndex, COMMONS) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
@@ -23,7 +23,7 @@
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let statusDependencies;
let beginingOfMarket
@@ -1,4 +1,4 @@
exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE) {
exports.newUserBot = function (processIndex, COMMONS) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
@@ -23,7 +23,7 @@
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let statusDependencies;
let beginingOfMarket
@@ -1,5 +1,5 @@
exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE, EXCHANGE_API) {
exports.newUserBot = function (processIndex, COMMONS, EXCHANGE_API) {
const FULL_LOG = true;
const GMT_SECONDS = ':00.000 GMT+0000';
@@ -13,7 +13,7 @@ exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE, EXCHANGE_API
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let statusDependencies
const ONE_MIN = 60000
@@ -1,5 +1,5 @@
exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE, EXCHANGE_API) {
exports.newUserBot = function (processIndex, COMMONS, EXCHANGE_API) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
@@ -14,7 +14,7 @@ exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE, EXCHANGE_API
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let statusDependencies
const ONE_MINUTE = 60000
@@ -1,5 +1,5 @@
exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE, EXCHANGE_API) {
exports.newUserBot = function (processIndex, COMMONS, EXCHANGE_API) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
@@ -12,7 +12,7 @@ exports.newUserBot = function (processIndex, COMMONS, FILE_STORAGE, EXCHANGE_API
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let statusDependencies
return thisObject;
@@ -13,7 +13,7 @@ exports.newSuperalgosProcessModulesDataset = function (processIndex) {
/* Storage account to be used here. */
const FILE_STORAGE = require('./FileStorage.js');
let fileStorage
return thisObject;
@@ -91,7 +91,7 @@ exports.newSuperalgosProcessModulesDataset = function (processIndex) {
/* We found where the data is located on the network. */
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE.write(MODULE_NAME, "[INFO] initialize -> Retrieving data from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.')
fileStorage = FILE_STORAGE.newFileStorage(processIndex, networkNode.config.host, networkNode.config.webPort);
fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex, networkNode.config.host, networkNode.config.webPort);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE, true);
} catch (err) {
@@ -30,7 +30,7 @@
/* Storage account to be used here. */
const FILE_STORAGE = require('./FileStorage.js');
let fileStorage
let sessionPath = ''
@@ -153,7 +153,7 @@
thisObject.networkNode = networkNode
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE.write(MODULE_NAME, "[INFO] initialize -> Retrieving status report from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.')
fileStorage = FILE_STORAGE.newFileStorage(processIndex, networkNode.config.host, networkNode.config.webPort)
fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex, networkNode.config.host, networkNode.config.webPort)
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
return true
}
@@ -204,7 +204,7 @@
thisObject.networkNode = networkNode
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE.write(MODULE_NAME, "[INFO] initialize -> Retrieving status report from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.')
fileStorage = FILE_STORAGE.newFileStorage(processIndex, networkNode.config.host, networkNode.config.webPort)
fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex, networkNode.config.host, networkNode.config.webPort)
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
return true
}
File renamed without changes.
+2 -2
View File
@@ -1,4 +1,4 @@
exports.newCommons = function (processIndex, FILE_STORAGE) {
exports.newCommons = function (processIndex) {
const MODULE_NAME = "Commons";
@@ -13,7 +13,7 @@
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
return thisObject;
+2 -2
View File
@@ -93,8 +93,8 @@ exports.newDebugLog = function (processIndex) {
let contentToPersist = accumulatedLog;
accumulatedLog = "[";
const FILE_STORAGE = require('./FileStorage.js');
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let filePath = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT + "/Logs/" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.config.codeName + "/"
+5 -5
View File
@@ -7,8 +7,8 @@
const MULTI_PERIOD_MARKET = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'MultiPeriodMarket');
const MULTI_PERIOD_DAILY = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'MultiPeriodDaily');
const FILE_STORAGE = require('./FileStorage.js');
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
const DEBUG_MODULE = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'DebugLog');
@@ -287,12 +287,12 @@
switch (processConfig.framework.name) {
case 'Multi-Period-Market': {
processFramework = MULTI_PERIOD_MARKET.newMultiPeriodMarket(processIndex, FILE_STORAGE);
processFramework = MULTI_PERIOD_MARKET.newMultiPeriodMarket(processIndex);
intitializeProcessFramework();
break;
}
case 'Multi-Period-Daily': {
processFramework = MULTI_PERIOD_DAILY.newMultiPeriodDaily(processIndex, FILE_STORAGE);
processFramework = MULTI_PERIOD_DAILY.newMultiPeriodDaily(processIndex);
intitializeProcessFramework();
break;
}
@@ -344,7 +344,7 @@
function initializeUserBot() {
try {
usertBot = USER_BOT_MODULE.newUserBot(processIndex, COMMONS_MODULE, FILE_STORAGE);
usertBot = USER_BOT_MODULE.newUserBot(processIndex, COMMONS_MODULE);
usertBot.initialize(statusDependencies, onInizialized);
function onInizialized(err) {
+3 -3
View File
@@ -1,4 +1,4 @@
exports.newIndicatorOutput = function (processIndex, FILE_STORAGE) {
exports.newIndicatorOutput = function (processIndex) {
const MODULE_NAME = "Indicator Bot";
let thisObject = {
@@ -8,10 +8,10 @@
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
const COMMONS = require('./Commons.js');
let commons = COMMONS.newCommons(processIndex, FILE_STORAGE);
let commons = COMMONS.newCommons(processIndex);
return thisObject;
+1 -2
View File
@@ -294,8 +294,7 @@ exports.newSnapshots = function (processIndex) {
function writeSnapshotFile(snapshotArray, pFileName) {
try {
const FILE_STORAGE = require('../FileStorage.js');
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let fileContent = "";
let separator = "\r\n";
@@ -1,4 +1,4 @@
exports.newTradingOutput = function (processIndex, tradingEngineModule, FILE_STORAGE) {
exports.newTradingOutput = function (processIndex, tradingEngineModule) {
/*
This module will load if necesary all the data outputs so that they can be appended with new
records if needed. After running the simulation, it will save all the data outputs.
@@ -12,7 +12,7 @@ exports.newTradingOutput = function (processIndex, tradingEngineModule, FILE_STO
}
let fileStorage = FILE_STORAGE.newFileStorage(processIndex)
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex)
return thisObject
@@ -20,14 +20,13 @@
let dataFiles = new Map();
let multiPeriodDataFiles = new Map();
const FILE_STORAGE = require('../FileStorage.js');
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
const TRADING_ENGINE_MODULE = require('./TradingEngine.js')
let tradingEngineModule = TRADING_ENGINE_MODULE.newTradingEngine(processIndex)
let TRADING_OUTPUT_MODULE = require("./TradingOutput")
let tradingOutputModule = TRADING_OUTPUT_MODULE.newTradingOutput(processIndex, tradingEngineModule, FILE_STORAGE)
let tradingOutputModule = TRADING_OUTPUT_MODULE.newTradingOutput(processIndex, tradingEngineModule)
let processConfig;
@@ -550,7 +549,7 @@
function buildCharts(chart) {
const COMMONS = require('../Commons.js')
let commons = COMMONS.newCommons(processIndex, FILE_STORAGE)
let commons = COMMONS.newCommons(processIndex)
let mainDependency = {}
+3 -3
View File
@@ -1,4 +1,4 @@
exports.newMultiPeriodDaily = function (processIndex, FILE_STORAGE) {
exports.newMultiPeriodDaily = function (processIndex) {
const MODULE_NAME = "Multi Period Daily";
const GMT_SECONDS = ':00.000 GMT+0000';
@@ -9,7 +9,7 @@
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex)
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex)
let statusDependencies;
let dataDependenciesModule;
@@ -31,7 +31,7 @@
let INDICATOR_OUTPUT_MODULE = require("./IndicatorOutput")
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, FILE_STORAGE)
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex)
indicatorOutputModule.initialize(callBackFunction)
}
+3 -3
View File
@@ -1,4 +1,4 @@
exports.newMultiPeriodMarket = function (processIndex, FILE_STORAGE) {
exports.newMultiPeriodMarket = function (processIndex) {
const MODULE_NAME = "Multi Period Market";
thisObject = {
initialize: initialize,
@@ -7,7 +7,7 @@
};
let fileStorage = FILE_STORAGE.newFileStorage(processIndex)
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex)
let statusDependencies;
let dataDependenciesModule;
@@ -27,7 +27,7 @@
let INDICATOR_OUTPUT_MODULE = require("./IndicatorOutput")
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, FILE_STORAGE)
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex)
indicatorOutputModule.initialize(callBackFunction)
}
+3 -3
View File
@@ -5,8 +5,8 @@
let USER_BOT_MODULE;
let COMMONS_MODULE;
const FILE_STORAGE = require('./FileStorage.js');
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
const DEBUG_MODULE = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'DebugLog');
@@ -277,7 +277,7 @@
function initializeUserBot() {
try {
usertBot = USER_BOT_MODULE.newUserBot(processIndex, COMMONS_MODULE, FILE_STORAGE, exchangeAPI);
usertBot = USER_BOT_MODULE.newUserBot(processIndex, COMMONS_MODULE, exchangeAPI);
usertBot.initialize(statusDependencies, onInizialized);
function onInizialized(err) {
+2 -2
View File
@@ -4,10 +4,10 @@
const FULL_LOG = true;
const TRADING_PROCESS_MODULE = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + '/LowFrequencyTrading/TradingProcess.js');
const FILE_STORAGE = require('./FileStorage.js');
const SESSION = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'TradingSession');
let fileStorage = FILE_STORAGE.newFileStorage(processIndex);
let fileStorage = TS.projects.superalgos.taskModules.fileStorage.newFileStorage(processIndex);
let session = SESSION.newTradingSession(processIndex)
const DEBUG_MODULE = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + 'DebugLog');