Dataset.js fully debugged

This commit is contained in:
Luis Fernando Molina committed 2021-02-02 17:32:27 +01:00
1 parent 5fbb451d33
commit d524e237a4
3 files changed
+50 -39

No files matched your search

@@ -108,9 +108,6 @@
TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName +
"-" +
TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName
thisObject.filters.exchange.list.set(thisObject.defaultExchange, true)
thisObject.filters.exchange.markets.set(thisObject.defaultExchange + '-' + thisObject.defautMarket, true)
thisObject.filters.market.list.set(true)
/*
For each dependency declared at the curatedDependencyNodeArray, we will initialize a DataSet as part of this initialization process.
*/
@@ -184,47 +181,51 @@
*/
let product = dataDependency.referenceParent.parentNode.config.singularVariableName
if (thisObject.filters.products.get(exchange + '-' + market + '-' + product) !== true) {
if (thisObject.filters.exchange.products.get(exchange + '-' + market + '-' + product) !== true) {
continue
}
addDataSets(exchange, market)
addDataSet(exchange, market)
} else {
addDataSet(exchange, market)
}
let dataSetModule = TS.projects.superalgos.processModules.dataset.newSuperalgosProcessModulesDataset(processIndex)
dataSetModule.initialize(exchange, market, dataDependency, onInitilized)
function addDataSet(exchange, market) {
let dataSetModule = TS.projects.superalgos.processModules.dataset.newSuperalgosProcessModulesDataset(processIndex)
dataSetModule.initialize(exchange, market, dataDependency, onInitilized)
function onInitilized(err, wasInitialized) {
function onInitilized(err, wasInitialized) {
if (err.result !== TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> err = " + JSON.stringify(err))
if (err.result !== TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> err = " + JSON.stringify(err))
alreadyCalledBack = true
callBackFunction(err)
return
}
if (wasInitialized === true) {
addCount++
newNodeArray.push(thisObject.curatedDependencyNodeArray[i])
addDataSet()
} else {
skipCount++
}
checkIfWeAreDone()
}
function addDataSet() {
thisObject.dataSetsModulesArray.push(dataSetModule)
}
function checkIfWeAreDone() {
if (addCount + skipCount === thisObject.curatedDependencyNodeArray.length) {
if (alreadyCalledBack === false) {
alreadyCalledBack = true
thisObject.curatedDependencyNodeArray = newNodeArray
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
callBackFunction(err)
return
}
if (wasInitialized === true) {
addCount++
newNodeArray.push(thisObject.curatedDependencyNodeArray[i])
addDataSet()
} else {
skipCount++
}
checkIfWeAreDone()
}
function addDataSet() {
thisObject.dataSetsModulesArray.push(dataSetModule)
}
function checkIfWeAreDone() {
if (addCount + skipCount === thisObject.curatedDependencyNodeArray.length) {
if (alreadyCalledBack === false) {
alreadyCalledBack = true
thisObject.curatedDependencyNodeArray = newNodeArray
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
return
}
}
}
}
}
@@ -280,7 +280,7 @@ exports.newSuperalgosProcessModulesDataset = function (processIndex) {
if (startingNode.referenceParent.parentNode.parentNode === undefined) {
return
}
if (startingNode.referenceParent.parentNode.parentNode.codeName !== exchange) {
if (startingNode.referenceParent.parentNode.parentNode.config.codeName !== exchange) {
return
}
}
@@ -292,14 +292,18 @@ exports.newSuperalgosProcessModulesDataset = function (processIndex) {
switch (property.type) {
case 'node': {
scanNodeMesh(startingNode[property.name])
if (found !== true) {
scanNodeMesh(startingNode[property.name])
}
}
break
case 'array': {
let startingNodePropertyArray = startingNode[property.name]
if (startingNodePropertyArray !== undefined) {
for (let m = 0; m < startingNodePropertyArray.length; m++) {
scanNodeMesh(startingNodePropertyArray[m])
if (found !== true) {
scanNodeMesh(startingNodePropertyArray[m])
}
}
}
break
@@ -309,11 +313,15 @@ exports.newSuperalgosProcessModulesDataset = function (processIndex) {
}
/* We scan parents nodes. */
if (startingNode.parentNode !== undefined) {
scanNodeMesh(startingNode.parentNode)
if (found !== true) {
scanNodeMesh(startingNode.parentNode)
}
}
/* We scan reference parents too. */
if (startingNode.referenceParent !== undefined) {
scanNodeMesh(startingNode.referenceParent)
if (found !== true) {
scanNodeMesh(startingNode.referenceParent)
}
}
}
}
@@ -158,6 +158,8 @@ function newSuperalgosFunctionLibraryTaskFunctions() {
'Project Data Products->Project Trading Products->Project Learning Products->' +
'Exchange Data Products->Exchange Trading Products->Exchange Learning Products->' +
'Market Data Products->Market Trading Products->Market Learning Products->' +
'Market->Market Base Asset->Market Quoted Asset->Asset->' +
'Exchange Markets->Crypto Exchange->' +
'Data Mine Products->Bot Products->' +
'Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->' +
'Data Product->Product Definition->' +