ETH Balnaces implemented

This commit is contained in:
Luis Fernando Molina committed 2020-11-19 13:06:12 +01:00
1 parent 9bf8c2eed6
commit 6784e6bd0b
42 files changed
+979 -669

No files matched your search

+2 -2
View File
@@ -126,9 +126,9 @@ try {
console.log("What's new? The following is being implemented here:")
console.log('')
console.log('Multi-Project Infrastructure ....... This will allow us to integrate crypto projects into Superalgos.')
console.log('Machine Learning Infrastructure .... This will enable a new kind of Learning Bot that can learn from data mined. Later that knowledge can be used at trading strategies.')
console.log('Machine Learning Infrastructure .... This will enable a new kind of Bot that can learn from data mined. Later that knowledge can be used at trading strategies.')
console.log('Ethereum Integration ............... This will allow mining data from an Ethereum network node, create indicators with it, an use it on strategies.')
console.log('')
} catch (err) {
console.log('[ERROR] Client -> Error = ' + err.stack)
+145 -113
View File
@@ -54,39 +54,39 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
}
function onBrowserRequest(request, response) {
if (CONSOLE_LOG === true && request.url.indexOf('NO-LOG') === -1) { console.log('[INFO] httpInterface -> onBrowserRequest -> request.url = ' + request.url) }
function onBrowserRequest(httpRequest, httpResponse) {
if (CONSOLE_LOG === true && httpRequest.url.indexOf('NO-LOG') === -1) { console.log('[INFO] httpInterface -> onBrowserRequest -> httpRequest.url = ' + httpRequest.url) }
function getBody(callback) { // Gets the de body from a POST request to the web server
function getBody(callback) { // Gets the de body from a POST httpRequest to the web server
try {
let body = ''
request.on('data', function (data) {
httpRequest.on('data', function (data) {
body += data
// Too much POST data
//if (body.length > 1e6) {
// request.connection.destroy()
// httpRequest.connection.destroy()
//}
})
request.on('end', function () {
httpRequest.on('end', function () {
callback(body)
})
request.on('error', function (err) {
httpRequest.on('error', function (err) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> onBrowserRequest -> getBody -> err = ' + err.stack) }
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
})
} catch (err) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> onBrowserRequest -> getBody -> err = ' + err.stack) }
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
}
}
let requestParameters = request.url.split('/')
let requestParameters = httpRequest.url.split('/')
requestParameters = request.url.split('?') // Remove version information
requestParameters = httpRequest.url.split('?') // Remove version information
requestParameters = requestParameters[0].split('/')
switch (requestParameters[1]) {
@@ -102,17 +102,38 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
switch (params.method) {
case 'getNetworkClientStatus': {
let status = await WEB3_SERVER.getNetworkClientStatus(
let serverResponse = await WEB3_SERVER.getNetworkClientStatus(
params.host,
params.port,
params.interface
)
respondWithContent(JSON.stringify(status), response)
respondWithContent(JSON.stringify(serverResponse), httpResponse)
return
}
case 'createWalletAccount': {
let serverResponse = await WEB3_SERVER.createWalletAccount(
params.entropy
)
respondWithContent(JSON.stringify(serverResponse), httpResponse)
return
}
case 'getWalletBalances': {
let serverResponse = await WEB3_SERVER.getWalletBalances(
params.host,
params.port,
params.interface,
params.walletDefinition
)
respondWithContent(JSON.stringify(serverResponse), httpResponse)
return
}
default: {
respondWithContent(JSON.stringify({ error: 'Method ' + params.method + ' is invalid.' }), response)
respondWithContent(JSON.stringify({ error: 'Method ' + params.method + ' is invalid.' }), httpResponse)
}
}
} catch (err) {
@@ -125,7 +146,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
message: err.message,
stack: err.stack
}
respondWithContent(JSON.stringify(error), response)
respondWithContent(JSON.stringify(error), httpResponse)
}
}
break
@@ -157,7 +178,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
if (ccxtExchange.has.fetchMarkets === true) {
ccxtMarkets = await ccxtExchange.fetchMarkets()
}
respondWithContent(JSON.stringify(ccxtMarkets), response)
respondWithContent(JSON.stringify(ccxtMarkets), httpResponse)
return
}
case 'listExchanges': {
@@ -189,7 +210,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
}
}
respondWithContent(JSON.stringify(exchanges), response)
respondWithContent(JSON.stringify(exchanges), httpResponse)
return
}
}
@@ -203,7 +224,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
result: 'Fail Because',
message: err.message
}
respondWithContent(JSON.stringify(error), response)
respondWithContent(JSON.stringify(error), httpResponse)
}
}
break
@@ -220,12 +241,12 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
/* Some validations */
if (exchange === undefined) {
console.log('[WARN] httpInterface -> Webhook -> Fetch-Messages -> Message with no Exchange received -> messageReceived = ' + messageReceived)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
if (market === undefined) {
console.log('[WARN] httpInterface -> Webhook -> Fetch-Messages -> Message with no market received -> messageReceived = ' + messageReceived)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
@@ -236,7 +257,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
webhookMessages = []
}
respondWithContent(JSON.stringify(webhookMessages), response)
respondWithContent(JSON.stringify(webhookMessages), httpResponse)
webhookMessages = []
webhook.set(key, webhookMessages)
@@ -254,17 +275,17 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
/* Some validations */
if (source === undefined) {
console.log('[WARN] httpInterface -> Webhook -> New-Message -> Message with no Source received -> messageReceived = ' + messageReceived)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
if (exchange === undefined) {
console.log('[WARN] httpInterface -> Webhook -> New-Message -> Message with no Exchange received -> messageReceived = ' + messageReceived)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
if (market === undefined) {
console.log('[WARN] httpInterface -> Webhook -> New-Message -> Message with no market received -> messageReceived = ' + messageReceived)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
@@ -278,7 +299,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
webhookMessages.push([timestamp, source, messageReceived])
webhook.set(key, webhookMessages)
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
}
break
}
@@ -294,27 +315,27 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
rimraf.sync(process.env.STORAGE_PATH + '/Masters/Masters/AAJason.1.0')
rimraf.sync(process.env.LOG_PATH)
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
} catch (err) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> ResetLogsAndData -> Could not delete Logs and Data.') }
let error = {
result: 'Fail Because',
message: err.message
}
respondWithContent(JSON.stringify(error), response)
respondWithContent(JSON.stringify(error), httpResponse)
}
break
}
case 'LegacyPlotter.js':
{
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/LegacyPlotter.js', response)
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/LegacyPlotter.js', httpResponse)
}
break
case 'PlotterPanel.js':
{
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/PlotterPanel.js', response)
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/PlotterPanel.js', httpResponse)
}
break
@@ -336,7 +357,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
path = unescape(path)
respondWithImage(path, response)
respondWithImage(path, httpResponse)
}
break
@@ -357,25 +378,25 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
path = unescape(path)
respondWithImage(path, response)
respondWithImage(path, httpResponse)
}
break
case 'favicon.ico': // This means the Scripts folder.
{
respondWithImage(process.env.PATH_TO_CLIENT + 'WebServer/Images/' + 'favicon.ico', response)
respondWithImage(process.env.PATH_TO_CLIENT + 'WebServer/Images/' + 'favicon.ico', httpResponse)
}
break
case 'WebServer': // This means the WebServer folder.
{
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/' + requestParameters[2], response)
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/' + requestParameters[2], httpResponse)
}
break
case 'externalScripts': // This means the WebServer folder.
{
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/externalScripts/' + requestParameters[2], response)
respondWithFile(process.env.PATH_TO_CLIENT + 'WebServer/externalScripts/' + requestParameters[2], httpResponse)
}
break
@@ -385,7 +406,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let codeName = requestParameters[3]
let moduleName = requestParameters[4]
let filePath = process.env.PLOTTERS_PATH + '/' + dataMine + '/plotters/' + codeName + '/' + moduleName
respondWithFile(filePath, response)
respondWithFile(filePath, httpResponse)
}
break
@@ -395,32 +416,32 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let codeName = requestParameters[3]
let moduleName = requestParameters[4]
let filePath = process.env.PLOTTERS_PATH + '/' + dataMine + '/plotters/' + codeName + '/' + moduleName
respondWithFile(filePath, response)
respondWithFile(filePath, httpResponse)
}
break
case 'ChartLayers':
{
respondWithFile(process.env.PATH_TO_UI + '/' + requestParameters[1] + '/' + requestParameters[2], response)
respondWithFile(process.env.PATH_TO_UI + '/' + requestParameters[1] + '/' + requestParameters[2], httpResponse)
}
break
case 'Files':
{
respondWithFile(process.env.PATH_TO_DATA_FILES + '/' + requestParameters[2], response)
respondWithFile(process.env.PATH_TO_DATA_FILES + '/' + requestParameters[2], httpResponse)
}
break
case 'Fonts':
{
respondWithFont(process.env.PATH_TO_FONTS + '/' + requestParameters[2], response)
respondWithFont(process.env.PATH_TO_FONTS + '/' + requestParameters[2], httpResponse)
}
break
case 'ProjectNames':
{
let projects = getDirectories(process.env.PROJECTS_PATH)
respondWithContent(JSON.stringify(projects), response)
respondWithContent(JSON.stringify(projects), httpResponse)
}
break
@@ -452,7 +473,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
projectCounter++
if (projectCounter === totalProjects) {
respondWithContent(JSON.stringify(icons), response)
respondWithContent(JSON.stringify(icons), httpResponse)
}
})
}
@@ -468,7 +489,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let folder = process.env.PROJECTS_PATH + '/' + project + '/Plugins/' + pluginType
fs.readdir(folder, (err, files) => {
respondWithContent(JSON.stringify(files), response)
respondWithContent(JSON.stringify(files), httpResponse)
})
}
break
@@ -479,7 +500,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let pluginType = unescape(requestParameters[3])
let fileName = unescape(requestParameters[4])
let filePath = process.env.PROJECTS_PATH + '/' + project + '/Plugins/' + pluginType + '/' + fileName
respondWithFile(filePath, response)
respondWithFile(filePath, httpResponse)
}
break
@@ -496,10 +517,10 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function onFileRead(err, workspace) {
if (err) {
respondWithContent(undefined, response)
respondWithContent(undefined, httpResponse)
} else {
let responseContent = 'function getWorkspace(){ return ' + workspace + '}'
respondWithContent(responseContent, response)
respondWithContent(responseContent, httpResponse)
}
}
}
@@ -523,7 +544,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function onDirRead(err, fileList) {
if (err) {
if (CONSOLE_ERROR_LOG === true) { console.log('[WARN] Error reading a directory content. filePath = ' + dirPath) }
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
} else {
let updatedFileList = []
@@ -542,7 +563,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
} catch (err) {
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] Error reading a directory content. filePath = ' + dirPath) }
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] err.stack = ' + err.stack) }
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
}
@@ -557,23 +578,23 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function onDirRead(err, fileList) {
if (err) {
if (CONSOLE_ERROR_LOG === true) { console.log('[WARN] Error reading a directory content. filePath = ' + dirPath) }
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
} else {
let updatedFileList = []
for (let i = 0; i < fileList.length; i++) {
let name = fileList[i]
updatedFileList.push(['', name])
}
for (let i = 0; i < fileList.length; i++) {
let name = fileList[i]
updatedFileList.push(['', name])
}
allWorkspaces = allWorkspaces.concat(updatedFileList)
respondWithContent(JSON.stringify(allWorkspaces), response)
respondWithContent(JSON.stringify(allWorkspaces), httpResponse)
return
}
}
} catch (err) {
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] Error reading a directory content. filePath = ' + dirPath) }
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] err.stack = ' + err.stack) }
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
}
@@ -584,7 +605,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
{
let fileName = unescape(requestParameters[2])
let filePath = process.env.MY_WORKSPACES_PATH + '/' + fileName + '.json'
respondWithFile(filePath, response)
respondWithFile(filePath, httpResponse)
}
break
@@ -611,16 +632,28 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function onFileWritten(err) {
if (err) {
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] Error writting the Workspace file. fileName = ' + fileName) }
respondWithContent(JSON.stringify(exchanges), response)
console.log('[ERROR] SaveWorkspace -> onFileWritten -> Error writting the Workspace file. fileName = ' + fileName)
console.log('[ERROR] SaveWorkspace -> onFileWritten -> err.stack = ' + err.stack)
let error = {
result: 'Fail Because',
message: err.message,
stack: err.stack
}
respondWithContent(JSON.stringify(error), httpResponse)
} else {
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
}
}
} catch (err) {
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] Error writting the Workspace file. fileName = ' + fileName) }
respondWithContent(JSON.stringify(exchanges), response)
console.log('[ERROR] SaveWorkspace -> Error writting the Workspace file. fileName = ' + fileName)
console.log('[ERROR] SaveWorkspace -> err.stack = ' + err.stack)
let error = {
result: 'Fail Because',
message: err.message,
stack: err.stack
}
respondWithContent(JSON.stringify(error), httpResponse)
}
}
}
@@ -635,7 +668,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
case 'ProjectsSchema':
{
let path = process.env.PROJECTS_PATH + '/' + 'ProjectsSchema.json'
respondWithFile(path, response)
respondWithFile(path, httpResponse)
}
break
@@ -672,7 +705,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function onDirRead(err, fileList) {
if (err) {
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
} else {
let updatedFileList = []
for (let k = 0; k < fileList.length; k++) {
@@ -683,7 +716,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
allFiles = allFiles.concat(updatedFileList)
dirCount++
if (dirCount === totalDirs) {
respondWithContent(JSON.stringify(allFiles), response)
respondWithContent(JSON.stringify(allFiles), httpResponse)
}
}
}
@@ -692,7 +725,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] err.stack = ' + err.stack) }
console.log(err.stack)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
}
@@ -723,13 +756,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
let filePath = process.env.PROJECTS_PATH + path
respondWithFile(filePath, response)
respondWithFile(filePath, httpResponse)
}
break
case 'Storage':
{
respondWithFile(process.env.STORAGE_PATH + '/' + request.url.substring(9), response)
respondWithFile(process.env.STORAGE_PATH + '/' + httpRequest.url.substring(9), httpResponse)
}
break
@@ -784,7 +817,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
allLibraries = allLibraries.concat(updatedFileList)
projectsCount++
if (projectsCount === projects.length) {
respondWithContent(JSON.stringify(allLibraries), response)
respondWithContent(JSON.stringify(allLibraries), httpResponse)
}
return
}
@@ -793,7 +826,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] Error reading a directory content. filePath = ' + dirPath) }
if (CONSOLE_ERROR_LOG === true) { console.log('[ERROR] err.stack = ' + err.stack) }
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), response)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
}
@@ -827,9 +860,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function onFileRead(err, schema) {
if (err) {
respondWithContent(undefined, response)
respondWithContent(undefined, httpResponse)
} else {
respondWithContent(schema, response)
respondWithContent(schema, httpResponse)
}
}
}
@@ -847,7 +880,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
fileContent = fileContent.replace('HTTP_INTERFACE_PORT', process.env.HTTP_INTERFACE_PORT)
fileContent = fileContent.replace('HTTP_INTERFACE_PORT', process.env.HTTP_INTERFACE_PORT)
fileContent = fileContent.replace('HTTP_INTERFACE_PORT', process.env.HTTP_INTERFACE_PORT)
respondWithContent(fileContent, response, 'text/css')
respondWithContent(fileContent, httpResponse, 'text/css')
} catch (err) {
console.log('[ERROR] httpInterface -> mainCSS -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
}
@@ -869,7 +902,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let fileContent = file.toString()
fileContent = fileContent.replace('HTTP_INTERFACE_PORT', process.env.HTTP_INTERFACE_PORT)
respondWithContent(fileContent, response)
respondWithContent(fileContent, httpResponse)
} catch (err) {
console.log('[ERROR] httpInterface -> homePage -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
}
@@ -878,17 +911,16 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
console.log(err)
}
} else {
respondWithFile(process.env.PATH_TO_UI + '/' + requestParameters[1], response)
respondWithFile(process.env.PATH_TO_UI + '/' + requestParameters[1], httpResponse)
}
}
}
function respondWithFile(fileName, response) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> respondWithFile -> Entering function.') }
function respondWithFile(fileName, httpResponse) {
let fs = require('fs')
if (fileName.indexOf('undefined') > 0) {
console.log('[WRN] httpInterface -> respondWithFile -> Received request for undefined file. ')
respondWithContent(undefined, response)
console.log('[WRN] httpInterface -> respondWithFile -> Received httpRequest for undefined file. ')
respondWithContent(undefined, httpResponse)
} else {
try {
fs.readFile(fileName, onFileRead)
@@ -896,10 +928,10 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function onFileRead(err, file) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> respondWithFile -> onFileRead -> Entering function.') }
if (!err) {
respondWithContent(file.toString(), response)
respondWithContent(file.toString(), httpResponse)
} else {
//console.log('File requested not found: ' + fileName)
respondWithContent(undefined, response)
respondWithContent(undefined, httpResponse)
}
}
} catch (err) {
@@ -908,33 +940,33 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
}
function respondWithContent(content, response, contentType) {
function respondWithContent(content, httpResponse, contentType) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> respondWithContent -> Entering function.') }
try {
response.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
response.setHeader('Pragma', 'no-cache') // HTTP 1.0.
response.setHeader('Expires', '0') // Proxies.
response.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
httpResponse.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
if (content !== undefined) {
if (contentType !== undefined) {
response.writeHead(200, { 'Content-Type': contentType })
httpResponse.writeHead(200, { 'Content-Type': contentType })
} else {
response.writeHead(200, { 'Content-Type': 'text/html' })
httpResponse.writeHead(200, { 'Content-Type': 'text/html' })
}
response.write(content)
httpResponse.write(content)
} else {
response.writeHead(404, { 'Content-Type': 'text/html' })
response.write('The specified key does not exist.')
httpResponse.writeHead(404, { 'Content-Type': 'text/html' })
httpResponse.write('The specified key does not exist.')
}
response.end('\n')
httpResponse.end('\n')
} catch (err) {
returnEmptyArray(response)
returnEmptyArray(httpResponse)
}
}
function respondWithImage(fileName, response) {
function respondWithImage(fileName, httpResponse) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> respondWithImage -> Entering function.') }
let fs = require('fs')
@@ -947,13 +979,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
return
}
try {
response.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
response.setHeader('Pragma', 'no-cache') // HTTP 1.0.
response.setHeader('Expires', '0') // Proxies.
response.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
httpResponse.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
response.writeHead(200, { 'Content-Type': 'image/png' })
response.end(file, 'binary')
httpResponse.writeHead(200, { 'Content-Type': 'image/png' })
httpResponse.end(file, 'binary')
} catch (err) {
console.log('[ERROR] httpInterface -> respondWithImage -> onFileRead -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
}
@@ -963,7 +995,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
}
function respondWithFont(fileName, response) {
function respondWithFont(fileName, httpResponse) {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> respondWithBinary -> Entering function.') }
let fs = require('fs')
@@ -978,17 +1010,17 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
console.log('[ERROR] httpInterface -> respondWithBinary -> onFileRead -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
return
}
response.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
response.setHeader('Pragma', 'no-cache') // HTTP 1.0.
response.setHeader('Expires', '0') // Proxies.
response.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
httpResponse.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
if (fileName.indexOf('2') < 0) {
response.writeHead(200, { 'Content-Type': 'font/woff' })
httpResponse.writeHead(200, { 'Content-Type': 'font/woff' })
} else {
response.writeHead(200, { 'Content-Type': 'font/woff2' })
httpResponse.writeHead(200, { 'Content-Type': 'font/woff2' })
}
response.end(file, 'binary')
httpResponse.end(file, 'binary')
} catch (err) {
console.log('[ERROR] httpInterface -> respondWithBinary -> onFileRead -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
}
@@ -998,16 +1030,16 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
}
function returnEmptyArray(response) {
function returnEmptyArray(httpResponse) {
try {
if (CONSOLE_LOG === true) { console.log('[INFO] httpInterface -> returnEmptyArray -> Entering function.') }
response.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
response.setHeader('Pragma', 'no-cache') // HTTP 1.0.
response.setHeader('Expires', '0') // Proxies.
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
response.writeHead(200, { 'Content-Type': 'text/html' })
response.write('[]')
response.end('\n')
httpResponse.writeHead(200, { 'Content-Type': 'text/html' })
httpResponse.write('[]')
httpResponse.end('\n')
} catch (err) {
console.log('[ERROR] httpInterface -> returnEmptyArray -> err.stack ' + err.stack)
}
+105 -25
View File
@@ -4,6 +4,8 @@ exports.newWeb3Server = function newWeb3Server() {
let thisObject = {
getNetworkClientStatus: getNetworkClientStatus,
createWalletAccount: createWalletAccount,
getWalletBalances: getWalletBalances,
initialize: initialize,
finalize: finalize,
run: run
@@ -35,30 +37,11 @@ exports.newWeb3Server = function newWeb3Server() {
if (web3 === undefined) {
/* This means that we never got connected to this client before */
switch (interface) {
case 'ws': {
web3 = new Web3('ws://' + host + ':' + port + '');
break
}
case 'http': {
web3 = new Web3('http://' + host + ':' + port + '');
break
}
default: {
return { error: 'Interface parameter must be eithre ws or http. Received ' + interface }
}
}
return await testConnection()
async function testConnection() {
let accounts = await web3.eth.getAccounts()
if (web3.currentProvider.connected === false) {
return { error: 'Connection to ' + key + ' could not be established.' }
} else {
return await returnStatus(web3)
}
let web3 = await connectToClient(key, host, port, interface)
if (web3.error !== undefined) {
return web3
}
return await returnStatus(web3)
} else {
return await returnStatus(web3)
}
@@ -72,8 +55,105 @@ exports.newWeb3Server = function newWeb3Server() {
status.result = 'Ok'
return status
}
} catch(err) {
return { error: 'Could not connect to ' + key }
} catch (err) {
return { error: 'Could not connect to ' + key + '. ' + err.message + '.' }
}
}
async function createWalletAccount(entropy) {
try {
let web3 = new Web3()
let account = web3.eth.accounts.create()
return {
address: account.address,
privateKey: account.privateKey,
result: 'Ok'
}
} catch (err) {
return { error: 'Could not create the account. ' + err.message }
}
}
async function getWalletBalances(host, port, interface, walletDefinition) {
let key = 'host (' + host + ') at port (' + port + ') via interface (' + interface + ')'
try {
let web3 = web3Map.get(key)
if (web3 === undefined) {
/* This means that we never got connected to this client before */
let web3 = await connectToClient(key, host, port, interface)
if (web3.error !== undefined) {
return web3
}
return await returnAccountBalances(web3)
} else {
return await returnAccountBalances(web3)
}
async function returnAccountBalances(web3) {
let responseData = {}
for (let i = 0; i < walletDefinition.walletAccounts.length; i++) {
let walletAccount = walletDefinition.walletAccounts[i]
if (walletAccount.ethBalance !== undefined) {
try {
walletAccount.ethBalance.value = await web3.eth.getBalance(walletAccount.config.address)
} catch (err) {
if (err.message.indexOf('Provided address') >= 0) {
walletAccount.error = 'Invalid configured address.'
} else {
walletAccount.error = err.message
}
}
}
for (let j = 0; j < walletAccount.tokenBalances.length; j++) {
let tokenBalance = walletAccount.tokenBalances[j]
tokenBalance.value = 0
}
}
responseData.result = 'Ok'
responseData.walletDefinition = walletDefinition
return responseData
}
} catch (err) {
return { error: 'Could not connect to ' + key + '. ' + err.message + '.' }
}
}
async function connectToClient(key, host, port, interface) {
let web3
switch (interface) {
case 'ws': {
web3 = new Web3('ws://' + host + ':' + port + '');
break
}
case 'http': {
web3 = new Web3('http://' + host + ':' + port + '');
break
}
default: {
return { error: 'Interface parameter must be either ws or http. Received ' + interface }
}
}
return await testConnection()
async function testConnection() {
let accounts = await web3.eth.getAccounts()
if (web3.currentProvider.connected === false) {
return { error: 'Connection to ' + key + ' could not be established.' }
} else {
web3Map.set(key, web3)
return web3
}
}
}
}
@@ -0,0 +1,53 @@
function newEthereumFunctionLibraryAccounts() {
thisObject = {
createWalletAccount: createWalletAccount
}
return thisObject
function createWalletAccount(node) {
let walletAccountNode = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Wallet Account')
let params = {
method: 'createWalletAccount',
entropy: walletAccountNode.id
}
let url = 'WEB3' // we don't need to ask this to any specific superalgos node.
httpRequest(JSON.stringify(params), url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage('Call via HTTP Interface failed.')
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
return
}
let response = JSON.parse(data)
/* Lets check the result of the method call */
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage('Call to WEB3 Server failed. ' + response.error)
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
return
}
let config = {
address: response.address,
privateKey: response.privateKey
}
walletAccountNode.config = JSON.stringify(config, null, 4)
walletAccountNode.name =
response.address[response.address.length - 4] +
response.address[response.address.length - 3] +
response.address[response.address.length - 2] +
response.address[response.address.length - 1]
}
}
}
@@ -6,12 +6,11 @@ function newEthereumActionSwitch() {
finalize: finalize
}
let functionLibraryGeth = newGeth()
return thisObject
function finalize() {
functionLibraryGeth = undefined
}
function initialize() {
@@ -20,16 +19,8 @@ function newEthereumActionSwitch() {
async function executeAction(action) {
switch (action.name) {
case 'Install Geth': {
functionLibraryGeth.install(action.node)
break
}
case 'Run Geth': {
functionLibraryGeth.run(action.node)
break
}
case 'Stop Geth': {
functionLibraryGeth.stop(action.node)
case 'Create Wallet Account': {
UI.projects.ethereum.functionLibraries.accounts.createWalletAccount(action.node)
break
}
}
@@ -1,21 +0,0 @@
function newGeth() {
thisObject = {
install: install,
run: run,
stop: stop
}
return thisObject
function install(node) {
httpRequest('ExecuteTerminalCommand/dir')
}
function run(node) {
}
function stop(node) {
}
}
@@ -1 +1 @@
{"type":"Workspace","name":"Ethereum Integration Demo","rootNodes":[{"type":"Network","name":"My Network","project":"Superalgos","networkNodes":[{"type":"Network Node","name":"My Computer","config":"{ \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"18041\"\n}","project":"Superalgos","dataMining":{"type":"Data Mining","name":"New Data Mining","project":"Superalgos","exchangeDataTasks":[{"type":"Exchange Data Tasks","name":"Binance","project":"Superalgos","marketDataTasks":[{"type":"Market Data Tasks","name":"Binance BTC/USDT","project":"Superalgos","dataMineTasks":[{"type":"Data Mine Tasks","name":"Masters","project":"Superalgos","taskManagers":[{"type":"Task Manager","name":"Masters","project":"Superalgos","tasks":[{"type":"Task","name":"Exchange Raw Data","project":"Superalgos","bot":{"type":"Sensor Bot Instance","name":"Exchange Raw Data","config":"{ \n\"startDate\": \"2020-01-01\"\n}","project":"Superalgos","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","project":"Superalgos","id":"da7e6d2a-76d5-431c-ba48-aa98ebd2a907","savedPayload":{"position":{"x":23623.030015561097,"y":29888.16403283887},"targetPosition":{"x":23918.47234146476,"y":29836.06957953879},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"f9daa393-935e-4a9d-bdc5-706d97ac5530","savedPayload":{"position":{"x":23918.47234146476,"y":29836.06957953879},"targetPosition":{"x":24213.914667368423,"y":29783.97512623871},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"5827edbc-89f8-495a-953a-a568f2fca44e","savedPayload":{"position":{"x":24213.914667368423,"y":29783.97512623871},"targetPosition":{"x":24509.356993272086,"y":29731.88067293863},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Candles Volumes","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Candles Volumes","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"243ecbf4-cb69-42e2-9acb-b03c7c481b79","savedPayload":{"position":{"x":23619.613932037235,"y":29653.83848916277},"targetPosition":{"x":23918.47234146476,"y":29627.69176633847},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"9f683143-a33f-42c1-9fa8-c601f01ee4e1"}}},{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Daily","project":"Superalgos","id":"c90cb0e5-3e49-40ba-b919-38b0e5f7fcee","savedPayload":{"position":{"x":23646.580005353764,"y":29500.906287816262},"targetPosition":{"x":23918.47234146476,"y":29627.69176633847},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"ac31f04b-4d79-4e18-9262-1a9a933b6156","savedPayload":{"position":{"x":23918.47234146476,"y":29627.69176633847},"targetPosition":{"x":24213.914667368423,"y":29679.78621963855},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"46c3f665-a9e2-46dc-b569-2a928d2067af","savedPayload":{"position":{"x":24213.914667368423,"y":29679.78621963855},"targetPosition":{"x":24509.356993272086,"y":29731.88067293863},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Bollinger Bands","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Bollinger Bands","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Bollinger Bands Multi-Period-Market","project":"Superalgos","id":"12498614-646b-411c-9c82-747bacb8d7a6","savedPayload":{"position":{"x":23699.9640031147,"y":29354.234959407873},"targetPosition":{"x":23989.74175100142,"y":29431.88067293863},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"941a0543-0cc0-4a5d-a782-728d2835c100"}}},{"typeLine truncated
{"type":"Workspace","name":"Ethereum Integration Demo","rootNodes":[{"type":"Network","name":"My Network","project":"Superalgos","networkNodes":[{"type":"Network Node","name":"My Computer","config":"{ \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"18041\"\n}","project":"Superalgos","dataMining":{"type":"Data Mining","name":"New Data Mining","project":"Superalgos","exchangeDataTasks":[{"type":"Exchange Data Tasks","name":"Binance","project":"Superalgos","marketDataTasks":[{"type":"Market Data Tasks","name":"Binance BTC/USDT","project":"Superalgos","dataMineTasks":[{"type":"Data Mine Tasks","name":"Masters","project":"Superalgos","taskManagers":[{"type":"Task Manager","name":"Masters","project":"Superalgos","tasks":[{"type":"Task","name":"Exchange Raw Data","project":"Superalgos","bot":{"type":"Sensor Bot Instance","name":"Exchange Raw Data","config":"{ \n\"startDate\": \"2017-01-01\"\n}","project":"Superalgos","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","project":"Superalgos","id":"da7e6d2a-76d5-431c-ba48-aa98ebd2a907","savedPayload":{"position":{"x":23623.030015561097,"y":29888.16403283887},"targetPosition":{"x":23918.47234146476,"y":29836.06957953879},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"f9daa393-935e-4a9d-bdc5-706d97ac5530","savedPayload":{"position":{"x":23918.47234146476,"y":29836.06957953879},"targetPosition":{"x":24213.914667368423,"y":29783.97512623871},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"5827edbc-89f8-495a-953a-a568f2fca44e","savedPayload":{"position":{"x":24213.914667368423,"y":29783.97512623871},"targetPosition":{"x":24509.356993272086,"y":29731.88067293863},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Candles Volumes","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Candles Volumes","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"243ecbf4-cb69-42e2-9acb-b03c7c481b79","savedPayload":{"position":{"x":23619.613932037235,"y":29653.83848916277},"targetPosition":{"x":23918.47234146476,"y":29627.69176633847},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"9f683143-a33f-42c1-9fa8-c601f01ee4e1"}}},{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Daily","project":"Superalgos","id":"c90cb0e5-3e49-40ba-b919-38b0e5f7fcee","savedPayload":{"position":{"x":23646.580005353764,"y":29500.906287816262},"targetPosition":{"x":23918.47234146476,"y":29627.69176633847},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"ac31f04b-4d79-4e18-9262-1a9a933b6156","savedPayload":{"position":{"x":23918.47234146476,"y":29627.69176633847},"targetPosition":{"x":24213.914667368423,"y":29679.78621963855},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"46c3f665-a9e2-46dc-b569-2a928d2067af","savedPayload":{"position":{"x":24213.914667368423,"y":29679.78621963855},"targetPosition":{"x":24509.356993272086,"y":29731.88067293863},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Bollinger Bands","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Bollinger Bands","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Bollinger Bands Multi-Period-Market","project":"Superalgos","id":"12498614-646b-411c-9c82-747bacb8d7a6","savedPayload":{"position":{"x":23699.9640031147,"y":29354.234959407873},"targetPosition":{"x":23989.74175100142,"y":29431.88067293863},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"941a0543-0cc0-4a5d-a782-728d2835c100"}}},{"typeLine truncated
@@ -48,22 +48,15 @@
"menuItems": [
{
"action": "Add UI Object",
"label": "Add Network Reference",
"label": "Add Client Reference",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "networkReference",
"relatedUiObject": "Network Reference",
"propertyToCheckFor": "networkClientReference",
"relatedUiObject": "Network Client Reference",
"actionFunction": "payload.executeAction"
},
{
"action": "Add UI Object",
"label": "Add Wallet Keys",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "walletKeys",
"relatedUiObject": "Wallet Keys",
"actionFunction": "payload.executeAction"
},
{
"action": "Add UI Object",
"action": "Create Wallet Account",
"actionProject": "Ethereum",
"label": "Add Wallet Account",
"relatedUiObject": "Wallet Account",
"actionFunction": "payload.executeAction"
@@ -83,19 +76,13 @@
"level": 0,
"properties": [
{
"name": "networkReference",
"name": "networkClientReference",
"type": "node",
"childType": "Network Reference",
"childType": "Network Client Reference",
"autoAdd": true
},
{
"name": "walletKeys",
"type": "node",
"childType": "Wallet Keys",
"autoAdd": true
},
{
"name": "walletAccount",
"name": "walletAccounts",
"type": "array",
"childType": "Wallet Account"
}
@@ -103,7 +90,7 @@
"icon": "ethereum"
},
{
"type": "Network Reference",
"type": "Network Client Reference",
"menuItems": [
{
"action": "Delete UI Object",
@@ -116,53 +103,18 @@
}
],
"title": [
"Use Reference Parent Parent",
"Use Reference Parent"
],
"referenceAttachesTo": {
"compatibleTypes": "->Blockchain Network->"
"compatibleTypes": "->Network Client->"
},
"addLeftIcons": true,
"level": 3,
"chainAttachesTo": {
"compatibleTypes": "->Ethereum Wallet->"
},
"propertyNameAtParent": "networkReference",
"icon": "ethereum"
},
{
"type": "Wallet Keys",
"menuItems": [
{
"action": "Configure",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration",
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete",
"iconPathOff": "delete",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{ \n\"privateKey\": \"\", \n\"publicKey\": \"\"\n}"
},
"addLeftIcons": true,
"level": 3,
"chainAttachesTo": {
"compatibleTypes": "->Ethereum Wallet->"
},
"propertyNameAtParent": "walletKeys",
"isPersonalData": true,
"propertyNameAtParent": "networkClientReference",
"icon": "ethereum"
},
{
@@ -204,14 +156,14 @@
"config": true
},
"initialValues": {
"config": "{ \n\"value\": \"\"\n}"
"config": "{ \n\"address\": \"\", \n\"privateKey\": \"\"\n}"
},
"addLeftIcons": true,
"level": 3,
"level": 0,
"chainAttachesTo": {
"compatibleTypes": "->Ethereum Wallet->"
},
"propertyNameAtParent": "walletAccount",
"propertyNameAtParent": "walletAccounts",
"properties": [
{
"name": "ethBalance",
@@ -219,12 +171,13 @@
"childType": "ETH Balance"
},
{
"name": "tokenBalance",
"name": "tokenBalances",
"type": "array",
"childType": "Token Balance"
}
],
"icon": "ethereum"
"icon": "ethereum",
"isPersonalData": true
},
{
"type": "ETH Balance",
@@ -271,7 +224,7 @@
"chainAttachesTo": {
"compatibleTypes": "->Wallet Account->"
},
"propertyNameAtParent": "tokenBalance",
"propertyNameAtParent": "tokenBalances",
"icon": "ethereum"
},
{
@@ -57,47 +57,13 @@ function newEthereumBlockchainSpace() {
for (let j = 0; j < blockchainNetwork.networkClients.length; j++) {
let networkClient = blockchainNetwork.networkClients[j]
let config = JSON.parse(networkClient.config)
if (config.host === undefined) {
networkClient.payload.uiObject.setErrorMessage('Property host not defined at node config.')
continue
}
if (config.httpPort === undefined && config.webSocketsPort === undefined) {
networkClient.payload.uiObject.setErrorMessage('Property httpPort or webSocketsPort must be defined at node config.')
continue
}
let route = UI.projects.ethereum.utilities.routeToClient.buildRouteToClient(networkClient)
/* Web Sockets would be the default protocol */
let clientPort
let clientInterface
if (config.webSocketsPort !== undefined) {
clientInterface = 'ws'
clientPort = config.webSocketsPort
} else {
clientInterface = 'http'
clientPort = config.httpPort
}
if (route === undefined) { continue } // something went wrong building the route.
let params = {
method: 'getNetworkClientStatus',
host: config.host,
port: clientPort,
interface: clientInterface
}
route.params.method = 'getNetworkClientStatus'
/*
Next, we will check which Superalgos Network Node we need as a gateway
to the Ethereum Client. We will use the current node reference parent for that.
*/
if (networkClient.payload.referenceParent === undefined) {
networkClient.payload.uiObject.setErrorMessage('You need to reference a Superalgos Network Node so that it acts as a gateway to the Ethereum Client.')
return
}
let networkNodeConfig = JSON.parse(networkClient.payload.referenceParent.config)
let url = 'http://' + networkNodeConfig.host + ':' + networkNodeConfig.webPort + '/' + 'WEB3'
httpRequest(JSON.stringify(params), url, onResponse)
httpRequest(JSON.stringify(route.params), route.url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
@@ -129,13 +95,13 @@ function newEthereumBlockchainSpace() {
if (status.chainId > 0) {
let networkName = UI.projects.ethereum.globals.chainIds.chainNameById(status.chainId)
networkClient.payload.uiObject.setStatus('Connected to ' + networkName + ' via the ' + clientInterface + ' interface, through ' + networkClient.payload.referenceParent.name + ' Network Node.', ANNIMATION_CYCLES_TO_LAST)
networkClient.payload.uiObject.setStatus('Connected to ' + networkName + ' via the ' + route.params.interface + ' interface, through ' + networkClient.payload.referenceParent.name + ' Network Node.', ANNIMATION_CYCLES_TO_LAST)
networkClient.payload.uiObject.valueAtAngle = false
networkClient.payload.uiObject.setValue(
'Current Block Number ' + splitLargeNumber(status.currentBlockNumber)
, 200)
networkClient.payload.uiObject.setPercentage('100.00', ANNIMATION_CYCLES_TO_LAST)
'Current Block Number ' + splitLargeNumber(status.currentBlockNumber)
, 200)
networkClient.payload.uiObject.setPercentage('100.00', ANNIMATION_CYCLES_TO_LAST)
return
}
@@ -193,7 +159,7 @@ function newEthereumBlockchainSpace() {
}
}
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] checkStatus -> err = ' + err.stack) }
console.log('[ERROR] checkStatus -> err = ' + err.stack)
}
}
}
@@ -1,10 +1,10 @@
function newEthereumWalletSpace() {
const MODULE_NAME = 'Wallet Space'
let thisObject = {
container: undefined,
physics: physics,
draw: draw,
draw: draw,
getContainer: getContainer,
finalize: finalize,
initialize: initialize
@@ -13,6 +13,8 @@ function newEthereumWalletSpace() {
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
let lastTryToReconnectDatetime
return thisObject
function finalize() {
@@ -26,7 +28,122 @@ function newEthereumWalletSpace() {
}
function physics() {
walletBalancesPhysics()
}
async function walletBalancesPhysics() {
/* We will query the node only every 3 seconds */
if (lastTryToReconnectDatetime === undefined) {
checkBalances()
lastTryToReconnectDatetime = (new Date()).valueOf()
} else {
let now = (new Date()).valueOf()
if (now - lastTryToReconnectDatetime > 3000) {
checkBalances()
lastTryToReconnectDatetime = now
}
}
async function checkBalances() {
try {
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
let wallets = []
let hierarchyHeads = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeads()
for (let i = 0; i < hierarchyHeads.length; i++) {
let hierarchyHead = hierarchyHeads[i]
if (hierarchyHead.type === 'Ethereum Wallet') {
wallets.push(hierarchyHead)
}
}
for (let i = 0; i < wallets.length; i++) {
let wallet = wallets[i]
if (wallet.networkClientReference === undefined) {
wallet.payload.uiObject.setWarningMessage('A Network Client Reference is needed in order to fetch Account Balances from a Network Client.')
continue
}
if (wallet.networkClientReference.payload === undefined) {
// node exists without payload, probably has been deleted.
continue
}
if (wallet.networkClientReference.payload.referenceParent === undefined) {
wallet.networkClientReference.payload.uiObject.setWarningMessage('A reference to a Network Client is needed in order to fetch Account Balances from a Network Client.')
continue
}
let networkClient = wallet.networkClientReference.payload.referenceParent
let route = UI.projects.ethereum.utilities.routeToClient.buildRouteToClient(networkClient)
if (route === undefined) { continue } // something went wrong building the route.
route.params.method = 'getWalletBalances'
let lightingPath = '' +
'Ethereum Wallet->' +
'Wallet Account->' +
'ETH Balance->' +
'Token Balance->' +
'Ethereum Token->' +
'ERC-20 Token Type->ERC-223 Token Type->ERC-721 Token Type->ERC-777 Token Type->'
route.params.walletDefinition = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(wallet, false, true, true, false, false, lightingPath)
httpRequest(JSON.stringify(route.params), route.url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
networkClient.payload.uiObject.setErrorMessage('Call via HTTP Interface failed.')
return
}
let response = JSON.parse(data)
/* Lets check the result of the method call */
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
networkClient.payload.uiObject.setErrorMessage('Call to WEB3 Server failed. ' + response.error)
return
}
showBalances(response.walletDefinition)
}
function showBalances(walletDefinition) {
for (let i = 0; i < walletDefinition.walletAccounts.length; i++) {
let walletAccount = walletDefinition.walletAccounts[i]
if (walletAccount.ethBalance !== undefined) {
let uiObject = wallet.walletAccounts[i].ethBalance.payload.uiObject
if (walletAccount.error !== undefined) {
uiObject.setErrorMessage(walletAccount.error)
} else {
let value = walletAccount.ethBalance.value / 1000000000000000000
uiObject.valueAtAngle = false
uiObject.setValue(value + ' ETH')
}
}
for (let j = 0; j < walletAccount.tokenBalances.length; j++) {
let tokenBalance = walletAccount.tokenBalances[j]
let uiObject = wallet.walletAccounts[i].tokenBalances[j].payload.uiObject
uiObject.valueAtAngle = false
uiObject.setValue(tokenBalance.value + ' ' + uiObject.payload.node.name)
}
}
}
}
} catch (err) {
console.log('[ERROR] checkBalances -> err = ' + err.stack)
}
}
}
function getContainer(point) {
@@ -40,6 +157,6 @@ function newEthereumWalletSpace() {
}
function draw() {
}
}
}
Whitespace-only changes.
@@ -0,0 +1,53 @@
function newEthereumUtilitiesRouteToClient() {
thisObject = {
buildRouteToClient: buildRouteToClient
}
return thisObject
function buildRouteToClient(networkClient) {
let config = JSON.parse(networkClient.config)
if (config.host === undefined) {
networkClient.payload.uiObject.setErrorMessage('Property host not defined at node config.')
return
}
if (config.httpPort === undefined && config.webSocketsPort === undefined) {
networkClient.payload.uiObject.setErrorMessage('Property httpPort or webSocketsPort must be defined at node config.')
return
}
/* Web Sockets would be the default protocol */
let clientPort
let clientInterface
if (config.webSocketsPort !== undefined) {
clientInterface = 'ws'
clientPort = config.webSocketsPort
} else {
clientInterface = 'http'
clientPort = config.httpPort
}
let params = {
host: config.host,
port: clientPort,
interface: clientInterface
}
/*
Next, we will check which Superalgos Network Node we need as a gateway
to the Ethereum Client. We will use the current node reference parent for that.
*/
if (networkClient.payload.referenceParent === undefined) {
networkClient.payload.uiObject.setErrorMessage('You need to reference a Superalgos Network Node so that it acts as a gateway to the Ethereum Client.')
return
}
let networkNodeConfig = JSON.parse(networkClient.payload.referenceParent.config)
let url = 'http://' + networkNodeConfig.host + ':' + networkNodeConfig.webPort + '/' + 'WEB3'
return {
params: params,
url: url
}
}
}
+122 -1
View File
@@ -14,6 +14,113 @@
"functionName": "newSuperalgosGlobalsZoom"
}
],
"functionLibraries": [
{
"name": "Attach Detach",
"propertyName": "attachDetach",
"functionName": "newSuperalgosFunctionLibraryAttachDetach"
},
{
"name": "Chain Attach Detach",
"propertyName": "chainAttachDetach",
"functionName": "newSuperalgosFunctionLibraryChainAttachDetach"
},
{
"name": "Node Deleter",
"propertyName": "nodeDeleter",
"functionName": "newSuperalgosFunctionLibraryNodeDeleter"
},
{
"name": "Ui Objects From Nodes",
"propertyName": "uiObjectsFromNodes",
"functionName": "newSuperalgosFunctionLibraryUiObjectsFromNodes"
},
{
"name": "Protocol Node",
"propertyName": "protocolNode",
"functionName": "newSuperalgosFunctionLibraryProtocolNode"
},
{
"name": "Node Cloning",
"propertyName": "nodeCloning",
"functionName": "newSuperalgosFunctionLibraryNodeCloning"
},
{
"name": "Shortcut Keys",
"propertyName": "shortcutKeys",
"functionName": "newSuperalgosFunctionLibraryShortcutKeys"
},
{
"name": "On Focus",
"propertyName": "onFocus",
"functionName": "newSuperalgosFunctionLibraryOnFocus"
},
{
"name": "Super Scripts Functions",
"propertyName": "superScriptsFunctions",
"functionName": "newSuperalgosFunctionLibrarySuperScriptsFunctions"
},
{
"name": "Webhook Functions",
"propertyName": "webhookFunctions",
"functionName": "newSuperalgosFunctionLibraryWebhookFunctions"
},
{
"name": "Dependencies Filter",
"propertyName": "dependenciesFilter",
"functionName": "newSuperalgosFunctionLibraryDependenciesFilter"
},
{
"name": "Node Path",
"propertyName": "nodePath",
"functionName": "newSuperalgosFunctionLibraryNodePath"
},
{
"name": "Task Functions",
"propertyName": "taskFunctions",
"functionName": "newSuperalgosFunctionLibraryTaskFunctions"
},
{
"name": "Trading Session Functions",
"propertyName": "tradingSessionFunctions",
"functionName": "newSuperalgosFunctionLibraryTradingSessionFunctions"
},
{
"name": "Learning Session Functions",
"propertyName": "learningSessionFunctions",
"functionName": "newSuperalgosFunctionLibraryLearningSessionFunctions"
},
{
"name": "Crypto Ecosystem Functions",
"propertyName": "cryptoEcosystemFunctions",
"functionName": "newSuperalgosFunctionLibraryCryptoEcosystemFunctions"
},
{
"name": "Mine Functions",
"propertyName": "mineFunctions",
"functionName": "newSuperalgosFunctionLibraryMineFunctions"
},
{
"name": "Data Storage Functions",
"propertyName": "dataStorageFunctions",
"functionName": "newSuperalgosFunctionLibraryDataStorageFunctions"
},
{
"name": "Charting Space Functions",
"propertyName": "chartingSpaceFunctions",
"functionName": "newSuperalgosFunctionLibraryChartingSpaceFunctions"
},
{
"name": "Plugins Functions",
"propertyName": "pluginsFunctions",
"functionName": "newSuperalgosFunctionLibraryPluginsFunctions"
},
{
"name": "Workspace Functions",
"propertyName": "workspaceFunctions",
"functionName": "newSuperalgosFunctionLibraryWorkspaceFunctions"
}
],
"utilities": [
{
"name": "Branches",
@@ -110,7 +217,7 @@
"folderName": "Top-Space",
"propertyName": "topSpace",
"functionName": "newSuperalgosTopSpace",
"initializationIndex": 1,
"initializationIndex": 1,
"animationPhysicsIndex": 7,
"animationDrawIndex": 6,
"onMouseOverIndex": 4,
@@ -226,6 +333,20 @@
"functionName": "newEthereumGlobalsChainIds"
}
],
"functionLibraries": [
{
"name": "Accounts",
"propertyName": "accounts",
"functionName": "newEthereumFunctionLibraryAccounts"
}
],
"utilities": [
{
"name": "Route To Client",
"propertyName": "routeToClient",
"functionName": "newEthereumUtilitiesRouteToClient"
}
],
"spaces": [
{
"name": "Blockchain Space",
@@ -6,52 +6,10 @@ function newSuperalgosActionSwitch() {
finalize: finalize
}
let functionLibraryReferenceAttachDetach = newReferenceAttachDetach()
let functionLibraryChainAttachDetach = newChainAttachDetach()
let functionLibraryNodeDeleter = newNodeDeleter()
let functionLibraryUiObjectsFromNodes = newUiObjectsFromNodes()
let functionLibraryProtocolNode = newProtocolNode()
let functionLibraryNodeCloning = newNodeCloning()
let functionLibraryShortcutKeys = newShortcutKeys()
let functionLibraryOnFocus = newOnFocus()
let functionLibrarySuperScripts = newSuperScriptsFunctions()
let functionLibraryWebhookFunctions = newWebhookFunctions()
let functionLibraryDependenciesFilter = newDependenciesFilter()
let functionLibraryNodePath = newNodePath()
let functionLibraryTaskFunctions = newTaskFunctions()
let functionLibraryTradingSessionFunctions = newTradingSessionFunctions()
let functionLibraryLearningSessionFunctions = newLearningSessionFunctions()
let functionLibraryCryptoEcosystemFunctions = newCryptoEcosystemFunctions()
let functionLibraryMineFunctions = newMineFunctions()
let functionLibraryDataStorageFunctions = newDataStorageFunctions()
let functionLibraryChartingSpaceFunctions = newChartingSpaceFunctions()
let functionLibraryPluginsFunctions = newPluginsFunctions()
let functionLibraryWorkspaceFunctions = newWorkspaceFunctions()
return thisObject
function finalize() {
functionLibraryReferenceAttachDetach = undefined
functionLibraryChainAttachDetach = undefined
functionLibraryNodeDeleter = undefined
functionLibraryUiObjectsFromNodes = undefined
functionLibraryProtocolNode = undefined
functionLibraryNodeCloning = undefined
functionLibraryShortcutKeys = undefined
functionLibraryOnFocus = undefined
functionLibrarySuperScripts = undefined
functionLibraryWebhookFunctions = undefined
functionLibraryDependenciesFilter = undefined
functionLibraryNodePath = undefined
functionLibraryTaskFunctions = undefined
functionLibraryTradingSessionFunctions = undefined
functionLibraryLearningSessionFunctions = undefined
functionLibraryCryptoEcosystemFunctions = undefined
functionLibraryMineFunctions = undefined
functionLibraryDataStorageFunctions = undefined
functionLibraryChartingSpaceFunctions = undefined
functionLibraryPluginsFunctions = undefined
functionLibraryWorkspaceFunctions = undefined
}
function initialize() {
@@ -61,56 +19,56 @@ function newSuperalgosActionSwitch() {
async function executeAction(action) {
switch (action.name) {
case 'Get Node On Focus': {
return functionLibraryOnFocus.getNodeThatIsOnFocus(action.node)
return UI.projects.superalgos.functionLibraries.onFocus.getNodeThatIsOnFocus(action.node)
}
case 'Get Node By Shortcut Key': {
return functionLibraryShortcutKeys.getNodeByShortcutKey(action.node, action.extraParameter)
return UI.projects.superalgos.functionLibraries.shortcutKeys.getNodeByShortcutKey(action.node, action.extraParameter)
}
case 'Get Node Data Structure': {
return functionLibraryProtocolNode.getProtocolNode(action.node, action.extraParameter, false, true, true, true)
return UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(action.node, action.extraParameter, false, true, true, true)
}
case 'Create UI Object': {
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(action.node, undefined, undefined, action.extraParameter)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.createUiObjectFromNode(action.node, undefined, undefined, action.extraParameter)
}
break
case 'Connect Children to Reference Parents': {
functionLibraryUiObjectsFromNodes.tryToConnectChildrenWithReferenceParents()
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.tryToConnectChildrenWithReferenceParents()
}
break
case 'Get Node By Id': {
return functionLibraryUiObjectsFromNodes.getNodeById(action.relatedNodeId)
return UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.getNodeById(action.relatedNodeId)
}
case 'Syncronize Tasks': {
functionLibraryUiObjectsFromNodes.syncronizeTasksFoundAtWorkspaceWithBackEnd(functionLibraryTaskFunctions)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.syncronizeTasksFoundAtWorkspaceWithBackEnd()
}
break
case 'Syncronize Trading Sessions': {
functionLibraryUiObjectsFromNodes.syncronizeTradingSessionsFoundAtWorkspaceWithBackEnd(functionLibraryTradingSessionFunctions)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.syncronizeTradingSessionsFoundAtWorkspaceWithBackEnd()
}
break
case 'Syncronize Learning Sessions': {
functionLibraryUiObjectsFromNodes.syncronizeLearningSessionsFoundAtWorkspaceWithBackEnd(functionLibraryLearningSessionFunctions)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.syncronizeLearningSessionsFoundAtWorkspaceWithBackEnd()
}
break
case 'Play Tutorials': {
functionLibraryUiObjectsFromNodes.playTutorials()
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.playTutorials()
}
break
case 'Recreate Workspace': {
functionLibraryUiObjectsFromNodes.recreateWorkspace(action.node, action.callBackFunction)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.recreateWorkspace(action.node, action.callBackFunction)
}
break
case 'Delete Workspace': {
return functionLibraryNodeDeleter.deleteWorkspace(action.node, action.rootNodes)
return UI.projects.superalgos.functionLibraries.nodeDeleter.deleteWorkspace(action.node, action.rootNodes)
}
break
case 'Copy Node Path':
{
let nodePath = functionLibraryNodePath.getNodePath(action.node)
let nodePath = UI.projects.superalgos.functionLibraries.nodePath.getNodePath(action.node)
UI.projects.superalgos.utilities.clipboard.copyTextToClipboard(nodePath)
@@ -143,17 +101,17 @@ function newSuperalgosActionSwitch() {
break
case 'Add UI Object':
{
functionLibraryUiObjectsFromNodes.addUIObject(action.node, action.relatedNodeType, action.rootNodes)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(action.node, action.relatedNodeType, action.rootNodes)
}
break
case 'Add Missing Children':
{
functionLibraryUiObjectsFromNodes.addMissingChildren(action.node, action.rootNodes)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addMissingChildren(action.node, action.rootNodes)
}
break
case 'Delete UI Object':
{
functionLibraryNodeDeleter.deleteUIObject(action.node, action.rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(action.node, action.rootNodes)
}
break
case 'Edit Code':
@@ -161,7 +119,7 @@ function newSuperalgosActionSwitch() {
break
case 'Share':
{
let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(action.node, true, false, true, true, true))
let text = JSON.stringify(UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(action.node, true, false, true, true, true))
let nodeName = action.node.name
if (nodeName === undefined) {
@@ -176,7 +134,7 @@ function newSuperalgosActionSwitch() {
break
case 'Backup':
{
let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(action.node, false, false, true, true, true))
let text = JSON.stringify(UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(action.node, false, false, true, true, true))
let nodeName = action.node.name
if (nodeName === undefined) {
@@ -191,7 +149,7 @@ function newSuperalgosActionSwitch() {
break
case 'Clone':
{
let text = JSON.stringify(functionLibraryNodeCloning.getNodeClone(action.node))
let text = JSON.stringify(UI.projects.superalgos.functionLibraries.nodeCloning.getNodeClone(action.node))
let nodeName = action.node.name
if (nodeName === undefined) {
@@ -206,292 +164,292 @@ function newSuperalgosActionSwitch() {
break
case 'Debug Task':
{
functionLibraryTaskFunctions.runTask(action.node, functionLibraryProtocolNode, true, action.callBackFunction)
UI.projects.superalgos.functionLibraries.taskFunctions.runTask(action.node, true, action.callBackFunction)
}
break
case 'Run Task':
{
functionLibraryTaskFunctions.runTask(action.node, functionLibraryProtocolNode, false, action.callBackFunction)
UI.projects.superalgos.functionLibraries.taskFunctions.runTask(action.node, false, action.callBackFunction)
}
break
case 'Stop Task':
{
functionLibraryTaskFunctions.stopTask(action.node, functionLibraryProtocolNode, action.callBackFunction)
UI.projects.superalgos.functionLibraries.taskFunctions.stopTask(action.node, action.callBackFunction)
}
break
case 'Run All Tasks':
{
functionLibraryTaskFunctions.runAllTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllTasks(action.node)
}
break
case 'Stop All Tasks':
{
functionLibraryTaskFunctions.stopAllTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllTasks(action.node)
}
break
case 'Run All Task Managers':
{
functionLibraryTaskFunctions.runAllTaskManagers(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllTaskManagers(action.node)
}
break
case 'Stop All Task Managers':
{
functionLibraryTaskFunctions.stopAllTaskManagers(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllTaskManagers(action.node)
}
break
case 'Run All Exchange Data Tasks':
{
functionLibraryTaskFunctions.runAllExchangeDataTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllExchangeDataTasks(action.node)
}
break
case 'Stop All Exchange Data Tasks':
{
functionLibraryTaskFunctions.stopAllExchangeDataTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllExchangeDataTasks(action.node)
}
break
case 'Run All Exchange Trading Tasks':
{
functionLibraryTaskFunctions.runAllExchangeTradingTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllExchangeTradingTasks(action.node)
}
break
case 'Stop All Exchange Trading Tasks':
{
functionLibraryTaskFunctions.stopAllExchangeTradingTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllExchangeTradingTasks(action.node)
}
break
case 'Run All Exchange Learning Tasks':
{
functionLibraryTaskFunctions.runAllExchangeLearningTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllExchangeLearningTasks(action.node)
}
break
case 'Stop All Exchange Learning Tasks':
{
functionLibraryTaskFunctions.stopAllExchangeLearningTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllExchangeLearningTasks(action.node)
}
break
case 'Run All Market Data Tasks':
{
functionLibraryTaskFunctions.runAllMarketDataTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllMarketDataTasks(action.node)
}
break
case 'Stop All Market Data Tasks':
{
functionLibraryTaskFunctions.stopAllMarketDataTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllMarketDataTasks(action.node)
}
break
case 'Run All Market Trading Tasks':
{
functionLibraryTaskFunctions.runAllMarketTradingTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllMarketTradingTasks(action.node)
}
break
case 'Stop All Market Trading Tasks':
{
functionLibraryTaskFunctions.stopAllMarketTradingTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllMarketTradingTasks(action.node)
}
break
case 'Run All Market Learning Tasks':
{
functionLibraryTaskFunctions.runAllMarketLearningTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllMarketLearningTasks(action.node)
}
break
case 'Stop All Market Learning Tasks':
{
functionLibraryTaskFunctions.stopAllMarketLearningTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllMarketLearningTasks(action.node)
}
break
case 'Run All Data Mine Tasks':
{
functionLibraryTaskFunctions.runAllDataMineTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllDataMineTasks(action.node)
}
break
case 'Stop All Data Mine Tasks':
{
functionLibraryTaskFunctions.stopAllDataMineTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllDataMineTasks(action.node)
}
break
case 'Run All Trading Mine Tasks':
{
functionLibraryTaskFunctions.runAllTradingMineTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllTradingMineTasks(action.node)
}
break
case 'Stop All Trading Mine Tasks':
{
functionLibraryTaskFunctions.stopAllTradingMineTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllTradingMineTasks(action.node)
}
break
case 'Run All Learning Mine Tasks':
{
functionLibraryTaskFunctions.runAllLearningMineTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.runAllLearningMineTasks(action.node)
}
break
case 'Stop All Learning Mine Tasks':
{
functionLibraryTaskFunctions.stopAllLearningMineTasks(action.node, functionLibraryProtocolNode)
UI.projects.superalgos.functionLibraries.taskFunctions.stopAllLearningMineTasks(action.node)
}
break
case 'Add Missing Exchange Data Tasks':
{
functionLibraryTaskFunctions.addMissingExchangeDataTasks(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingExchangeDataTasks(action.node, action.rootNodes)
}
break
case 'Add Missing Market Data Tasks':
{
functionLibraryTaskFunctions.addMissingMarketDataTasks(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingMarketDataTasks(action.node)
}
break
case 'Add Missing Data Mine Tasks':
{
functionLibraryTaskFunctions.addMissingDataMineTasks(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingDataMineTasks(action.node, action.rootNodes)
}
break
case 'Add Missing Exchange Trading Tasks':
{
functionLibraryTaskFunctions.addMissingExchangeTradingTasks(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingExchangeTradingTasks(action.node, action.rootNodes)
}
break
case 'Add Missing Market Trading Tasks':
{
functionLibraryTaskFunctions.addMissingMarketTradingTasks(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingMarketTradingTasks(action.node)
}
break
case 'Add Missing Trading Mine Tasks':
{
functionLibraryTaskFunctions.addMissingTradingMineTasks(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingTradingMineTasks(action.node, action.rootNodes)
}
break
case 'Add Missing Exchange Learning Tasks':
{
functionLibraryTaskFunctions.addMissingExchangeLearningTasks(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingExchangeLearningTasks(action.node, action.rootNodes)
}
break
case 'Add Missing Market Learning Tasks':
{
functionLibraryTaskFunctions.addMissingMarketLearningTasks(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingMarketLearningTasks(action.node)
}
break
case 'Add Missing Learning Mine Tasks':
{
functionLibraryTaskFunctions.addMissingLearningMineTasks(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addMissingLearningMineTasks(action.node, action.rootNodes)
}
break
case 'Add All Tasks':
{
functionLibraryTaskFunctions.addAllTasks(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.taskFunctions.addAllTasks(action.node, action.rootNodes)
}
break
case 'Add Missing Crypto Exchanges':
{
functionLibraryCryptoEcosystemFunctions.addMissingExchanges(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.cryptoEcosystemFunctions.addMissingExchanges(action.node)
}
break
case 'Add Missing Assets':
{
functionLibraryCryptoEcosystemFunctions.addMissingAssets(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.cryptoEcosystemFunctions.addMissingAssets(action.node)
}
break
case 'Add Missing Markets':
{
functionLibraryCryptoEcosystemFunctions.addMissingMarkets(action.node, functionLibraryUiObjectsFromNodes, functionLibraryNodeCloning)
UI.projects.superalgos.functionLibraries.cryptoEcosystemFunctions.addMissingMarkets(action.node)
}
break
case 'Install Market':
{
functionLibraryCryptoEcosystemFunctions.installMarket(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter, functionLibraryChartingSpaceFunctions, functionLibraryDataStorageFunctions)
UI.projects.superalgos.functionLibraries.cryptoEcosystemFunctions.installMarket(action.node, action.rootNodes)
}
break
case 'Uninstall Market':
{
functionLibraryCryptoEcosystemFunctions.uninstallMarket(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter, functionLibraryChartingSpaceFunctions, functionLibraryDataStorageFunctions)
UI.projects.superalgos.functionLibraries.cryptoEcosystemFunctions.uninstallMarket(action.node, action.rootNodes)
}
break
case 'Add All Output Datasets':
{
functionLibraryMineFunctions.addAllOutputDatasets(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.mineFunctions.addAllOutputDatasets(action.node)
}
break
case 'Add All Data Products':
{
functionLibraryDataStorageFunctions.addAllDataProducts(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addAllDataProducts(action.node)
}
break
case 'Add All Data Mine Products':
{
functionLibraryDataStorageFunctions.addAllDataMineProducts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addAllDataMineProducts(action.node, action.rootNodes)
}
break
case 'Add All Learning Mine Products':
{
functionLibraryDataStorageFunctions.addAllLearningMineProducts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addAllLearningMineProducts(action.node, action.rootNodes)
}
break
case 'Add All Trading Mine Products':
{
functionLibraryDataStorageFunctions.addAllTradingMineProducts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addAllTradingMineProducts(action.node, action.rootNodes)
}
break
case 'Add Missing Trading Session References':
{
functionLibraryDataStorageFunctions.addMissingTradingSessionReferences(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addMissingTradingSessionReferences(action.node, action.rootNodes)
}
break
case 'Add Missing Learning Session References':
{
functionLibraryDataStorageFunctions.addMissingLearningSessionReferences(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addMissingLearningSessionReferences(action.node, action.rootNodes)
}
break
case 'Add Missing Market Data Products':
{
functionLibraryDataStorageFunctions.addMissingMarketDataProducts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addMissingMarketDataProducts(action.node, action.rootNodes)
}
break
case 'Add Missing Market Trading Products':
{
functionLibraryDataStorageFunctions.addMissingMarketTradingProducts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addMissingMarketTradingProducts(action.node, action.rootNodes)
}
break
case 'Add Missing Exchange Trading Products':
{
functionLibraryDataStorageFunctions.addMissingExchangeTradingProducts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addMissingExchangeTradingProducts(action.node, action.rootNodes)
}
break
case 'Add Missing Exchange Data Products':
{
functionLibraryDataStorageFunctions.addMissingExchangeDataProducts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.addMissingExchangeDataProducts(action.node, action.rootNodes)
}
break
case 'Add All Data Dependencies':
{
functionLibraryMineFunctions.addAllDataDependencies(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.mineFunctions.addAllDataDependencies(action.node)
}
break
case 'Add All Data Mine Dependencies':
{
functionLibraryMineFunctions.addAllDataMineDataDependencies(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.mineFunctions.addAllDataMineDataDependencies(action.node, action.rootNodes)
}
break
case 'Add All Layer Panels':
{
functionLibraryChartingSpaceFunctions.addAllLayerPanels(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.chartingSpaceFunctions.addAllLayerPanels(action.node)
}
break
case 'Add All Layer Polygons':
{
functionLibraryChartingSpaceFunctions.addAllLayerPolygons(action.node, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.chartingSpaceFunctions.addAllLayerPolygons(action.node)
}
break
case 'Add All Mine Layers':
{
functionLibraryChartingSpaceFunctions.addAllMineLayers(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
UI.projects.superalgos.functionLibraries.chartingSpaceFunctions.addAllMineLayers(action.node, action.rootNodes)
}
break
case 'Add Missing Time Machines':
{
functionLibraryChartingSpaceFunctions.addMissingTimeMachines(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
UI.projects.superalgos.functionLibraries.chartingSpaceFunctions.addMissingTimeMachines(action.node, action.rootNodes)
}
break
case 'Add Missing Dashboards':
{
functionLibraryChartingSpaceFunctions.addMissingDashboards(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
UI.projects.superalgos.functionLibraries.chartingSpaceFunctions.addMissingDashboards(action.node, action.rootNodes)
}
break
case 'Play Tutorial':
@@ -531,60 +489,60 @@ function newSuperalgosActionSwitch() {
break
case 'Send Webhook Test Message':
{
functionLibraryWebhookFunctions.sendTestMessage(action.node, action.callBackFunction)
UI.projects.superalgos.functionLibraries.webhookFunctions.sendTestMessage(action.node, action.callBackFunction)
}
break
case 'Run Trading Session':
{
functionLibraryTradingSessionFunctions.runSession(action.node, functionLibraryProtocolNode, functionLibraryDependenciesFilter, false, action.callBackFunction)
UI.projects.superalgos.functionLibraries.tradingSessionFunctions.runSession(action.node, false, action.callBackFunction)
}
break
case 'Resume Trading Session':
{
functionLibraryTradingSessionFunctions.runSession(action.node, functionLibraryProtocolNode, functionLibraryDependenciesFilter, true, action.callBackFunction)
UI.projects.superalgos.functionLibraries.tradingSessionFunctions.runSession(action.node, true, action.callBackFunction)
}
break
case 'Stop Trading Session':
{
functionLibraryTradingSessionFunctions.stopSession(action.node, functionLibraryProtocolNode, action.callBackFunction)
UI.projects.superalgos.functionLibraries.tradingSessionFunctions.stopSession(action.node, action.callBackFunction)
}
break
case 'Run Learning Session':
{
functionLibraryLearningSessionFunctions.runSession(action.node, functionLibraryProtocolNode, functionLibraryDependenciesFilter, false, action.callBackFunction)
UI.projects.superalgos.functionLibraries.learningSessionFunctions.runSession(action.node, false, action.callBackFunction)
}
break
case 'Resume Learning Session':
{
functionLibraryLearningSessionFunctions.runSession(action.node, functionLibraryProtocolNode, functionLibraryDependenciesFilter, true, action.callBackFunction)
UI.projects.superalgos.functionLibraries.learningSessionFunctions.runSession(action.node, true, action.callBackFunction)
}
break
case 'Stop Learning Session':
{
functionLibraryLearningSessionFunctions.stopSession(action.node, functionLibraryProtocolNode, action.callBackFunction)
UI.projects.superalgos.functionLibraries.learningSessionFunctions.stopSession(action.node, action.callBackFunction)
}
break
case 'Run Super Action':
{
functionLibrarySuperScripts.runSuperScript(action.node, action.rootNodes, functionLibraryNodeCloning, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
UI.projects.superalgos.functionLibraries.superScriptsFunctions.runSuperScript(action.node, action.rootNodes)
}
break
case 'Parent Attach': {
functionLibraryChainAttachDetach.chainAttachNode(action.node, action.relatedNode, action.rootNodes)
UI.projects.superalgos.functionLibraries.chainAttachDetach.chainAttachNode(action.node, action.relatedNode, action.rootNodes)
}
break
case 'Reference Attach': {
functionLibraryReferenceAttachDetach.referenceAttachNode(action.node, action.relatedNode, action.rootNodes)
UI.projects.superalgos.functionLibraries.attachDetach.referenceAttachNode(action.node, action.relatedNode, action.rootNodes)
}
break
case 'Parent Detach':
{
functionLibraryChainAttachDetach.chainDetachNode(action.node, action.rootNodes)
UI.projects.superalgos.functionLibraries.chainAttachDetach.chainDetachNode(action.node, action.rootNodes)
}
break
case 'Reference Detach':
{
functionLibraryReferenceAttachDetach.referenceDetachNode(action.node)
UI.projects.superalgos.functionLibraries.attachDetach.referenceDetachNode(action.node)
}
break
case 'Push Code to Javascript Code':
@@ -618,42 +576,42 @@ function newSuperalgosActionSwitch() {
break
case 'Add Missing Plugin Projects':
{
functionLibraryPluginsFunctions.pluginMissingProjects(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.pluginsFunctions.pluginMissingProjects(action.node, action.rootNodes)
}
break
case 'Add Missing Plugin Data Mines':
{
functionLibraryPluginsFunctions.pluginMissingDataMines(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.pluginsFunctions.pluginMissingDataMines(action.node, action.rootNodes)
}
break
case 'Add Missing Plugin Trading Mines':
{
functionLibraryPluginsFunctions.pluginMissingTradingMines(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.pluginsFunctions.pluginMissingTradingMines(action.node, action.rootNodes)
}
break
case 'Add Missing Plugin Trading Systems':
{
functionLibraryPluginsFunctions.pluginMissingTradingSystems(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.pluginsFunctions.pluginMissingTradingSystems(action.node, action.rootNodes)
}
break
case 'Add Missing Plugin Trading Engines':
{
functionLibraryPluginsFunctions.pluginMissingTradingEngines(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.pluginsFunctions.pluginMissingTradingEngines(action.node, action.rootNodes)
}
break
case 'Add Missing Plugin Super Scripts':
{
functionLibraryPluginsFunctions.pluginMissingSuperScripts(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.pluginsFunctions.pluginMissingSuperScripts(action.node, action.rootNodes)
}
break
case 'Add Missing Plugin Tutorials':
{
functionLibraryPluginsFunctions.pluginMissingTutorials(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.pluginsFunctions.pluginMissingTutorials(action.node, action.rootNodes)
}
break
case 'Add Missing Workspace Projects':
{
functionLibraryWorkspaceFunctions.addMissingWorkspaceProjects(action.node, action.rootNodes, functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.workspaceFunctions.addMissingWorkspaceProjects(action.node, action.rootNodes)
}
break
}
@@ -1,4 +1,4 @@
function newChainAttachDetach() {
function newSuperalgosFunctionLibraryChainAttachDetach() {
thisObject = {
chainDetachNode: chainDetachNode,
chainAttachNode: chainAttachNode
@@ -1,4 +1,4 @@
function newChartingSpaceFunctions() {
function newSuperalgosFunctionLibraryChartingSpaceFunctions() {
thisObject = {
addAllLayerPanels: addAllLayerPanels,
addAllLayerPolygons: addAllLayerPolygons,
@@ -10,7 +10,7 @@ function newChartingSpaceFunctions() {
return thisObject
function addAllMineLayers(node, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
function addAllMineLayers(node, rootNodes) {
/* Validations to see if we can do this or not. */
if (node.payload === undefined) { return }
@@ -35,7 +35,7 @@ function newChartingSpaceFunctions() {
function scanBotArray(botArray) {
for (let i = 0; i < botArray.length; i++) {
let bot = botArray[i]
let botLayers = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Bot Layers')
let botLayers = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Bot Layers')
botLayers.name = bot.name
UI.projects.superalgos.utilities.folders.asymetricalFolderStructureCloning(
@@ -46,8 +46,7 @@ function newChartingSpaceFunctions() {
'layerFolders',
'Layer',
'Layer Folder',
undefined,
functionLibraryUiObjectsFromNodes
undefined
)
/*
There are some layers that should not exist, for example the ones related to Data Products
@@ -61,7 +60,7 @@ function newChartingSpaceFunctions() {
let plotterModule = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(layer, 'Plotter Module', undefined, true, false, false, true)
if (plotterModule === undefined) {
functionLibraryNodeDeleter.deleteUIObject(layer, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(layer, rootNodes)
}
}
/*
@@ -90,7 +89,7 @@ function newChartingSpaceFunctions() {
}
}
function addMissingTimeMachines(node, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
function addMissingTimeMachines(node, rootNodes) {
if (node.payload.referenceParent === undefined) {
node.payload.uiObject.setErrorMessage('This node needs to have a Reference Parent for this command tu run.')
return
@@ -128,16 +127,16 @@ function newChartingSpaceFunctions() {
let market = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(session, 'Market Trading Tasks', undefined, true, false, true, false)
if (market.payload.referenceParent === undefined) { continue }
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, session, true) === true) {
createTimeMachine(node, session, market.payload.referenceParent, networkNode, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
createTimeMachine(node, session, market.payload.referenceParent, networkNode, rootNodes)
}
}
}
}
}
function createTimeMachine(dashboard, session, market, networkNode, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
function createTimeMachine(dashboard, session, market, networkNode, rootNodes) {
let mineProducts
let timeMachine = functionLibraryUiObjectsFromNodes.addUIObject(dashboard, 'Time Machine')
let timeMachine = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(dashboard, 'Time Machine')
let exchange = market.payload.parentNode.payload.parentNode
timeMachine.payload.referenceParent = session
timeMachine.name = session.name + ' ' + session.type + ' ' + networkNode.name + ' ' + exchange.name + ' ' + market.name
@@ -166,7 +165,7 @@ function newChartingSpaceFunctions() {
*/
for (let k = 0; k < 3; k++) {
let timelineChart = functionLibraryUiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart')
let timelineChart = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart')
timelineChart.layerManager.payload.referenceParent = mineProduct
timelineChart.payload.floatingObject.collapseToggle()
@@ -201,7 +200,7 @@ function newChartingSpaceFunctions() {
function deleteNodeByName(nodeName) {
let nodeToDelete = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(timelineChart.layerManager, undefined, nodeName, true, true, false, false)
if (nodeToDelete === undefined) { return }
functionLibraryNodeDeleter.deleteUIObject(nodeToDelete, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(nodeToDelete, rootNodes)
}
}
}
@@ -218,7 +217,7 @@ function newChartingSpaceFunctions() {
if (mineProduct.payload.parentNode.payload.referenceParent === undefined) { continue }
if (mineProduct.payload.parentNode.payload.referenceParent.id !== market.id) { continue }
let timelineChart = functionLibraryUiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart')
let timelineChart = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart')
/*
The Mine Product Node might be collapesd and since its creation it never
received the physics call, so we will do the call so that it properly
@@ -249,7 +248,7 @@ function newChartingSpaceFunctions() {
if (mineProduct.payload.parentNode.payload.parentNode.payload.referenceParent === undefined) { continue }
if (mineProduct.payload.parentNode.payload.parentNode.payload.referenceParent.id !== market.id) { continue }
let timelineChart = functionLibraryUiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart')
let timelineChart = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart')
/*
The Mine Product Node might be collapesd and since its creation it never
received the physics call, so we will do the call so that it properly
@@ -269,7 +268,7 @@ function newChartingSpaceFunctions() {
}
}
function addMissingDashboards(node, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
function addMissingDashboards(node, rootNodes) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Network') {
@@ -291,13 +290,13 @@ function newChartingSpaceFunctions() {
let productionEnvironment = UI.projects.superalgos.utilities.branches.findInBranch(networkNode, 'Production Environment', node, true)
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, testingEnvironment, true) === true) {
let dashboard = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Dashboard')
let dashboard = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Dashboard')
dashboard.payload.referenceParent = testingEnvironment
dashboard.name = testingEnvironment.type + ' ' + networkNode.name
}
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, productionEnvironment, true) === true) {
let dashboard = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Dashboard')
let dashboard = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Dashboard')
dashboard.payload.referenceParent = productionEnvironment
dashboard.name = productionEnvironment.type + ' ' + networkNode.name
}
@@ -305,19 +304,19 @@ function newChartingSpaceFunctions() {
}
}
function addAllLayerPanels(node, functionLibraryUiObjectsFromNodes) {
function addAllLayerPanels(node) {
if (validateReferences(node) !== true) { return }
let layerNode = node.payload.parentNode
let plotterModule = layerNode.payload.referenceParent.payload.referenceParent.payload.referenceParent
for (let i = 0; i < plotterModule.panels.length; i++) {
let plotterPanel = plotterModule.panels[i]
let layerPanel = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Layer Panel')
let layerPanel = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Layer Panel')
layerPanel.payload.referenceParent = plotterPanel
}
}
function addAllLayerPolygons(node, functionLibraryUiObjectsFromNodes) {
function addAllLayerPolygons(node) {
if (validateReferences(node) !== true) { return }
let layerNode = node.payload.parentNode
@@ -330,7 +329,7 @@ function newChartingSpaceFunctions() {
for (let i = 0; i < plotterModule.shapes.polygons.length; i++) {
let polygon = plotterModule.shapes.polygons[i]
let layerPolygon = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Layer Polygon')
let layerPolygon = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Layer Polygon')
layerPolygon.payload.referenceParent = polygon
}
}
@@ -1,4 +1,4 @@
function newCryptoEcosystemFunctions() {
function newSuperalgosFunctionLibraryCryptoEcosystemFunctions() {
thisObject = {
addMissingExchanges: addMissingExchanges,
addMissingAssets: addMissingAssets,
@@ -9,7 +9,7 @@ function newCryptoEcosystemFunctions() {
return thisObject
function addMissingExchanges(node, functionLibraryUiObjectsFromNodes) {
function addMissingExchanges(node) {
currentExchanges = new Map()
let parent = node.payload.parentNode
if (parent !== undefined) {
@@ -44,7 +44,7 @@ function newCryptoEcosystemFunctions() {
let exchange = exchanges[i]
let existingExchange = currentExchanges.get(exchange.id)
if (existingExchange === undefined) {
let newExchange = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Crypto Exchange')
let newExchange = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Crypto Exchange')
newExchange.name = exchange.name
newExchange.config = '{ \n\"codeName\": \"' + exchange.id + '\"\n}'
newExchange.payload.floatingObject.collapseToggle()
@@ -62,7 +62,7 @@ function newCryptoEcosystemFunctions() {
}
}
function addMissingAssets(node, functionLibraryUiObjectsFromNodes) {
function addMissingAssets(node) {
if (node.payload.parentNode === undefined) { return }
let currentAssets = new Map()
@@ -118,7 +118,7 @@ function newCryptoEcosystemFunctions() {
}
function addAsset(name) {
let newAsseet = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Asset')
let newAsseet = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Asset')
newAsseet.name = name
newAsseet.config = '{ \n\"codeName\": \"' + name + '\"\n}'
}
@@ -132,7 +132,7 @@ function newCryptoEcosystemFunctions() {
}
}
function addMissingMarkets(node, functionLibraryUiObjectsFromNodes, functionLibraryNodeCloning) {
function addMissingMarkets(node) {
if (node.payload.parentNode === undefined) { return }
if (node.payload.parentNode.exchangeAssets === undefined) { return }
if (node.payload.parentNode.payload.parentNode === undefined) { return }
@@ -187,7 +187,7 @@ function newCryptoEcosystemFunctions() {
}
function addMarket(name, baseAsset, quotedAsset) {
let newMarket = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Market')
let newMarket = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Market')
newMarket.name = name
newMarket.config = '{ \n\"codeName\": \"' + name + '\"\n}'
newMarket.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
@@ -214,11 +214,7 @@ function newCryptoEcosystemFunctions() {
function installMarket(
node,
rootNodes,
functionLibraryUiObjectsFromNodes,
functionLibraryNodeDeleter,
functionLibraryChartingSpaceFunctions,
functionLibraryDataStorageFunctions
rootNodes
) {
let market = node
@@ -280,9 +276,9 @@ function newCryptoEcosystemFunctions() {
return
}
let exchangeDataTasks = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(dataMining, 'Exchange Data Tasks', cryptoExchange, functionLibraryUiObjectsFromNodes)
let exchangeDataTasks = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(dataMining, 'Exchange Data Tasks', cryptoExchange)
exchangeDataTasks.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
let marketDataTask = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeDataTasks, 'Market Data Tasks', market, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
let marketDataTask = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeDataTasks, 'Market Data Tasks', market, rootNodes)
UI.projects.superalgos.utilities.menu.menuClick(marketDataTask, 'Add Missing Data Mine Tasks', true)
UI.projects.superalgos.utilities.menu.menuClickOfNodeArray(marketDataTask.dataMineTasks, 'Add All Tasks', true)
@@ -298,9 +294,9 @@ function newCryptoEcosystemFunctions() {
return
}
let exchangeLearningTasks = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(learningMining, 'Exchange Learning Tasks', cryptoExchange, functionLibraryUiObjectsFromNodes)
let exchangeLearningTasks = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(learningMining, 'Exchange Learning Tasks', cryptoExchange)
exchangeLearningTasks.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
let marketLearningTask = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeLearningTasks, 'Market Learning Tasks', market, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
let marketLearningTask = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeLearningTasks, 'Market Learning Tasks', market, rootNodes)
UI.projects.superalgos.utilities.menu.menuClick(marketLearningTask, 'Add Missing Learning Mine Tasks', true)
UI.projects.superalgos.utilities.menu.menuClickOfNodeArray(marketLearningTask.learningMineTasks, 'Add All Tasks', true)
@@ -330,9 +326,9 @@ function newCryptoEcosystemFunctions() {
return
}
let exchangeTradingTasks = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(environmentFound, 'Exchange Trading Tasks', cryptoExchange, functionLibraryUiObjectsFromNodes)
let exchangeTradingTasks = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(environmentFound, 'Exchange Trading Tasks', cryptoExchange)
exchangeTradingTasks.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
let marketTradingTask = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeTradingTasks, 'Market Trading Tasks', market, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
let marketTradingTask = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeTradingTasks, 'Market Trading Tasks', market, rootNodes)
UI.projects.superalgos.utilities.menu.menuClick(marketTradingTask, 'Add Missing Trading Mine Tasks', true)
UI.projects.superalgos.utilities.menu.menuClickOfNodeArray(marketTradingTask.tradingMineTasks, 'Add All Tasks', true)
@@ -362,9 +358,9 @@ function newCryptoEcosystemFunctions() {
return
}
let exchangeDataProducts = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(dataMinesData, 'Exchange Data Products', cryptoExchange, functionLibraryUiObjectsFromNodes)
let exchangeDataProducts = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(dataMinesData, 'Exchange Data Products', cryptoExchange)
exchangeDataProducts.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
let marketDataProducts = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeDataProducts, 'Market Data Products', market, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
let marketDataProducts = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeDataProducts, 'Market Data Products', market, rootNodes)
marketDataProducts.payload.floatingObject.collapseToggle()
UI.projects.superalgos.utilities.menu.menuClick(marketDataProducts, 'Add All Data Mine Products', true)
@@ -381,9 +377,9 @@ function newCryptoEcosystemFunctions() {
return
}
let exchangeLearningProducts = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(learningMinesData, 'Exchange Learning Products', cryptoExchange, functionLibraryUiObjectsFromNodes)
let exchangeLearningProducts = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(learningMinesData, 'Exchange Learning Products', cryptoExchange)
exchangeLearningProducts.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
let marketLearningProducts = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeLearningProducts, 'Market Learning Products', market, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
let marketLearningProducts = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeLearningProducts, 'Market Learning Products', market, rootNodes)
marketLearningProducts.payload.floatingObject.collapseToggle()
/*
Create the new session references.
@@ -391,7 +387,7 @@ function newCryptoEcosystemFunctions() {
for (let i = 0; i < learningSessionsCreatedArray.length; i++) {
let session = learningSessionsCreatedArray[i]
if (UI.projects.superalgos.utilities.children.isMissingChildren(marketLearningProducts, session, true) === true) {
functionLibraryDataStorageFunctions.createSessionReference(marketLearningProducts, session, 'Learning Session Reference', functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.createSessionReference(marketLearningProducts, session, 'Learning Session Reference')
}
}
/*
@@ -415,9 +411,9 @@ function newCryptoEcosystemFunctions() {
return
}
let exchangeTradingProducts = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(tradingMinesData, 'Exchange Trading Products', cryptoExchange, functionLibraryUiObjectsFromNodes)
let exchangeTradingProducts = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(tradingMinesData, 'Exchange Trading Products', cryptoExchange)
exchangeTradingProducts.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
let marketTradingProducts = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeTradingProducts, 'Market Trading Products', market, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
let marketTradingProducts = UI.projects.superalgos.utilities.children.findAndRecreateChildWithReference(exchangeTradingProducts, 'Market Trading Products', market, rootNodes)
marketTradingProducts.payload.floatingObject.collapseToggle()
/*
Create the new session references.
@@ -425,7 +421,7 @@ function newCryptoEcosystemFunctions() {
for (let i = 0; i < tradingSessionsCreatedArray.length; i++) {
let session = tradingSessionsCreatedArray[i]
if (UI.projects.superalgos.utilities.children.isMissingChildren(marketTradingProducts, session, true) === true) {
functionLibraryDataStorageFunctions.createSessionReference(marketTradingProducts, session, 'Trading Session Reference', functionLibraryUiObjectsFromNodes)
UI.projects.superalgos.functionLibraries.dataStorageFunctions.createSessionReference(marketTradingProducts, session, 'Trading Session Reference')
}
}
/*
@@ -448,7 +444,7 @@ function newCryptoEcosystemFunctions() {
If the Dashboard we need is not already there we create a new one.
*/
let arrayItem = dashboardsArray[i]
let dashboard = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(chartingSpace, 'Dashboard', arrayItem.environmentNode, functionLibraryUiObjectsFromNodes)
let dashboard = UI.projects.superalgos.utilities.children.findOrCreateChildWithReference(chartingSpace, 'Dashboard', arrayItem.environmentNode)
dashboard.name = arrayItem.environmentNode.type + ' ' + arrayItem.networkNode.name
/*
We delete all the existing Time Machines related to the market we are currently installing.
@@ -469,7 +465,7 @@ function newCryptoEcosystemFunctions() {
time machines to lose their reference parent since the install
process deletes them.
*/
functionLibraryNodeDeleter.deleteUIObject(timeMachine, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(timeMachine, rootNodes)
continue
}
let marketTradingTasks = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(session, 'Market Trading Tasks', undefined, true, false, true, false)
@@ -477,7 +473,7 @@ function newCryptoEcosystemFunctions() {
if (marketTradingTasks.payload === undefined) { continue }
if (marketTradingTasks.payload.referenceParent === undefined) { continue }
if (marketTradingTasks.payload.referenceParent.id === market.id) {
functionLibraryNodeDeleter.deleteUIObject(timeMachine, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(timeMachine, rootNodes)
}
}
/*
@@ -485,14 +481,14 @@ function newCryptoEcosystemFunctions() {
*/
for (let j = 0; j < arrayItem.sessionsArray.length; j++) {
let session = arrayItem.sessionsArray[j]
functionLibraryChartingSpaceFunctions.createTimeMachine(dashboard, session, node, arrayItem.networkNode, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
UI.projects.superalgos.functionLibraries.chartingSpaceFunctions.createTimeMachine(dashboard, session, node, arrayItem.networkNode, rootNodes)
}
}
}
}
}
function uninstallMarket(node, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter, functionLibraryChartingSpaceFunctions, functionLibraryDataStorageFunctions) {
function uninstallMarket(node, rootNodes) {
node.payload.uiObject.setInfoMessage('This market is being uninstalled. Please hold on that it might take a while.')
@@ -522,7 +518,7 @@ function newCryptoEcosystemFunctions() {
if (marketTradingTasks.payload === undefined) { continue }
if (marketTradingTasks.payload.referenceParent === undefined) { continue }
if (marketTradingTasks.payload.referenceParent.id === market.id) {
functionLibraryNodeDeleter.deleteUIObject(timeMachine, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(timeMachine, rootNodes)
}
}
@@ -531,7 +527,7 @@ function newCryptoEcosystemFunctions() {
for (let i = 0; i < dashboardArray.length; i++) {
let dashboard = dashboardArray[i]
if (dashboard.timeMachines.length === 0) {
functionLibraryNodeDeleter.deleteUIObject(dashboard, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(dashboard, rootNodes)
}
}
@@ -566,7 +562,7 @@ function newCryptoEcosystemFunctions() {
if (marketReference.payload === undefined) { continue }
if (marketReference.payload.referenceParent === undefined) { continue }
if (marketReference.payload.referenceParent.id === market.id) {
functionLibraryNodeDeleter.deleteUIObject(marketReference, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(marketReference, rootNodes)
}
}
}
@@ -1,4 +1,4 @@
function newDataStorageFunctions() {
function newSuperalgosFunctionLibraryDataStorageFunctions() {
thisObject = {
addAllDataProducts: addAllDataProducts,
addAllDataMineProducts: addAllDataMineProducts,
@@ -15,7 +15,7 @@ function newDataStorageFunctions() {
return thisObject
function addAllDataProducts(node, functionLibraryUiObjectsFromNodes) {
function addAllDataProducts(node) {
/* Validations to see if we can do this or not. */
if (node.payload === undefined) { return }
@@ -46,7 +46,7 @@ function newDataStorageFunctions() {
for (let i = 0; i < botArray.length; i++) {
let bot = botArray[i]
let botProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Bot Products')
let botProducts = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Bot Products')
botProducts.name = bot.name
botProducts.payload.floatingObject.collapseToggle()
@@ -58,47 +58,46 @@ function newDataStorageFunctions() {
'dataProductFolders',
'Data Product',
'Data Product Folder',
undefined,
functionLibraryUiObjectsFromNodes
undefined
)
}
}
}
function addAllDataMineProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addAllDataMineProducts(node, rootNodes) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Data Mine') {
let dataMineProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Data Mine Products')
let dataMineProducts = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Data Mine Products')
dataMineProducts.payload.referenceParent = rootNode
}
}
}
function addAllTradingMineProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addAllTradingMineProducts(node, rootNodes) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Trading Mine') {
let tradingMineProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Trading Mine Products')
let tradingMineProducts = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Trading Mine Products')
tradingMineProducts.payload.referenceParent = rootNode
}
}
}
function addAllLearningMineProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addAllLearningMineProducts(node, rootNodes) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Learning Mine') {
let learningMineProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Learning Mine Products')
let learningMineProducts = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Learning Mine Products')
learningMineProducts.payload.referenceParent = rootNode
}
}
}
function addMissingTradingSessionReferences(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addMissingTradingSessionReferences(node, rootNodes) {
let networkNode = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(node, 'Network Node', undefined, true, false, true, false)
if (networkNode === undefined) { return }
@@ -119,13 +118,13 @@ function newDataStorageFunctions() {
let marketTradingTasks = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(session, 'Market Trading Tasks', undefined, true, false, true, false)
if (node.payload.referenceParent.id !== marketTradingTasks.payload.referenceParent.id) { continue }
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, session, true) === true) {
createSessionReference(node, session, 'Trading Session Reference', functionLibraryUiObjectsFromNodes)
createSessionReference(node, session, 'Trading Session Reference')
}
}
}
}
function addMissingLearningSessionReferences(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addMissingLearningSessionReferences(node, rootNodes) {
let networkNode = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(node, 'Network Node', undefined, true, false, true, false)
if (networkNode === undefined) { return }
@@ -140,26 +139,26 @@ function newDataStorageFunctions() {
let marketLearningTasks = UI.projects.superalgos.utilities.meshes.findNodeInNodeMesh(session, 'Market Learning Tasks', undefined, true, false, true, false)
if (node.payload.referenceParent.id !== marketLearningTasks.payload.referenceParent.id) { continue }
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, session, true) === true) {
createSessionReference(node, session, 'Learning Session Reference', functionLibraryUiObjectsFromNodes)
createSessionReference(node, session, 'Learning Session Reference')
}
}
}
}
function createSessionReference(node, session, nodeType, functionLibraryUiObjectsFromNodes) {
let sessionReference = functionLibraryUiObjectsFromNodes.addUIObject(node, nodeType)
function createSessionReference(node, session, nodeType) {
let sessionReference = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, nodeType)
sessionReference.payload.referenceParent = session
}
function addMissingMarketDataProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingMarketProducts(node, rootNodes, 'Market Data Products', functionLibraryUiObjectsFromNodes)
function addMissingMarketDataProducts(node, rootNodes) {
addMissingMarketProducts(node, rootNodes, 'Market Data Products')
}
function addMissingMarketTradingProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingMarketProducts(node, rootNodes, 'Market Trading Products', functionLibraryUiObjectsFromNodes)
function addMissingMarketTradingProducts(node, rootNodes) {
addMissingMarketProducts(node, rootNodes, 'Market Trading Products')
}
function addMissingMarketProducts(node, rootNodes, newNodeType, functionLibraryUiObjectsFromNodes) {
function addMissingMarketProducts(node, rootNodes, newNodeType) {
if (node.payload.referenceParent === undefined) { return }
if (node.payload.referenceParent.exchangeMarkets === undefined) { return }
let marketsArray = node.payload.referenceParent.exchangeMarkets.markets
@@ -167,21 +166,21 @@ function newDataStorageFunctions() {
for (let i = 0; i < marketsArray.length; i++) {
let market = marketsArray[i]
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, market, true) === true) {
let marketDataProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, newNodeType)
let marketDataProducts = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, newNodeType)
marketDataProducts.payload.referenceParent = market
}
}
}
function addMissingExchangeTradingProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingExchange(node, rootNodes, 'Exchange Trading Products', functionLibraryUiObjectsFromNodes)
function addMissingExchangeTradingProducts(node, rootNodes) {
addMissingExchange(node, rootNodes, 'Exchange Trading Products')
}
function addMissingExchangeDataProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingExchange(node, rootNodes, 'Exchange Data Products', functionLibraryUiObjectsFromNodes)
function addMissingExchangeDataProducts(node, rootNodes) {
addMissingExchange(node, rootNodes, 'Exchange Data Products')
}
function addMissingExchange(node, rootNodes, newNodeType, functionLibraryUiObjectsFromNodes) {
function addMissingExchange(node, rootNodes, newNodeType) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Crypto Ecosystem') {
@@ -191,7 +190,7 @@ function newDataStorageFunctions() {
for (let k = 0; k < cryptoExchanges.exchanges.length; k++) {
let cryptoExchange = cryptoExchanges.exchanges[k]
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, cryptoExchange, true) === true) {
let exchange = functionLibraryUiObjectsFromNodes.addUIObject(node, newNodeType)
let exchange = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, newNodeType)
exchange.payload.referenceParent = cryptoExchange
}
}
@@ -1,4 +1,4 @@
function newDependenciesFilter() {
function newSuperalgosFunctionLibraryDependenciesFilter() {
thisObject = {
createFilter: createFilter
}
@@ -1,4 +1,4 @@
function newLearningSessionFunctions() {
function newSuperalgosFunctionLibraryLearningSessionFunctions() {
thisObject = {
syncronizeSessionWithBackEnd: syncronizeSessionWithBackEnd,
runSession: runSession,
@@ -36,7 +36,7 @@ function newLearningSessionFunctions() {
eventsServerClient.raiseEvent(key, 'Learning Session Status')
}
function runSession(node, functionLibraryProtocolNode, functionLibraryDependenciesFilter, resume, callBackFunction) {
function runSession(node, resume, callBackFunction) {
let networkNode = validations(node)
if (networkNode === undefined) {
/* This means that the validations failed. */
@@ -73,7 +73,7 @@ function newLearningSessionFunctions() {
'Market Order->Limit Order->' +
'Simulated Exchange Events->Simulated Partial Fill->Simulated Actual Rate->Simulated Fees Paid->Formula->'
let tradingSystem = functionLibraryProtocolNode.getProtocolNode(node.tradingSystemReference.payload.referenceParent, false, true, true, false, false, lightingPath)
let tradingSystem = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node.tradingSystemReference.payload.referenceParent, false, true, true, false, false, lightingPath)
lightingPath = '' +
'Trading Engine->' +
@@ -111,7 +111,7 @@ function newLearningSessionFunctions() {
'Balance->Begin Balance->End Balance->' +
'Index->Situation Name->Formula->Periods->'
let tradingEngine = functionLibraryProtocolNode.getProtocolNode(node.tradingEngineReference.payload.referenceParent, false, true, true, false, false, lightingPath)
let tradingEngine = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node.tradingEngineReference.payload.referenceParent, false, true, true, false, false, lightingPath)
lightingPath = '' +
'Learning Session->' +
@@ -120,9 +120,9 @@ function newLearningSessionFunctions() {
'Exchange Account Asset->Asset->' +
'Social Bots->Telegram Bot->'
let session = functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath)
let session = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath)
let dependencyFilter = functionLibraryDependenciesFilter.createFilter(node.tradingSystemReference.payload.referenceParent)
let dependencyFilter = UI.projects.superalgos.functionLibraries.dependenciesFilter.createFilter(node.tradingSystemReference.payload.referenceParent)
/* Raise event to run the session */
let event = {
@@ -145,7 +145,7 @@ function newLearningSessionFunctions() {
}
}
function stopSession(node, functionLibraryProtocolNode, callBackFunction) {
function stopSession(node, callBackFunction) {
let networkNode = validations(node)
if (networkNode === undefined) {
/* This means that the validations failed. */
@@ -1,4 +1,4 @@
function newMineFunctions() {
function newSuperalgosFunctionLibraryMineFunctions() {
thisObject = {
addAllOutputDatasets: addAllOutputDatasets,
addAllDataDependencies: addAllDataDependencies,
@@ -7,7 +7,7 @@ function newMineFunctions() {
return thisObject
function addAllOutputDatasets(node, functionLibraryUiObjectsFromNodes) {
function addAllOutputDatasets(node) {
/* Validations to see if we can do this or not. */
if (node.payload === undefined) { return }
@@ -39,12 +39,11 @@ function newMineFunctions() {
'outputDatasetFolders',
'Output Dataset',
'Output Dataset Folder',
'datasets',
functionLibraryUiObjectsFromNodes
'datasets'
)
}
function addAllDataDependencies(node, functionLibraryUiObjectsFromNodes) {
function addAllDataDependencies(node) {
/* Validations to see if we can do this or not. */
if (node.payload === undefined) { return }
@@ -73,7 +72,7 @@ function newMineFunctions() {
function scanBotArray(botArray) {
for (let i = 0; i < botArray.length; i++) {
let bot = botArray[i]
let botProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Bot Data Dependencies')
let botProducts = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Bot Data Dependencies')
botProducts.name = bot.name
UI.projects.superalgos.utilities.folders.asymetricalFolderStructureCloning(
@@ -84,19 +83,18 @@ function newMineFunctions() {
'dataDependencyFolders',
'Data Dependency',
'Data Dependency Folder',
'datasets',
functionLibraryUiObjectsFromNodes
'datasets'
)
}
}
}
function addAllDataMineDataDependencies(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addAllDataMineDataDependencies(node, rootNodes) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Data Mine') {
let dataMineDataDependencies = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Data Mine Data Dependencies')
let dataMineDataDependencies = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Data Mine Data Dependencies')
dataMineDataDependencies.payload.referenceParent = rootNode
}
}
@@ -1,4 +1,4 @@
function newNodeCloning() {
function newSuperalgosFunctionLibraryNodeCloning() {
const MODULE_NAME = 'Node Cloning'
const ERROR_LOG = true
const logger = newWebDebugLog()
@@ -1,4 +1,4 @@
function newNodeDeleter() {
function newSuperalgosFunctionLibraryNodeDeleter() {
thisObject = {
deleteWorkspace: deleteWorkspace,
deleteUIObject: deleteUIObject
@@ -1,4 +1,4 @@
function newNodePath() {
function newSuperalgosFunctionLibraryNodePath() {
thisObject = {
getNodePath: getNodePath
}
@@ -1,4 +1,4 @@
function newOnFocus() {
function newSuperalgosFunctionLibraryOnFocus() {
thisObject = {
getNodeThatIsOnFocus: getNodeThatIsOnFocus
}
@@ -1,4 +1,4 @@
function newPluginsFunctions() {
function newSuperalgosFunctionLibraryPluginsFunctions() {
thisObject = {
pluginMissingProjects: pluginMissingProjects,
pluginMissingDataMines: pluginMissingDataMines,
@@ -24,18 +24,18 @@ function newPluginsFunctions() {
}
}
function addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) {
function addPluginFileIfNeeded(node, fileNames) {
for (let i = 0; i < fileNames.length; i++) {
let fileName = fileNames[i]
fileName = fileName.replace('.json', '')
if (UI.projects.superalgos.utilities.children.isMissingChildrenByName(node, fileName) === true) {
let child = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Plugin File')
let child = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Plugin File')
child.name = fileName
}
}
}
function pluginMissingProjects(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function pluginMissingProjects(node, rootNodes) {
let url = 'ProjectNames'
httpRequest(undefined, url, onResponse)
@@ -44,7 +44,7 @@ function newPluginsFunctions() {
for (let i = 0; i < projects.length; i++) {
let project = projects[i]
if (UI.projects.superalgos.utilities.children.isMissingChildrenByName(node, project) === true) {
let child = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Plugin Project')
let child = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Plugin Project')
child.name = project
let config = JSON.parse(child.config)
config.codeName = project
@@ -73,7 +73,7 @@ function newPluginsFunctions() {
return config.codeName
}
function pluginMissingDataMines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function pluginMissingDataMines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
@@ -85,11 +85,11 @@ function newPluginsFunctions() {
getPluginFileNames(projectName, 'Data-Mines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
addPluginFileIfNeeded(node, fileNames)
}
}
function pluginMissingTradingMines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function pluginMissingTradingMines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
@@ -101,11 +101,11 @@ function newPluginsFunctions() {
getPluginFileNames(projectName, 'Trading-Mines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
addPluginFileIfNeeded(node, fileNames)
}
}
function pluginMissingTradingSystems(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function pluginMissingTradingSystems(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
@@ -117,11 +117,11 @@ function newPluginsFunctions() {
getPluginFileNames(projectName, 'Trading-Systems', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
addPluginFileIfNeeded(node, fileNames)
}
}
function pluginMissingTradingEngines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function pluginMissingTradingEngines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
@@ -133,11 +133,11 @@ function newPluginsFunctions() {
getPluginFileNames(projectName, 'Trading-Engines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
addPluginFileIfNeeded(node, fileNames)
}
}
function pluginMissingSuperScripts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function pluginMissingSuperScripts(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
@@ -149,11 +149,11 @@ function newPluginsFunctions() {
getPluginFileNames(projectName, 'Super-Scripts', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
addPluginFileIfNeeded(node, fileNames)
}
}
function pluginMissingTutorials(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function pluginMissingTutorials(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
@@ -165,7 +165,7 @@ function newPluginsFunctions() {
getPluginFileNames(projectName, 'Tutorials', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
addPluginFileIfNeeded(node, fileNames)
}
}
}
@@ -1,4 +1,4 @@
function newProtocolNode() {
function newSuperalgosFunctionLibraryProtocolNode() {
const MODULE_NAME = 'Protocol Node'
const ERROR_LOG = true
const logger = newWebDebugLog()
@@ -1,4 +1,4 @@
function newReferenceAttachDetach() {
function newSuperalgosFunctionLibraryAttachDetach() {
thisObject = {
referenceDetachNode: referenceDetachNode,
referenceAttachNode: referenceAttachNode
@@ -1,4 +1,4 @@
function newShortcutKeys() {
function newSuperalgosFunctionLibraryShortcutKeys() {
thisObject = {
getNodeByShortcutKey: getNodeByShortcutKey
}
@@ -1,13 +1,13 @@
function newSuperScriptsFunctions() {
function newSuperalgosFunctionLibrarySuperScriptsFunctions() {
thisObject = {
runSuperScript: runSuperScript
}
return thisObject
function runSuperScript(node, rootNodes, functionLibraryNodeCloning, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
function runSuperScript(node, rootNodes) {
try {
let clone = functionLibraryNodeCloning.getNodeClone
let clone = UI.projects.superalgos.functionLibraries.nodeCloning.getNodeClone
let executionResult = true
let superAction = node
@@ -16,7 +16,7 @@ function newSuperScriptsFunctions() {
spawnPosition.y = target.payload.position.y
if (exchange === undefined) {
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(templateClone, target, target)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.createUiObjectFromNode(templateClone, target, target)
} else {
let definition = getNodeDefinition(target)
for (let i = 0; i < definition.properties.length; i++) {
@@ -36,19 +36,19 @@ function newSuperScriptsFunctions() {
}
}
if (targetExchange === undefined) {
targetExchange = functionLibraryUiObjectsFromNodes.addUIObject(target, exchangeNodeType)
targetExchange = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(target, exchangeNodeType)
targetExchange.payload.referenceParent = exchange
}
let nodesArray = targetExchange[arrayPropertyName]
nodesArray.push(templateClone)
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(templateClone, targetExchange, targetExchange)
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.createUiObjectFromNode(templateClone, targetExchange, targetExchange)
}
}
}
}
function deleteNode(node) {
functionLibraryNodeDeleter.deleteUIObject(node, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(node, rootNodes)
}
/* Validations */
@@ -1,4 +1,4 @@
function newTaskFunctions() {
function newSuperalgosFunctionLibraryTaskFunctions() {
thisObject = {
syncronizeTaskWithBackEnd: syncronizeTaskWithBackEnd,
@@ -78,7 +78,7 @@ function newTaskFunctions() {
eventsServerClient.raiseEvent('Task Manager', 'Task Status', event)
}
function runTask(node, functionLibraryProtocolNode, isDebugging, callBackFunction) {
function runTask(node, isDebugging, callBackFunction) {
let networkNode = validations(node)
if (networkNode === undefined) {
@@ -139,7 +139,7 @@ function newTaskFunctions() {
'Learning Bot->' +
'Data Mine->Trading Mine->Learning Mine->'
let taskDefinition = functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, taskLightingPath)
let taskDefinition = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node, false, true, true, false, false, taskLightingPath)
let networkLightingPath = '->Network->Network Node->' +
'Data Storage->Data Mines Data->Exchange Data Products->' +
@@ -158,7 +158,7 @@ function newTaskFunctions() {
'Market->' +
'Process Definition->'
let networkDefinition = functionLibraryProtocolNode.getProtocolNode(networkNode.payload.parentNode, false, true, true, false, false, networkLightingPath)
let networkDefinition = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(networkNode.payload.parentNode, false, true, true, false, false, networkLightingPath)
let event = {
appSchema: JSON.stringify(SCHEMAS_BY_PROJECT.get('Superalgos').array.appSchema),
@@ -178,7 +178,7 @@ function newTaskFunctions() {
eventsServerClient.raiseEvent('Task Manager', 'Run Task', event)
}
function stopTask(node, functionLibraryProtocolNode, callBackFunction) {
function stopTask(node, callBackFunction) {
let networkNode = validations(node)
if (networkNode === undefined) {
/* This means that the validations failed. */
@@ -268,7 +268,7 @@ function newTaskFunctions() {
return networkNode
}
function runAllTasks(taskManager, functionLibraryProtocolNode) {
function runAllTasks(taskManager) {
for (let i = 0; i < taskManager.tasks.length; i++) {
let node = taskManager.tasks[i]
let menu = node.payload.uiObject.menu
@@ -277,7 +277,7 @@ function newTaskFunctions() {
}
}
function stopAllTasks(taskManager, functionLibraryProtocolNode) {
function stopAllTasks(taskManager) {
for (let i = 0; i < taskManager.tasks.length; i++) {
let node = taskManager.tasks[i]
let menu = node.payload.uiObject.menu
@@ -286,7 +286,7 @@ function newTaskFunctions() {
}
}
function runAllTaskManagers(parent, functionLibraryProtocolNode) {
function runAllTaskManagers(parent) {
for (let i = 0; i < parent.taskManagers.length; i++) {
let node = parent.taskManagers[i]
let menu = node.payload.uiObject.menu
@@ -296,7 +296,7 @@ function newTaskFunctions() {
}
}
function stopAllTaskManagers(parent, functionLibraryProtocolNode) {
function stopAllTaskManagers(parent) {
for (let i = 0; i < parent.taskManagers.length; i++) {
let node = parent.taskManagers[i]
let menu = node.payload.uiObject.menu
@@ -306,7 +306,7 @@ function newTaskFunctions() {
}
}
function runAllExchangeDataTasks(parent, functionLibraryProtocolNode) {
function runAllExchangeDataTasks(parent) {
for (let i = 0; i < parent.exchangeDataTasks.length; i++) {
let node = parent.exchangeDataTasks[i]
let menu = node.payload.uiObject.menu
@@ -316,7 +316,7 @@ function newTaskFunctions() {
}
}
function stopAllExchangeDataTasks(parent, functionLibraryProtocolNode) {
function stopAllExchangeDataTasks(parent) {
for (let i = 0; i < parent.exchangeDataTasks.length; i++) {
let node = parent.exchangeDataTasks[i]
let menu = node.payload.uiObject.menu
@@ -326,7 +326,7 @@ function newTaskFunctions() {
}
}
function runAllExchangeTradingTasks(parent, functionLibraryProtocolNode) {
function runAllExchangeTradingTasks(parent) {
for (let i = 0; i < parent.exchangeTradingTasks.length; i++) {
let node = parent.exchangeTradingTasks[i]
let menu = node.payload.uiObject.menu
@@ -336,7 +336,7 @@ function newTaskFunctions() {
}
}
function stopAllExchangeTradingTasks(parent, functionLibraryProtocolNode) {
function stopAllExchangeTradingTasks(parent) {
for (let i = 0; i < parent.exchangeTradingTasks.length; i++) {
let node = parent.exchangeTradingTasks[i]
let menu = node.payload.uiObject.menu
@@ -346,7 +346,7 @@ function newTaskFunctions() {
}
}
function runAllExchangeLearningTasks(parent, functionLibraryProtocolNode) {
function runAllExchangeLearningTasks(parent) {
for (let i = 0; i < parent.exchangeLearningTasks.length; i++) {
let node = parent.exchangeLearningTasks[i]
let menu = node.payload.uiObject.menu
@@ -356,7 +356,7 @@ function newTaskFunctions() {
}
}
function stopAllExchangeLearningTasks(parent, functionLibraryProtocolNode) {
function stopAllExchangeLearningTasks(parent) {
for (let i = 0; i < parent.exchangeLearningTasks.length; i++) {
let node = parent.exchangeLearningTasks[i]
let menu = node.payload.uiObject.menu
@@ -366,7 +366,7 @@ function newTaskFunctions() {
}
}
function runAllMarketDataTasks(parent, functionLibraryProtocolNode) {
function runAllMarketDataTasks(parent) {
for (let i = 0; i < parent.marketDataTasks.length; i++) {
let node = parent.marketDataTasks[i]
let menu = node.payload.uiObject.menu
@@ -376,7 +376,7 @@ function newTaskFunctions() {
}
}
function stopAllMarketDataTasks(parent, functionLibraryProtocolNode) {
function stopAllMarketDataTasks(parent) {
for (let i = 0; i < parent.marketDataTasks.length; i++) {
let node = parent.marketDataTasks[i]
let menu = node.payload.uiObject.menu
@@ -386,7 +386,7 @@ function newTaskFunctions() {
}
}
function runAllMarketTradingTasks(parent, functionLibraryProtocolNode) {
function runAllMarketTradingTasks(parent) {
for (let i = 0; i < parent.marketTradingTasks.length; i++) {
let node = parent.marketTradingTasks[i]
let menu = node.payload.uiObject.menu
@@ -396,7 +396,7 @@ function newTaskFunctions() {
}
}
function runAllMarketLearningTasks(parent, functionLibraryProtocolNode) {
function runAllMarketLearningTasks(parent) {
for (let i = 0; i < parent.marketLearningTasks.length; i++) {
let node = parent.marketLearningTasks[i]
let menu = node.payload.uiObject.menu
@@ -406,7 +406,7 @@ function newTaskFunctions() {
}
}
function stopAllMarketTradingTasks(parent, functionLibraryProtocolNode) {
function stopAllMarketTradingTasks(parent) {
for (let i = 0; i < parent.marketTradingTasks.length; i++) {
let node = parent.marketTradingTasks[i]
let menu = node.payload.uiObject.menu
@@ -416,7 +416,7 @@ function newTaskFunctions() {
}
}
function stopAllMarketLearningTasks(parent, functionLibraryProtocolNode) {
function stopAllMarketLearningTasks(parent) {
for (let i = 0; i < parent.marketLearningTasks.length; i++) {
let node = parent.marketLearningTasks[i]
let menu = node.payload.uiObject.menu
@@ -426,7 +426,7 @@ function newTaskFunctions() {
}
}
function runAllDataMineTasks(parent, functionLibraryProtocolNode) {
function runAllDataMineTasks(parent) {
for (let i = 0; i < parent.dataMineTasks.length; i++) {
let node = parent.dataMineTasks[i]
let menu = node.payload.uiObject.menu
@@ -436,7 +436,7 @@ function newTaskFunctions() {
}
}
function stopAllDataMineTasks(parent, functionLibraryProtocolNode) {
function stopAllDataMineTasks(parent) {
for (let i = 0; i < parent.dataMineTasks.length; i++) {
let node = parent.dataMineTasks[i]
let menu = node.payload.uiObject.menu
@@ -446,7 +446,7 @@ function newTaskFunctions() {
}
}
function runAllTradingMineTasks(parent, functionLibraryProtocolNode) {
function runAllTradingMineTasks(parent) {
for (let i = 0; i < parent.tradingMineTasks.length; i++) {
let node = parent.tradingMineTasks[i]
let menu = node.payload.uiObject.menu
@@ -456,7 +456,7 @@ function newTaskFunctions() {
}
}
function runAllLearningMineTasks(parent, functionLibraryProtocolNode) {
function runAllLearningMineTasks(parent) {
for (let i = 0; i < parent.learningMineTasks.length; i++) {
let node = parent.learningMineTasks[i]
let menu = node.payload.uiObject.menu
@@ -466,7 +466,7 @@ function newTaskFunctions() {
}
}
function stopAllTradingMineTasks(parent, functionLibraryProtocolNode) {
function stopAllTradingMineTasks(parent) {
for (let i = 0; i < parent.tradingMineTasks.length; i++) {
let node = parent.tradingMineTasks[i]
let menu = node.payload.uiObject.menu
@@ -476,7 +476,7 @@ function newTaskFunctions() {
}
}
function stopAllLearningMineTasks(parent, functionLibraryProtocolNode) {
function stopAllLearningMineTasks(parent) {
for (let i = 0; i < parent.learningMineTasks.length; i++) {
let node = parent.learningMineTasks[i]
let menu = node.payload.uiObject.menu
@@ -486,19 +486,19 @@ function newTaskFunctions() {
}
}
function addMissingExchangeDataTasks(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingExchangeTasks(node, rootNodes, 'Exchange Data Tasks', functionLibraryUiObjectsFromNodes)
function addMissingExchangeDataTasks(node, rootNodes) {
addMissingExchangeTasks(node, rootNodes, 'Exchange Data Tasks')
}
function addMissingExchangeTradingTasks(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingExchangeTasks(node, rootNodes, 'Exchange Trading Tasks', functionLibraryUiObjectsFromNodes)
function addMissingExchangeTradingTasks(node, rootNodes) {
addMissingExchangeTasks(node, rootNodes, 'Exchange Trading Tasks')
}
function addMissingExchangeLearningTasks(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingExchangeTasks(node, rootNodes, 'Exchange Learning Tasks', functionLibraryUiObjectsFromNodes)
function addMissingExchangeLearningTasks(node, rootNodes) {
addMissingExchangeTasks(node, rootNodes, 'Exchange Learning Tasks')
}
function addMissingExchangeTasks(node, rootNodes, newNodeType, functionLibraryUiObjectsFromNodes) {
function addMissingExchangeTasks(node, rootNodes, newNodeType) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Crypto Ecosystem') {
@@ -508,7 +508,7 @@ function newTaskFunctions() {
for (let k = 0; k < cryptoExchanges.exchanges.length; k++) {
let cryptoExchange = cryptoExchanges.exchanges[k]
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, cryptoExchange, true) === true) {
let exchangeTasks = functionLibraryUiObjectsFromNodes.addUIObject(node, newNodeType)
let exchangeTasks = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, newNodeType)
exchangeTasks.payload.referenceParent = cryptoExchange
}
}
@@ -517,19 +517,19 @@ function newTaskFunctions() {
}
}
function addMissingMarketDataTasks(node, functionLibraryUiObjectsFromNodes) {
addMissingMarketTasks(node, 'Market Data Tasks', functionLibraryUiObjectsFromNodes)
function addMissingMarketDataTasks(node) {
addMissingMarketTasks(node, 'Market Data Tasks')
}
function addMissingMarketTradingTasks(node, functionLibraryUiObjectsFromNodes) {
addMissingMarketTasks(node, 'Market Trading Tasks', functionLibraryUiObjectsFromNodes)
function addMissingMarketTradingTasks(node) {
addMissingMarketTasks(node, 'Market Trading Tasks')
}
function addMissingMarketLearningTasks(node, functionLibraryUiObjectsFromNodes) {
addMissingMarketTasks(node, 'Market Learning Tasks', functionLibraryUiObjectsFromNodes)
function addMissingMarketLearningTasks(node) {
addMissingMarketTasks(node, 'Market Learning Tasks')
}
function addMissingMarketTasks(node, newNodeType, functionLibraryUiObjectsFromNodes) {
function addMissingMarketTasks(node, newNodeType) {
if (node.payload === undefined) { return }
if (node.payload.referenceParent === undefined) { return }
if (node.payload.referenceParent.exchangeMarkets === undefined) { return }
@@ -540,43 +540,43 @@ function newTaskFunctions() {
let market = markets[i]
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, market, true) === true) {
let marketDataTasks = functionLibraryUiObjectsFromNodes.addUIObject(node, newNodeType)
let marketDataTasks = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, newNodeType)
marketDataTasks.payload.referenceParent = market
}
}
}
function addMissingDataMineTasks(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingMineTasks(node, rootNodes, 'Data Mine', 'Data Mine Tasks', functionLibraryUiObjectsFromNodes)
function addMissingDataMineTasks(node, rootNodes) {
addMissingMineTasks(node, rootNodes, 'Data Mine', 'Data Mine Tasks')
}
function addMissingTradingMineTasks(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingMineTasks(node, rootNodes, 'Trading Mine', 'Trading Mine Tasks', functionLibraryUiObjectsFromNodes)
function addMissingTradingMineTasks(node, rootNodes) {
addMissingMineTasks(node, rootNodes, 'Trading Mine', 'Trading Mine Tasks')
}
function addMissingLearningMineTasks(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingMineTasks(node, rootNodes, 'Learning Mine', 'Learning Mine Tasks', functionLibraryUiObjectsFromNodes)
function addMissingLearningMineTasks(node, rootNodes) {
addMissingMineTasks(node, rootNodes, 'Learning Mine', 'Learning Mine Tasks')
}
function addMissingMineTasks(node, rootNodes, rootNodeType, newNodeType, functionLibraryUiObjectsFromNodes) {
function addMissingMineTasks(node, rootNodes, rootNodeType, newNodeType) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === rootNodeType) {
let mine = rootNode
if (UI.projects.superalgos.utilities.children.isMissingChildren(node, mine, true) === true) {
let dataMineTasks = functionLibraryUiObjectsFromNodes.addUIObject(node, newNodeType)
let dataMineTasks = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, newNodeType)
dataMineTasks.payload.referenceParent = mine
}
}
}
}
function addAllTasks(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addAllTasks(node, rootNodes) {
if (node.payload === undefined) { return }
if (node.payload.referenceParent === undefined) { return }
let taskManager = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Task Manager')
let taskManager = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Task Manager')
taskManager.name = node.payload.referenceParent.name
taskManager.payload.floatingObject.collapseToggle()
@@ -626,7 +626,7 @@ function newTaskFunctions() {
for (let i = 0; i < botsArray.length; i++) {
let bot = botsArray[i]
let task = functionLibraryUiObjectsFromNodes.addUIObject(taskManager, 'Task')
let task = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(taskManager, 'Task')
if (tradingSystem !== undefined) {
task.name = tradingSystem.name
@@ -637,22 +637,22 @@ function newTaskFunctions() {
let botInstance
switch (bot.type) {
case 'Sensor Bot': {
botInstance = functionLibraryUiObjectsFromNodes.addUIObject(task, 'Sensor Bot Instance')
botInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(task, 'Sensor Bot Instance')
botInstance.name = bot.name
break
}
case 'Indicator Bot': {
botInstance = functionLibraryUiObjectsFromNodes.addUIObject(task, 'Indicator Bot Instance')
botInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(task, 'Indicator Bot Instance')
botInstance.name = bot.name
break
}
case 'Trading Bot': {
botInstance = functionLibraryUiObjectsFromNodes.addUIObject(task, 'Trading Bot Instance')
botInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(task, 'Trading Bot Instance')
botInstance.name = bot.name
break
}
case 'Learning Bot': {
botInstance = functionLibraryUiObjectsFromNodes.addUIObject(task, 'Learning Bot Instance')
botInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(task, 'Learning Bot Instance')
botInstance.name = bot.name
break
}
@@ -663,17 +663,17 @@ function newTaskFunctions() {
let processInstance
switch (bot.type) {
case 'Sensor Bot': {
processInstance = functionLibraryUiObjectsFromNodes.addUIObject(botInstance, 'Sensor Process Instance')
processInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(botInstance, 'Sensor Process Instance')
processInstance.payload.referenceParent = process
break
}
case 'Indicator Bot': {
processInstance = functionLibraryUiObjectsFromNodes.addUIObject(botInstance, 'Indicator Process Instance')
processInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(botInstance, 'Indicator Process Instance')
processInstance.payload.referenceParent = process
break
}
case 'Trading Bot': {
processInstance = functionLibraryUiObjectsFromNodes.addUIObject(botInstance, 'Trading Process Instance')
processInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(botInstance, 'Trading Process Instance')
processInstance.payload.referenceParent = process
if (node.payload.parentNode === undefined) { return }
@@ -698,7 +698,7 @@ function newTaskFunctions() {
break
function addSession(sessionType) {
session = functionLibraryUiObjectsFromNodes.addUIObject(processInstance, sessionType)
session = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(processInstance, sessionType)
session.name = task.name
let config = JSON.parse(session.config)
config.folderName = session.name.split(" ").join("-")
@@ -715,7 +715,7 @@ function newTaskFunctions() {
}
}
case 'Learning Bot': {
processInstance = functionLibraryUiObjectsFromNodes.addUIObject(botInstance, 'Learning Process Instance')
processInstance = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(botInstance, 'Learning Process Instance')
processInstance.payload.referenceParent = process
let session
@@ -724,7 +724,7 @@ function newTaskFunctions() {
break
function addSession(sessionType) {
session = functionLibraryUiObjectsFromNodes.addUIObject(processInstance, sessionType)
session = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(processInstance, sessionType)
session.name = task.name
let config = JSON.parse(session.config)
config.folderName = session.name.split(" ").join("-")
@@ -1,4 +1,4 @@
function newTradingSessionFunctions() {
function newSuperalgosFunctionLibraryTradingSessionFunctions() {
thisObject = {
syncronizeSessionWithBackEnd: syncronizeSessionWithBackEnd,
runSession: runSession,
@@ -36,7 +36,7 @@ function newTradingSessionFunctions() {
eventsServerClient.raiseEvent(key, 'Trading Session Status')
}
function runSession(node, functionLibraryProtocolNode, functionLibraryDependenciesFilter, resume, callBackFunction) {
function runSession(node, resume, callBackFunction) {
let networkNode = validations(node)
if (networkNode === undefined) {
/* This means that the validations failed. */
@@ -73,7 +73,7 @@ function newTradingSessionFunctions() {
'Market Order->Limit Order->' +
'Simulated Exchange Events->Simulated Partial Fill->Simulated Actual Rate->Simulated Fees Paid->Formula->'
let tradingSystem = functionLibraryProtocolNode.getProtocolNode(node.tradingSystemReference.payload.referenceParent, false, true, true, false, false, lightingPath)
let tradingSystem = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node.tradingSystemReference.payload.referenceParent, false, true, true, false, false, lightingPath)
lightingPath = '' +
'Trading Engine->' +
@@ -111,7 +111,7 @@ function newTradingSessionFunctions() {
'Balance->Begin Balance->End Balance->' +
'Index->Situation Name->Formula->Periods->'
let tradingEngine = functionLibraryProtocolNode.getProtocolNode(node.tradingEngineReference.payload.referenceParent, false, true, true, false, false, lightingPath)
let tradingEngine = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node.tradingEngineReference.payload.referenceParent, false, true, true, false, false, lightingPath)
lightingPath = '' +
'Backtesting Session->Paper Trading Session->Forward Testing Session->Live Trading Session->' +
@@ -120,9 +120,9 @@ function newTradingSessionFunctions() {
'Exchange Account Asset->Asset->' +
'Social Bots->Telegram Bot->'
let session = functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath)
let session = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath)
let dependencyFilter = functionLibraryDependenciesFilter.createFilter(node.tradingSystemReference.payload.referenceParent)
let dependencyFilter = UI.projects.superalgos.functionLibraries.dependenciesFilter.createFilter(node.tradingSystemReference.payload.referenceParent)
/* Raise event to run the session */
let event = {
@@ -145,7 +145,7 @@ function newTradingSessionFunctions() {
}
}
function stopSession(node, functionLibraryProtocolNode, callBackFunction) {
function stopSession(node, callBackFunction) {
let networkNode = validations(node)
if (networkNode === undefined) {
/* This means that the validations failed. */
@@ -1,4 +1,4 @@
function newUiObjectsFromNodes() {
function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
thisObject = {
syncronizeTasksFoundAtWorkspaceWithBackEnd: syncronizeTasksFoundAtWorkspaceWithBackEnd,
syncronizeTradingSessionsFoundAtWorkspaceWithBackEnd: syncronizeTradingSessionsFoundAtWorkspaceWithBackEnd,
@@ -158,26 +158,26 @@ function newUiObjectsFromNodes() {
}
}
function syncronizeTasksFoundAtWorkspaceWithBackEnd(functionLibraryTaskFunctions) {
function syncronizeTasksFoundAtWorkspaceWithBackEnd() {
for (let i = 0; i < tasksFoundAtWorkspace.length; i++) {
let node = tasksFoundAtWorkspace[i]
functionLibraryTaskFunctions.syncronizeTaskWithBackEnd(node)
UI.projects.superalgos.functionLibraries.taskFunctions.syncronizeTaskWithBackEnd(node)
}
tasksFoundAtWorkspace = undefined
}
function syncronizeTradingSessionsFoundAtWorkspaceWithBackEnd(functionLibrarySessionFunctions) {
function syncronizeTradingSessionsFoundAtWorkspaceWithBackEnd() {
for (let i = 0; i < tradingSessionsFoundAtWorkspace.length; i++) {
let node = tradingSessionsFoundAtWorkspace[i]
functionLibrarySessionFunctions.syncronizeSessionWithBackEnd(node)
UI.projects.superalgos.functionLibraries.tradingSessionFunctions.syncronizeSessionWithBackEnd(node)
}
tradingSessionsFoundAtWorkspace = undefined
}
function syncronizeLearningSessionsFoundAtWorkspaceWithBackEnd(functionLibrarySessionFunctions) {
function syncronizeLearningSessionsFoundAtWorkspaceWithBackEnd() {
for (let i = 0; i < learningSessionsFoundAtWorkspace.length; i++) {
let node = learningSessionsFoundAtWorkspace[i]
functionLibrarySessionFunctions.syncronizeSessionWithBackEnd(node)
UI.projects.superalgos.functionLibraries.tradingSessionFunctions.syncronizeSessionWithBackEnd(node)
}
learningSessionsFoundAtWorkspace = undefined
}
@@ -1,4 +1,4 @@
function newWebhookFunctions() {
function newSuperalgosFunctionLibraryWebhookFunctions() {
thisObject = {
sendTestMessage: sendTestMessage
}
@@ -1,11 +1,11 @@
function newWorkspaceFunctions() {
function newSuperalgosFunctionLibraryWorkspaceFunctions() {
thisObject = {
addMissingWorkspaceProjects: addMissingWorkspaceProjects
}
return thisObject
function addMissingWorkspaceProjects(node, rootNodes, functionLibraryUiObjectsFromNodes) {
function addMissingWorkspaceProjects(node, rootNodes) {
let url = 'ProjectNames'
httpRequest(undefined, url, onResponse)
@@ -23,7 +23,7 @@ function newWorkspaceFunctions() {
}
if (alreadyExist === false) {
let child = functionLibraryUiObjectsFromNodes.addUIObject(node, project + ' Project', rootNodes, project)
let child = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, project + ' Project', rootNodes, project)
child.project = project
}
}
@@ -168,6 +168,7 @@ function newCircularMenu() {
if (menuItem.visible === true) {
if (menuItem.nextAction === action) {
menuItem.internalClick()
if (menuItems === undefined) { return } // It might happen that the action executed is to delete the node that has this menu.
}
}
}
@@ -156,7 +156,6 @@ function newLayer() {
thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL
thisObject.container.frame.height = 70
let functionLibraryProtocolNode = newProtocolNode()
let lightingPath =
'->Layer->' +
'Data Product->' +
@@ -192,7 +191,7 @@ function newLayer() {
'Text->Text Condition->Text Position->Point->Text Formula->Text Style->' +
'Plotter Panel->Javascript Code->Panel Data->Data Formula->Text Style->' +
'Nodes Highlights->Nodes Values->Nodes Errors->Nodes Warnings->Nodes Infos->Nodes Status->Nodes Progress->Nodes Running->Nodes Announcements->Record Values->'
thisObject.definition = functionLibraryProtocolNode.getProtocolNode(thisObject.payload.node, false, true, true, false, false, lightingPath)
thisObject.definition = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(thisObject.payload.node, false, true, true, false, false, lightingPath)
/* Without this I can not continue, because I can not even show error. */
if (thisObject.payload === undefined) {
@@ -13,8 +13,7 @@ function newSuperalgosUtilitiesFolders() {
destinationFoldersArrayPropertyName,
clonedObjectType,
destinationFolderType,
originObjectArrayPropertyName,
functionLibraryUiObjectsFromNodes
originObjectArrayPropertyName
) {
/*
This function will scan one branch of the workspace, and recreate
@@ -43,7 +42,7 @@ function newSuperalgosUtilitiesFolders() {
In this first Use Case, we are going to connect each orgin object clone
to its origin object counter part.
*/
let clonedObject = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, clonedObjectType)
let clonedObject = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(destinationNode, clonedObjectType)
clonedObject.payload.referenceParent = originObject
} else {
/*
@@ -54,7 +53,7 @@ function newSuperalgosUtilitiesFolders() {
let originObjectArray = originObject[originObjectArrayPropertyName]
for (let n = 0; n < originObjectArray.length; n++) {
let originObjectArrayItem = originObjectArray[n]
let clonedObject = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, clonedObjectType)
let clonedObject = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(destinationNode, clonedObjectType)
clonedObject.payload.referenceParent = originObjectArrayItem
}
}
@@ -75,7 +74,7 @@ function newSuperalgosUtilitiesFolders() {
}
}
if (found === false) {
destinationFolder = functionLibraryUiObjectsFromNodes.addUIObject(destinationNode, destinationFolderType)
destinationFolder = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(destinationNode, destinationFolderType)
destinationFolder.name = originFolder.name
}
asymetricalFolderStructureCloning(
@@ -86,8 +85,7 @@ function newSuperalgosUtilitiesFolders() {
destinationFoldersArrayPropertyName,
clonedObjectType,
destinationFolderType,
originObjectArrayPropertyName,
functionLibraryUiObjectsFromNodes
originObjectArrayPropertyName
)
}
break
@@ -124,7 +124,7 @@ function newSuperalgosUtilitiesNodeChildren() {
}
}
function findOrCreateChildWithReference(startingNode, childType, referencedNode, functionLibraryUiObjectsFromNodes) {
function findOrCreateChildWithReference(startingNode, childType, referencedNode) {
/*
This function find the child node of starting node that references
refereced node. If there is none, then it creates a child and stablish
@@ -132,7 +132,7 @@ function newSuperalgosUtilitiesNodeChildren() {
*/
let child
if (isMissingChildren(startingNode, referencedNode, true) === true) {
child = functionLibraryUiObjectsFromNodes.addUIObject(startingNode, childType)
child = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(startingNode, childType)
child.payload.referenceParent = referencedNode
} else {
child = findChildReferencingThisNode(startingNode, referencedNode)
@@ -140,7 +140,7 @@ function newSuperalgosUtilitiesNodeChildren() {
return child
}
function findAndRecreateChildWithReference(startingNode, childType, referencedNode, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
function findAndRecreateChildWithReference(startingNode, childType, referencedNode, rootNodes) {
/*
This function finds the child of the starting node that references
the reference node and if found it deletes it. Existing or not
@@ -149,9 +149,9 @@ function newSuperalgosUtilitiesNodeChildren() {
let child
child = findChildReferencingThisNode(startingNode, referencedNode)
if (child !== undefined) {
functionLibraryNodeDeleter.deleteUIObject(child, rootNodes)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(child, rootNodes)
}
child = functionLibraryUiObjectsFromNodes.addUIObject(startingNode, childType)
child = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(startingNode, childType)
child.payload.referenceParent = referencedNode
return child
}
+10 -3
View File
@@ -24,7 +24,7 @@
tradingSystem = bot.simulationState.tradingSystem
exchangeId = bot.exchange.toLowerCase()
let key = bot.KEY
let secret = bot.SECRET
@@ -135,11 +135,18 @@
logError("createOrder -> type = " + type);
logError("createOrder -> amount = " + amount);
logError("createOrder -> price = " + price);
if (err.message.indexOf('API-key format invalid') >= 0) {
if (
err.message.indexOf('API-key format invalid') >= 0 ||
err.message.indexOf('Invalid API-key, IP, or permissions for action.') >= 0 ||
err.message.indexOf('"code":-2015') >= 0
) {
logError ('The exchange says the API key provided is not good or it is not in the correct format. This is what you are using:')
errorFooter()
}
if (err.message.indexOf('Signature for this request is not valid.') >= 0) {
if (
err.message.indexOf('Signature for this request is not valid.') >= 0 ||
err.message.indexOf('"code":-1022') >= 0
) {
logError ('The exchange says the secret provided is not good, incorrect or not in the correct format. This is what you are using:')
errorFooter()
}
+7 -7
View File
@@ -116,23 +116,23 @@ function newAnimation() {
for (const [key, timeConsumed] of performanceMap.entries()) {
row++
let labelToPrint = key + ' ' + timeConsumed.toFixed(4)
UI.projects.superalgos.utilities.drawPrint.printLabel(labelToPrint, 10, 100 + row * 30, 1, 20, UI_COLOR.RED)
UI.projects.superalgos.utilities.drawPrint.printLabel(labelToPrint, 10,undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
let percentage = timeConsumed * 100 / totalTimeConsumed
labelToPrint = key + ' ' + percentage.toFixed(1) + '%'
UI.projects.superalgos.utilities.drawPrint.printLabel(labelToPrint, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
UI.projects.superalgos.utilities.drawPrint.printLabel(labelToPrint, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
}
/* Other Variables */
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable1, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable1, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable2, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable2, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable3, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable3, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable4, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
UI.projects.superalgos.utilities.drawPrint.printLabel(DEBUG.variable4, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
row++
UI.projects.superalgos.utilities.drawPrint.printLabel('Animation Frame Per Seconds: ' + ANIMATION_FRAME_PER_SECONDS, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
UI.projects.superalgos.utilities.drawPrint.printLabel('Animation Frame Per Seconds: ' + ANIMATION_FRAME_PER_SECONDS, 300, undefined, undefined, 100 + row * 30, 1, 20, UI_COLOR.RED, 'Left')
}
/* Video Recording */
+10
View File
@@ -108,6 +108,7 @@ function newCanvas() {
projectInstance.events = {}
projectInstance.utilities = {}
projectInstance.globals = {}
projectInstance.functionLibraries = {}
projectInstance.events.onMouseWheelMap = new Map()
projectInstance.events.onMouseOverMap = new Map()
@@ -202,6 +203,15 @@ function newCanvas() {
projectInstance.globals[globalDefinition.propertyName] = eval(globalDefinition.functionName + '()')
}
}
/* Set up Function Libraries of this Project */
if (projectDefinition.functionLibraries !== undefined) {
for (let j = 0; j < projectDefinition.functionLibraries.length; j++) {
let functionLibraryDefinition = projectDefinition.functionLibraries[j]
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
}
}
}
thisObject.animation.start()