Trading Mine implementation
This commit is contained in:
1 parent
d62169462f
commit
79c2e0eadd
28 files changed
+1563
-384
No files matched your search
@@ -57,8 +57,7 @@
|
||||
processThisDependsOn = bot.processNode.referenceParent.executionStartedEvent.referenceParent.parentNode
|
||||
|
||||
name = processThisDependsOn.name
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true)
|
||||
{ logger.write(MODULE_NAME, "[INFO] initialize -> " + currentProcessKey + " based on the Data Mine depends on " + name); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> " + currentProcessKey + " based on the Data Mine depends on " + name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,8 +71,7 @@
|
||||
processThisDependsOn = bot.processNode.executionStartedEvent.referenceParent.parentNode
|
||||
|
||||
name = processThisDependsOn.name
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true)
|
||||
{ logger.write(MODULE_NAME, "[INFO] initialize -> " + currentProcessKey + " based on the User's Task depends on " + name); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> " + currentProcessKey + " based on the User's Task depends on " + name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,48 +97,50 @@
|
||||
for (let i = 0; i < network.networkNodes.length; i++) {
|
||||
let networkNode = network.networkNodes[i]
|
||||
if (networkNode.dataMining !== undefined) {
|
||||
for (let j = 0; j < networkNode.dataMining.exchangeTasks.length; j++) {
|
||||
let exchangeTasks = networkNode.dataMining.exchangeTasks[j]
|
||||
for (let k = 0; k < exchangeTasks.taskManagers.length; k++) {
|
||||
let taskManager = exchangeTasks.taskManagers[k]
|
||||
for (let m = 0; m < taskManager.tasks.length; m++) {
|
||||
let task = taskManager.tasks[m]
|
||||
if (task.bot !== undefined) {
|
||||
for (let n = 0; n < task.bot.processes.length; n++) {
|
||||
let process = task.bot.processes[n]
|
||||
if (process.marketReference !== undefined) {
|
||||
if (process.marketReference.referenceParent !== undefined) {
|
||||
let market = process.marketReference.referenceParent
|
||||
let currentProcessMarket = bot.processNode.marketReference.referenceParent
|
||||
for (let j = 0; j < networkNode.dataMining.exchangeDataTasks.length; j++) {
|
||||
let exchangeTasks = networkNode.dataMining.exchangeDataTasks[j]
|
||||
for (let p = 0; p < exchangeTasks.marketDataTasks.length; p++) {
|
||||
let marketTasks = exchangeTasks.marketDataTasks[p]
|
||||
if (marketTasks.referenceParent === undefined) { continue }
|
||||
if (marketTasks.referenceParent.id !== global.MARKET_NODE.id) { continue }
|
||||
for (let q = 0; q < marketTasks.dataMineTasks.length; q++) {
|
||||
let mineTasks = marketTasks.dataMineTasks[q]
|
||||
for (let k = 0; k < mineTasks.taskManagers.length; k++) {
|
||||
let taskManager = mineTasks.taskManagers[k]
|
||||
for (let m = 0; m < taskManager.tasks.length; m++) {
|
||||
let task = taskManager.tasks[m]
|
||||
if (task.bot !== undefined) {
|
||||
for (let n = 0; n < task.bot.processes.length; n++) {
|
||||
let process = task.bot.processes[n]
|
||||
if (process.referenceParent !== undefined) {
|
||||
let processDefinition = process.referenceParent
|
||||
if (processThisDependsOn.id === processDefinition.id) {
|
||||
/*
|
||||
We found where the task that runs the process definition
|
||||
we are waiting for is located on the network.
|
||||
*/
|
||||
thisObject.networkNode = networkNode
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) {
|
||||
logger.write(MODULE_NAME,
|
||||
"[INFO] initialize -> Connecting to Websockets Server " + networkNode.name +
|
||||
" -> host = " + networkNode.config.host +
|
||||
' -> port = ' + networkNode.config.webSocketsPort + '.');
|
||||
}
|
||||
|
||||
if (currentProcessMarket.id === market.id) {
|
||||
if (process.referenceParent !== undefined) {
|
||||
let processDefinition = process.referenceParent
|
||||
if (processThisDependsOn.id === processDefinition.id) {
|
||||
eventServerClient = EVENT_SERVER_CLIENT.newEventsServerClient(networkNode.config.host, networkNode.config.webSocketsPort)
|
||||
eventServerClient.initialize(onConnected)
|
||||
|
||||
/* We found where the task that runs the process definition we are waiting for is located on the network. */
|
||||
|
||||
thisObject.networkNode = networkNode
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) {
|
||||
logger.write(MODULE_NAME,
|
||||
"[INFO] initialize -> Connecting to Websockets Server " + networkNode.name +
|
||||
" -> host = " + networkNode.config.host +
|
||||
' -> port = ' + networkNode.config.webSocketsPort + '.'); }
|
||||
|
||||
eventServerClient = EVENT_SERVER_CLIENT.newEventsServerClient(networkNode.config.host, networkNode.config.webSocketsPort)
|
||||
eventServerClient.initialize(onConnected)
|
||||
|
||||
function onConnected() {
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) {
|
||||
logger.write(MODULE_NAME, "[INFO] initialize -> Connected to Websockets Server " + networkNode.name +
|
||||
" -> host = " + networkNode.config.host +
|
||||
' -> port = ' + networkNode.config.webSocketsPort + '.'); }
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return
|
||||
function onConnected() {
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) {
|
||||
logger.write(MODULE_NAME, "[INFO] initialize -> Connected to Websockets Server " + networkNode.name +
|
||||
" -> host = " + networkNode.config.host +
|
||||
' -> port = ' + networkNode.config.webSocketsPort + '.');
|
||||
}
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user