Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop
This commit is contained in:
commit
3e4814add9
161 files changed
+118254
-35076
No files matched your search
@@ -2,6 +2,7 @@ Data-Storage
|
||||
Log-Files
|
||||
My-Workspaces
|
||||
My-Social-Trading-Data
|
||||
My-Network-Nodes-Data
|
||||
debug.log
|
||||
.DS_Store
|
||||
*.db
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "C:\\Superalgos\\Platform"
|
||||
},
|
||||
{
|
||||
"path": "C:\\Superalgos\\Projects"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "C:\\Superalgos\\TaskServer"
|
||||
},
|
||||
{
|
||||
"path": "C:\\Superalgos\\Projects"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"search.maintainFileSearchCache": true
|
||||
}
|
||||
}
|
||||
+160
-103
@@ -16,7 +16,8 @@ function newWebApp() {
|
||||
setupRootObject(UI, 'UI')
|
||||
setupRootObject(SA, 'SA')
|
||||
await UI.projects.socialTrading.modules.webSocketsClient.initialize()
|
||||
setupHomePage()
|
||||
loadWUserProfileTimeline()
|
||||
loadWhoToFollow()
|
||||
setupEventHandlers()
|
||||
} catch (err) {
|
||||
console.log('[ERROR] initialize -> err.stack = ' + err.stack)
|
||||
@@ -94,21 +95,16 @@ function newWebApp() {
|
||||
}
|
||||
}
|
||||
|
||||
async function setupHomePage() {
|
||||
let queryMessage
|
||||
let query
|
||||
/*
|
||||
Test Query User Profiles.
|
||||
*/
|
||||
queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.UNFOLLOWED_USER_PROFILES,
|
||||
async function loadWUserProfileTimeline() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.EVENTS,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST,
|
||||
amountRequested: 3,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST,
|
||||
amountRequested: 100,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST
|
||||
}
|
||||
|
||||
query = {
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
@@ -116,23 +112,151 @@ function newWebApp() {
|
||||
await UI.projects.socialTrading.modules.webSocketsClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(showProfiles)
|
||||
.then(addToContentDiv)
|
||||
.catch(onError)
|
||||
|
||||
async function showProfiles(profiles) {
|
||||
console.log(profiles)
|
||||
document.getElementById('context-cell')
|
||||
|
||||
addWhoToFollowTable(profiles)
|
||||
}
|
||||
|
||||
/*
|
||||
Error Handling
|
||||
*/
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
}
|
||||
|
||||
function addToContentDiv(events) {
|
||||
try {
|
||||
let contentDiv = document.getElementById('content-div')
|
||||
|
||||
/*
|
||||
Delete al current content.
|
||||
*/
|
||||
while (contentDiv.childNodes.length > 4) {
|
||||
let childToRemove = contentDiv.childNodes[contentDiv.childNodes.length - 1]
|
||||
contentDiv.removeChild(childToRemove)
|
||||
}
|
||||
/*
|
||||
Render the timeline.
|
||||
*/
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
let event = events[i]
|
||||
|
||||
let postDiv = document.createElement("div")
|
||||
postDiv.setAttribute("class", "post-div")
|
||||
let textNode
|
||||
|
||||
switch (event.eventType) {
|
||||
case SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " POSTED " + event.postText)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " FOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " UNFOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
postDiv.appendChild(textNode)
|
||||
contentDiv.appendChild(postDiv)
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log('[ERROR] err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadWhoToFollow() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.UNFOLLOWED_USER_PROFILES,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST,
|
||||
amountRequested: 3,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP
|
||||
}
|
||||
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(addWhoToFollowTable)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
}
|
||||
|
||||
function addWhoToFollowTable(profiles) {
|
||||
|
||||
let contextCell = document.getElementById('who-to-follow-cell')
|
||||
let table = document.createElement("table")
|
||||
let tblBody = document.createElement("tbody")
|
||||
|
||||
for (let i = 0; i < profiles.length; i++) {
|
||||
let profile = profiles[i]
|
||||
let row = document.createElement("tr")
|
||||
|
||||
let cell = document.createElement("td")
|
||||
addProfileToFollowTable(cell, profile)
|
||||
row.appendChild(cell)
|
||||
|
||||
tblBody.appendChild(row)
|
||||
}
|
||||
|
||||
table.appendChild(tblBody)
|
||||
contextCell.appendChild(table)
|
||||
table.setAttribute("class", "who-to-follow-table")
|
||||
|
||||
function addProfileToFollowTable(htmlElement, profile) {
|
||||
let table = document.createElement("table")
|
||||
let tblBody = document.createElement("tbody")
|
||||
|
||||
let row = document.createElement("tr")
|
||||
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let textNode = document.createTextNode('Profile Picture')
|
||||
cell.appendChild(textNode)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let textNode = document.createTextNode(profile.userProfileHandle)
|
||||
cell.appendChild(textNode)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let span = document.createElement("span")
|
||||
let button = document.createElement("button")
|
||||
let text = document.createTextNode('Follow')
|
||||
|
||||
span.setAttribute("id", "profile-to-follow-span-" + profile.userProfileId)
|
||||
button.setAttribute("id", "profile-to-follow-button-" + profile.userProfileId)
|
||||
button.name = 'Follow Profile'
|
||||
button.userProfileId = profile.userProfileId
|
||||
|
||||
span.setAttribute("class", "profile-to-follow-span")
|
||||
button.setAttribute("class", "profile-to-follow-button")
|
||||
|
||||
button.appendChild(text)
|
||||
span.appendChild(button)
|
||||
cell.appendChild(span)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
|
||||
tblBody.appendChild(row)
|
||||
|
||||
table.appendChild(tblBody)
|
||||
htmlElement.appendChild(table)
|
||||
table.setAttribute("class", "profile-to-follow-table")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupEventHandlers() {
|
||||
@@ -150,7 +274,7 @@ function newWebApp() {
|
||||
let textArea = document.getElementById("new-post-text-area")
|
||||
await sendNewPostEvent(
|
||||
textArea.value
|
||||
)
|
||||
)
|
||||
.then(updateTextArea)
|
||||
.catch(onError)
|
||||
|
||||
@@ -163,7 +287,7 @@ function newWebApp() {
|
||||
await sendTargetUserProfileEvent(
|
||||
event.target.userProfileId,
|
||||
SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE
|
||||
)
|
||||
)
|
||||
.then(updateButton)
|
||||
.catch(onError)
|
||||
|
||||
@@ -180,7 +304,7 @@ function newWebApp() {
|
||||
await sendTargetUserProfileEvent(
|
||||
event.target.userProfileId,
|
||||
SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE
|
||||
)
|
||||
)
|
||||
.then(updateButton)
|
||||
.catch(onError)
|
||||
|
||||
@@ -210,89 +334,22 @@ function newWebApp() {
|
||||
}
|
||||
}
|
||||
|
||||
function addWhoToFollowTable(profiles) {
|
||||
|
||||
let contextCell = document.getElementById('who-to-follow-cell')
|
||||
let table = document.createElement("table")
|
||||
let tblBody = document.createElement("tbody")
|
||||
|
||||
for (let i = 0; i < profiles.length; i++) {
|
||||
let profile = profiles[i]
|
||||
let row = document.createElement("tr")
|
||||
|
||||
let cell = document.createElement("td")
|
||||
addProfileToFollowTable(cell, profile)
|
||||
row.appendChild(cell)
|
||||
|
||||
tblBody.appendChild(row)
|
||||
}
|
||||
|
||||
table.appendChild(tblBody)
|
||||
contextCell.appendChild(table)
|
||||
table.setAttribute("class", "who-to-follow-table")
|
||||
}
|
||||
|
||||
function addProfileToFollowTable(htmlElement, profile) {
|
||||
let table = document.createElement("table")
|
||||
let tblBody = document.createElement("tbody")
|
||||
|
||||
let row = document.createElement("tr")
|
||||
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let cellText = document.createTextNode('Profile Picture')
|
||||
cell.appendChild(cellText)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let cellText = document.createTextNode(profile.userProfileHandle)
|
||||
cell.appendChild(cellText)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let span = document.createElement("span")
|
||||
let button = document.createElement("button")
|
||||
let text = document.createTextNode('Follow')
|
||||
|
||||
span.setAttribute("id", "profile-to-follow-span-" + profile.userProfileId)
|
||||
button.setAttribute("id", "profile-to-follow-button-" + profile.userProfileId)
|
||||
button.name = 'Follow Profile'
|
||||
button.userProfileId = profile.userProfileId
|
||||
|
||||
span.setAttribute("class", "profile-to-follow-span")
|
||||
button.setAttribute("class", "profile-to-follow-button")
|
||||
|
||||
button.appendChild(text)
|
||||
span.appendChild(button)
|
||||
cell.appendChild(span)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
|
||||
tblBody.appendChild(row)
|
||||
|
||||
table.appendChild(tblBody)
|
||||
htmlElement.appendChild(table)
|
||||
table.setAttribute("class", "profile-to-follow-table")
|
||||
}
|
||||
|
||||
async function sendTargetUserProfileEvent(
|
||||
userProfileId,
|
||||
eventType
|
||||
) {
|
||||
eventType
|
||||
) {
|
||||
|
||||
return new Promise((resolve, reject) => { asyncCall(resolve, reject) })
|
||||
|
||||
async function asyncCall(resolve, reject) {
|
||||
let eventMessage
|
||||
let event
|
||||
|
||||
|
||||
eventMessage = {
|
||||
eventType: eventType,
|
||||
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
|
||||
targetUserProfileId: userProfileId,
|
||||
timestamp: new Date()
|
||||
timestamp: (new Date()).valueOf()
|
||||
}
|
||||
|
||||
event = {
|
||||
@@ -315,20 +372,20 @@ function newWebApp() {
|
||||
}
|
||||
|
||||
async function sendNewPostEvent(
|
||||
postText
|
||||
) {
|
||||
postText
|
||||
) {
|
||||
|
||||
return new Promise((resolve, reject) => { asyncCall(resolve, reject) })
|
||||
|
||||
async function asyncCall(resolve, reject) {
|
||||
let eventMessage
|
||||
let event
|
||||
|
||||
|
||||
eventMessage = {
|
||||
eventType: SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST,
|
||||
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
|
||||
text: postText,
|
||||
timestamp: new Date()
|
||||
postText: postText,
|
||||
timestamp: (new Date()).valueOf()
|
||||
}
|
||||
|
||||
event = {
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>>
|
||||
<div class="content-div">
|
||||
<div class="post-placeholder">
|
||||
<div id="content-div" class="content-div">
|
||||
<div id="post-placeholder" class="post-placeholder">
|
||||
Placeholder
|
||||
</div>
|
||||
<div class="new-post-div">
|
||||
<div id="new-post-div" class="new-post-div">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Profile Pic</td>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
exports.newDesktopRoot = function newDesktopRoot() {
|
||||
/*
|
||||
This module represents the execution root of the Desktop App.
|
||||
We use this module that is outside the Desktop folder to
|
||||
load all node dependencies and get them ready to the actual App.
|
||||
*/
|
||||
let thisObject = {
|
||||
run: run
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
async function run() {
|
||||
/*
|
||||
The DK object is accesible everywhere at the Superalgos Desktop App.
|
||||
It provides access to all modules built for this App.
|
||||
*/
|
||||
global.DK = {}
|
||||
/*
|
||||
The SA object is accesible everywhere at the Superalgos Desktop App.
|
||||
It provides access to all modules built for Superalgos in general.
|
||||
*/
|
||||
global.SA = {}
|
||||
/* Load Environment Variables */
|
||||
let ENVIRONMENT = require('./EnvironmentForDebug.js');
|
||||
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
|
||||
global.env = ENVIRONMENT_MODULE
|
||||
/*
|
||||
First thing is to load the project schema file.
|
||||
*/
|
||||
global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA)
|
||||
/*
|
||||
Setting up the modules that will be available, defined at the Project Schema file.
|
||||
*/
|
||||
let MULTI_PROJECT = require('./MultiProject.js');
|
||||
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
|
||||
MULTI_PROJECT_MODULE.initialize(DK, 'DK')
|
||||
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
|
||||
/*
|
||||
Setting up external dependencies.
|
||||
*/
|
||||
SA.nodeModules = {
|
||||
fs: require('fs'),
|
||||
util: require('util'),
|
||||
path: require('path'),
|
||||
web3: require('web3'),
|
||||
ws: require('ws'),
|
||||
open: require('open'),
|
||||
http: require('http'),
|
||||
octokit: require("@octokit/rest"),
|
||||
simpleGit: require('simple-git'),
|
||||
nodeFetch: require('node-fetch')
|
||||
}
|
||||
|
||||
/*
|
||||
We will use this User Profile for Testing Purposes.
|
||||
{
|
||||
"githubUsername": "Test-Network-Client-Profile",
|
||||
"address": "0xA0dCDA81b42C5EBDc45EC2875C72274B67560246",
|
||||
"privateKey": "0x5fed4817a87431c8a328d0936561e63f45b6db289adac6125b9306ded644dfe9"
|
||||
}
|
||||
*/
|
||||
|
||||
DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID = "baa2f02c-2920-4edb-a103-d452fc61d82f"
|
||||
DK.TEST_NETWORK_CLIENT_USER_PROFILE_HANDLE = "Test-Network-Client-Profile"
|
||||
DK.TEST_NETWORK_CLIENT_USER_PROFILE_PRIVATE_KEY = "0x5fed4817a87431c8a328d0936561e63f45b6db289adac6125b9306ded644dfe9"
|
||||
|
||||
run()
|
||||
|
||||
async function run() {
|
||||
DK.app = require('./Desktop/DesktopApp.js').newDesktopApp()
|
||||
await DK.app.run()
|
||||
console.log('Superalgos Desktop App is Running!')
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -4,12 +4,11 @@ exports.newEnvironment = function () {
|
||||
WEB_SERVER_URL: 'localhost',
|
||||
CLIENT_WEB_SOCKETS_INTERFACE_PORT: 18041,
|
||||
CLIENT_HTTP_INTERFACE_PORT: 34248,
|
||||
PATH_TO_TASK_SERVER: './TaskServer',
|
||||
PATH_TO_DATA_STORAGE: './Data-Storage',
|
||||
PATH_TO_PROJECTS: './Projects',
|
||||
PATH_TO_LOG_FILES: './Log-Files',
|
||||
PATH_TO_PROJECTS_REQUIRED: './Projects',
|
||||
PATH_TO_PROJECT_SCHEMA: '../Projects/ProjectsSchema.json',
|
||||
PATH_TO_PROJECT_SCHEMA: './Projects/ProjectsSchema.json',
|
||||
PATH_TO_CLIENT: './Platform',
|
||||
PATH_TO_DEFAULT_WORKSPACE: './Projects/Foundations/Plugins/Workspaces',
|
||||
PATH_TO_MY_WORKSPACES: './My-Workspaces',
|
||||
|
||||
@@ -8,7 +8,6 @@ exports.newEnvironment = function () {
|
||||
DESKTOP_WEB_SOCKETS_INTERFACE_HOST: 'localhost',
|
||||
CLIENT_HTTP_INTERFACE_PORT: 34248,
|
||||
DESKTOP_HTTP_INTERFACE_PORT: 34249,
|
||||
PATH_TO_TASK_SERVER: './TaskServer',
|
||||
PATH_TO_DATA_STORAGE: './Data-Storage',
|
||||
PATH_TO_PROJECTS: './Projects',
|
||||
PATH_TO_LOG_FILES: './Log-Files',
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
exports.newNetworkNode = function newNetworkNode() {
|
||||
|
||||
let thisObject = {
|
||||
socialGraphService: undefined,
|
||||
storage: undefined,
|
||||
run: run
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function run() {
|
||||
async function run() {
|
||||
/*
|
||||
Let's start the Network Interfaces
|
||||
*/
|
||||
NT.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface()
|
||||
NT.webSocketsInterface.initialize()
|
||||
|
||||
start()
|
||||
|
||||
async function start() {
|
||||
let socialGraphService = NT.projects.socialTrading.modules.socialGraph.newSocialGraph()
|
||||
await socialGraphService.initialize()
|
||||
}
|
||||
thisObject.socialGraphService = NT.projects.socialTrading.modules.socialGraph.newNetworkModulesSocialGraph()
|
||||
await thisObject.socialGraphService.initialize()
|
||||
|
||||
thisObject.storage = NT.projects.socialTrading.modules.storage.newSocialTradingModulesStorage()
|
||||
thisObject.storage.initialize()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
exports.newNetworkRoot = function newNetworkRoot() {
|
||||
/*
|
||||
This module represents the execution root of the Network Node.
|
||||
We use this module that is outside the Network folder to
|
||||
load all node dependencies and get them ready to the actual node.
|
||||
*/
|
||||
let thisObject = {
|
||||
run: run
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
async function run() {
|
||||
/*
|
||||
The NT object is accesible everywhere at the Superalgos Network.
|
||||
It provides access to all modules built for this Network.
|
||||
*/
|
||||
global.NT = {}
|
||||
/*
|
||||
The SA object is accesible everywhere at the Superalgos Network.
|
||||
It provides access to all modules built for Superalgos in general.
|
||||
*/
|
||||
global.SA = {}
|
||||
/* Load Environment Variables */
|
||||
let ENVIRONMENT = require('./EnvironmentForDebug.js');
|
||||
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
|
||||
global.env = ENVIRONMENT_MODULE
|
||||
/*
|
||||
First thing is to load the project schema file.
|
||||
*/
|
||||
global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA)
|
||||
/*
|
||||
Setting up the modules that will be available, defined at the Project Schema file.
|
||||
*/
|
||||
let MULTI_PROJECT = require('./MultiProject.js');
|
||||
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
|
||||
MULTI_PROJECT_MODULE.initialize(NT, 'NT')
|
||||
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
|
||||
/*
|
||||
Setting up external dependencies.
|
||||
*/
|
||||
SA.nodeModules = {
|
||||
fs: require('fs'),
|
||||
path: require('path'),
|
||||
util: require('util'),
|
||||
nodeFetch: require('node-fetch'),
|
||||
web3: require('web3'),
|
||||
ws: require('ws'),
|
||||
simpleGit: require('simple-git')
|
||||
}
|
||||
|
||||
/*
|
||||
We will use this User Profile for testing purposes.
|
||||
{
|
||||
"githubUsername": "Test-Network-Node-Profile",
|
||||
"address": "0xa153469c57A91F5a59Fc6c45A37aD8dbad85e417",
|
||||
"privateKey": "0xac498ae59407e6b68429a814f64da2339550f93a767578e28c161ff119159271"
|
||||
}
|
||||
*/
|
||||
NT.NETWORK_NODE_USER_PROFILE_HANDLE = "Test-Network-Node-Profile"
|
||||
NT.NETWORK_NODE_USER_PROFILE_PRIVATE_KEY = "0xac498ae59407e6b68429a814f64da2339550f93a767578e28c161ff119159271"
|
||||
|
||||
NT.app = require('./Network/NetwokNode.js').newNetworkNode()
|
||||
NT.app.run()
|
||||
|
||||
console.log('Superalgos Network is Running.')
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
async function doGithub() {
|
||||
|
||||
const { Octokit } = require("@octokit/rest")
|
||||
const { Octokit } = SA.nodeModules.octokit
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: token,
|
||||
@@ -93,7 +93,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
while (lastPage === false) {
|
||||
try {
|
||||
page++
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
let listResponse = await octokit[endpoint][method]({
|
||||
owner,
|
||||
repo,
|
||||
@@ -204,7 +204,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
try {
|
||||
const repo = repository
|
||||
const owner = 'Superalgos'
|
||||
const { Octokit } = require("@octokit/rest")
|
||||
const { Octokit } = SA.nodeModules.octokit
|
||||
const octokit = new Octokit({
|
||||
auth: token,
|
||||
userAgent: 'Superalgos Beta 11'
|
||||
@@ -223,7 +223,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
try {
|
||||
page++
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
|
||||
let listResponse = await octokit.rest.pulls.list({
|
||||
owner: owner,
|
||||
@@ -284,7 +284,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
/*
|
||||
Lets get the files changed at this Pull Request.
|
||||
*/
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
let listResponse = await octokit.rest.pulls.listFiles({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -309,7 +309,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
console.log('[WARN] Github Server -> mergeGithubPullRequests -> Merge Failed -> Pull Request "' + pullRequest.title + '" not merged because Github could not merge it. -> mergeResponse.message = ' + mergeResponse.data.message)
|
||||
} else {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Merge Succed -> Pull Request "' + pullRequest.title + '" successfully merged. -> mergeResponse.message = ' + mergeResponse.data.message)
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -333,7 +333,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
let pullRequestFile = filesChanged[j]
|
||||
let fileContentUrl = pullRequestFile.raw_url
|
||||
if (fileContentUrl.indexOf('Governance/Plugins/User-Profiles') >= 0) {
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -341,7 +341,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because it was detected that a User Profile file... \n\n' + fileContentUrl + '\n\n...was submitted together with ' + (filesChanged.length - 1) + ' other file/s. User Profiles files as per the Governance System rules, must be the only file present at a Pull Request in order to pass all the validations and be automatically merged.'
|
||||
});
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -379,7 +379,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
if (githubUsername !== fileName) {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #2 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Github Username is not equal to the File Name. -> Github Username = ' + githubUsername + '-> fileName = ' + fileName)
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -387,7 +387,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because it was detected that the Github User "' + githubUsername + '" who submitted it, is not equal to the name of the User Profile Plugin File.\n\n File Name = "' + fileName + '"'
|
||||
});
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -402,8 +402,8 @@ exports.newGithubServer = function newGithubServer() {
|
||||
/*
|
||||
Validation #3: The file changed at the PR is a User Profile.
|
||||
*/
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
fileContent = await CL.projects.foundations.utilities.webAccess.fetchAPIDataFile(fileContentUrl)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
fileContent = await PL.projects.foundations.utilities.webAccess.fetchAPIDataFile(fileContentUrl)
|
||||
userProfile = JSON.parse(fileContent)
|
||||
|
||||
if (userProfile.type !== 'User Profile') {
|
||||
@@ -421,7 +421,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
if (messageSigned !== githubUsername) {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #4 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Github Username is not equal to the Message Signed at the User Profile. -> Github Username = ' + githubUsername + '-> messageSigned = ' + messageSigned)
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -429,7 +429,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because it was detected that the Github User "' + githubUsername + '" who submitted it, is not equal to the Message Signed at the User Profile.\n\n Message Signed = "' + messageSigned + '"'
|
||||
});
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -447,7 +447,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
if (userProfile.name !== githubUsername) {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #5 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Github Username is not equal to the User Profile node\'s name. -> Github Username = ' + githubUsername + '-> userProfile.name = ' + userProfile.name)
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -455,7 +455,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because it was detected that the Github User "' + githubUsername + '" who submitted it, is not equal to the User Profile node\'s name.\n\n User Profile Name = "' + userProfile.name + '"'
|
||||
});
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -495,7 +495,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #6 Failed -> Pull Request "' + pullRequest.title + '" not merged because the User Profile Id already exists and belongs to another User Profile on record. -> Profile Id = ' + userProfile.id + '-> User Profile with the same Id = ' + testUserProfile)
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -503,7 +503,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because the User Profile Id already exists and belongs to another User Profile on record. \n\nUser Profile Id = "' + userProfile.id + '" \n\n User Profile with the same Id = "' + testUserProfile + '"'
|
||||
});
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -538,7 +538,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
let config = JSON.parse(otherUserProfile.config)
|
||||
let messageSigned = JSON.stringify(config.signature)
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.recoverAddress(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.recoverAddress(
|
||||
messageSigned
|
||||
)
|
||||
userProfileIdMap.set(serverResponse.address, otherUserProfile.name)
|
||||
@@ -546,7 +546,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
let config = JSON.parse(userProfile.config)
|
||||
let messageSigned = JSON.stringify(config.signature)
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.recoverAddress(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.recoverAddress(
|
||||
messageSigned
|
||||
)
|
||||
|
||||
@@ -556,7 +556,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #7 Failed -> Pull Request "' + pullRequest.title + '" not merged because the User Profile Blockchain Account already exists and belongs to another User Profile on record. -> Profile Blockchain Account = ' + serverResponse.address + '-> User Profile with the same Blockchain Account = ' + testUserProfile)
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -564,7 +564,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because the User Profile Blockchain Account already exists and belongs to another User Profile on record. \n\nUser Profile Blockchain Account = "' + serverResponse.address + '" \n\n User Profile with the same Blockchain Account = "' + testUserProfile + '"'
|
||||
});
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -582,7 +582,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
/*
|
||||
All validations passed, we will proceed an merge this Pull Request.
|
||||
*/
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
mergeResponse = await octokit.rest.pulls.merge({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -603,7 +603,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
try {
|
||||
page++
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
|
||||
let listResponse = await octokit.rest.pulls.list({
|
||||
owner: owner,
|
||||
@@ -631,7 +631,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
for (let i = 0; i < githubPrListMaster.length; i++) {
|
||||
let pullRequest = githubPrListMaster[i]
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -639,7 +639,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
body: 'Hi, this is the Superalgos Governance System taking notice that you have submitted a pull request directly to the master branch.\n\nThanks for submitting a PR to the Superalgos Project. We value every contribution and everyone is welcome to send PRs. Unfortunatelly we are not merging pull requests directly into the master branch. Consider resubmitting to the develop branch intstead. For your convinienve, you can swithch branches from within the app, at the footer of the Docs tab. \n\n I will close this pull request now and look forward for your next contribution either to the develop branch or any other branch available for this purpose.'
|
||||
});
|
||||
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
|
||||
@@ -24,13 +24,13 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
/*
|
||||
We will create an HTTP Server and leave it running forever.
|
||||
*/
|
||||
SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.CLIENT_HTTP_INTERFACE_PORT)
|
||||
/* Starting the browser now is optional */
|
||||
if (process.argv.includes("noBrowser")) {
|
||||
//Running Client only with no UI.
|
||||
} else {
|
||||
SA.nodeModules.open('http://localhost:' + global.env.CLIENT_HTTP_INTERFACE_PORT)
|
||||
}
|
||||
SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.CLIENT_HTTP_INTERFACE_PORT)
|
||||
/* Starting the browser now is optional */
|
||||
if (process.argv.includes("noBrowser")) {
|
||||
//Running Client only with no UI.
|
||||
} else {
|
||||
SA.nodeModules.open('http://localhost:' + global.env.CLIENT_HTTP_INTERFACE_PORT)
|
||||
}
|
||||
}
|
||||
|
||||
function onHttpRequest(httpRequest, httpResponse) {
|
||||
@@ -43,16 +43,17 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
case 'WEB3':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
let params = JSON.parse(body)
|
||||
|
||||
switch (params.method) {
|
||||
case 'getNetworkClientStatus': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.getNetworkClientStatus(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.getNetworkClientStatus(
|
||||
params.host,
|
||||
params.port,
|
||||
params.interface
|
||||
@@ -63,7 +64,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'createWalletAccount': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.createWalletAccount(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.createWalletAccount(
|
||||
params.entropy
|
||||
)
|
||||
|
||||
@@ -72,7 +73,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'getWalletBalances': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.getWalletBalances(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.getWalletBalances(
|
||||
params.host,
|
||||
params.port,
|
||||
params.interface,
|
||||
@@ -84,7 +85,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'signData': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.signData(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.signData(
|
||||
params.privateKey,
|
||||
params.data
|
||||
)
|
||||
@@ -94,7 +95,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'recoverAddress': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.recoverAddress(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.recoverAddress(
|
||||
params.signature
|
||||
)
|
||||
|
||||
@@ -103,7 +104,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'mnemonicToPrivateKey': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.mnemonicToPrivateKey(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.mnemonicToPrivateKey(
|
||||
params.mnemonic
|
||||
)
|
||||
|
||||
@@ -131,10 +132,11 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'CCXT':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
let params = JSON.parse(body)
|
||||
|
||||
switch (params.method) {
|
||||
@@ -242,9 +244,11 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
}
|
||||
case 'New-Message': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
function processRequest(messageReceived) {
|
||||
if (messageReceived === undefined) { return }
|
||||
|
||||
let timestamp = (new Date()).valueOf()
|
||||
let source = requestPath[3]
|
||||
let exchange = requestPath[4]
|
||||
@@ -291,10 +295,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
{
|
||||
switch (requestPath[2]) { // switch by command
|
||||
case 'Save-Node-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestPath[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Nodes'
|
||||
@@ -322,10 +328,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Concept-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestPath[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Concepts'
|
||||
@@ -353,10 +361,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Topic-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestPath[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Topics'
|
||||
@@ -384,10 +394,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Tutorial-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestPath[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Tutorials'
|
||||
@@ -415,10 +427,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Review-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestPath[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Reviews'
|
||||
@@ -446,10 +460,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Book-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestPath[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Books'
|
||||
@@ -625,8 +641,8 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
contribute()
|
||||
|
||||
async function contribute() {
|
||||
const { lookpath } = require('lookpath');
|
||||
const gitpath = await lookpath('git');
|
||||
const { lookpath } = SA.nodeModules.lookpath
|
||||
const gitpath = await lookpath('git')
|
||||
if (gitpath === undefined) {
|
||||
console.log('[ERROR] `git` not installed.')
|
||||
} else {
|
||||
@@ -665,7 +681,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
async function doGit() {
|
||||
const simpleGit = require('simple-git');
|
||||
const simpleGit = SA.nodeModules.simpleGit
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
@@ -696,7 +712,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
async function doGithub() {
|
||||
|
||||
const { Octokit } = require("@octokit/rest")
|
||||
const { Octokit } = SA.nodeModules.octokit
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: token,
|
||||
@@ -760,7 +776,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
update()
|
||||
|
||||
async function update() {
|
||||
const { lookpath } = require('lookpath');
|
||||
const { lookpath } = SA.nodeModules.lookpath
|
||||
const gitpath = await lookpath('git');
|
||||
if (gitpath === undefined) {
|
||||
console.log('[ERROR] `git` not installed.')
|
||||
@@ -790,7 +806,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
async function doGit() {
|
||||
const simpleGit = require('simple-git');
|
||||
const simpleGit = SA.nodeModules.simpleGit
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
@@ -831,7 +847,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
checkout()
|
||||
|
||||
async function checkout() {
|
||||
const { lookpath } = require('lookpath');
|
||||
const { lookpath } = SA.nodeModules.lookpath
|
||||
const gitpath = await lookpath('git');
|
||||
if (gitpath === undefined) {
|
||||
console.log('[ERROR] `git` not installed.')
|
||||
@@ -855,7 +871,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
async function doGit() {
|
||||
const simpleGit = require('simple-git');
|
||||
const simpleGit = SA.nodeModules.simpleGit
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
@@ -890,7 +906,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
branch()
|
||||
|
||||
async function branch() {
|
||||
const { lookpath } = require('lookpath');
|
||||
const { lookpath } = SA.nodeModules.lookpath
|
||||
const gitpath = await lookpath('git');
|
||||
if (gitpath === undefined) {
|
||||
console.log('[ERROR] `git` not installed.')
|
||||
@@ -918,7 +934,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
async function doGit() {
|
||||
const simpleGit = require('simple-git');
|
||||
const simpleGit = SA.nodeModules.simpleGit
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
@@ -991,16 +1007,18 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
related to the Governance System are implemented here and routed
|
||||
to the backend Servers that can process them.
|
||||
*/
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let params = JSON.parse(body)
|
||||
|
||||
switch (params.method) {
|
||||
case 'getGithubStars': {
|
||||
|
||||
let serverResponse = await CL.servers.GITHUB_SERVER.getGithubStars(
|
||||
let serverResponse = await PL.servers.GITHUB_SERVER.getGithubStars(
|
||||
params.repository,
|
||||
params.username,
|
||||
params.token
|
||||
@@ -1011,7 +1029,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'getGithubWatchers': {
|
||||
|
||||
let serverResponse = await CL.servers.GITHUB_SERVER.getGithubWatchers(
|
||||
let serverResponse = await PL.servers.GITHUB_SERVER.getGithubWatchers(
|
||||
params.repository,
|
||||
params.username,
|
||||
params.token
|
||||
@@ -1022,7 +1040,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'getGithubForks': {
|
||||
|
||||
let serverResponse = await CL.servers.GITHUB_SERVER.getGithubForks(
|
||||
let serverResponse = await PL.servers.GITHUB_SERVER.getGithubForks(
|
||||
params.repository,
|
||||
params.username,
|
||||
params.token
|
||||
@@ -1033,7 +1051,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'mergePullRequests': {
|
||||
|
||||
let serverResponse = await CL.servers.GITHUB_SERVER.mergePullRequests(
|
||||
let serverResponse = await PL.servers.GITHUB_SERVER.mergePullRequests(
|
||||
params.commitMessage,
|
||||
params.username,
|
||||
params.token
|
||||
@@ -1044,7 +1062,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
case 'payContributors': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.payContributors(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.payContributors(
|
||||
params.contractAddress,
|
||||
params.contractAbi,
|
||||
params.paymentsArray,
|
||||
@@ -1068,7 +1086,11 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
message: err.message,
|
||||
stack: err.stack
|
||||
}
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse)
|
||||
try {
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse)
|
||||
} catch(err) {
|
||||
// we just try to reponnd to the web app, but maybe the response has already been sent.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1375,6 +1397,11 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
let folder = unescape(requestPath[3])
|
||||
let fileName = unescape(requestPath[4])
|
||||
|
||||
/*Beta 12 Refactoring Code: Remove this before realeasing beta 12.*/
|
||||
if (fileName === 'Superalgos-CL.json') {
|
||||
fileName = 'Superalgos-PL.json'
|
||||
}
|
||||
|
||||
let response = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
project,
|
||||
folder,
|
||||
@@ -1407,10 +1434,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'SavePlugin':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
if (body === undefined) { return }
|
||||
|
||||
let plugin = JSON.parse(body)
|
||||
let project = requestPath[2]
|
||||
let folder = requestPath[3]
|
||||
@@ -1541,10 +1570,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'SaveWorkspace':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
|
||||
if (body === undefined) { return }
|
||||
|
||||
let fileContent = body
|
||||
let fileName = unescape(requestPath[2])
|
||||
let filePath = global.env.PATH_TO_MY_WORKSPACES + '/' + fileName + '.json'
|
||||
@@ -1693,11 +1724,16 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
default:
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_CLIENT)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_CLIENT)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err.stack)
|
||||
if (err.stack !== undefined) {
|
||||
console.log(err.stack)
|
||||
}
|
||||
if (err.message !== undefined) {
|
||||
console.log('[ERROR] onHttpRequest -> err.message = ' + err.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@
|
||||
//console.log('[INFO] Client -> Task Manager Server -> runTask -> Task Name = ' + message.event.taskName)
|
||||
//console.log('[INFO] Client -> Task Manager Server -> runTask -> Task Id = ' + message.event.taskId)
|
||||
|
||||
let path = global.env.PATH_TO_TASK_SERVER + '/Task.js'
|
||||
let path = './TaskServerRoot.js'
|
||||
|
||||
/* Workarround to avoid having the same debug port at the forked process which makes it crash. */
|
||||
for (let i = 0; i < process.execArgv.length; i++) {
|
||||
@@ -263,7 +263,7 @@
|
||||
responseWaiters.set(command.callerId, responseCallBack)
|
||||
}
|
||||
|
||||
CL.servers.EVENT_SERVER.onMessage(JSON.stringify(command), thisObject.onMessage)
|
||||
PL.servers.EVENT_SERVER.onMessage(JSON.stringify(command), thisObject.onMessage)
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Client -> Task Manager Server -> sendCommand -> Error Sending Command to Events Server -> command = ' + JSON.stringify(command))
|
||||
console.log('[ERROR] Client -> Task Manager Server -> sendCommand -> Error Sending Command to Events Server -> error = ' + err.stack)
|
||||
|
||||
@@ -15,7 +15,7 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
run: run
|
||||
}
|
||||
|
||||
const Web3 = require('web3');
|
||||
const Web3 = SA.nodeModules.web3
|
||||
let web3Map = new Map()
|
||||
|
||||
return thisObject
|
||||
@@ -241,7 +241,7 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
|
||||
async function mnemonicToPrivateKey(mnemonic) {
|
||||
try {
|
||||
const ethers = require('ethers')
|
||||
const ethers = SA.nodeModules.ethers
|
||||
let wallet = ethers.Wallet.fromMnemonic(mnemonic)
|
||||
|
||||
if (wallet.privateKey !== undefined) {
|
||||
@@ -269,7 +269,7 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
let privateKey = response.privateKey
|
||||
|
||||
for (let i = 0; i < paymentsArray.length; i++) {
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(10000)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(10000)
|
||||
let payment = paymentsArray[i]
|
||||
sendTokens(
|
||||
i + 1,
|
||||
@@ -288,14 +288,14 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
console.log('---------------------------------------------------------------------------------------------------------------------------------------------------')
|
||||
console.log('')
|
||||
|
||||
const Tx = require('ethereumjs-tx').Transaction;
|
||||
const Tx = SA.nodeModules.ethereumjsTx.Transaction;
|
||||
const web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org/'))
|
||||
const amount = web3.utils.toHex(tokenAmount)
|
||||
privateKey = privateKey.replace('0x', '')
|
||||
const privateKeyBuffer = Buffer.from(privateKey, 'hex')
|
||||
const contractAbiObject = JSON.parse(contractAbi)
|
||||
const contract = new web3.eth.Contract(contractAbiObject, contractAddress, { from: fromAddress })
|
||||
const Common = require('ethereumjs-common').default
|
||||
const Common = SA.nodeModules.ethereumjsCommon.default
|
||||
const BSC_FORK = Common.forCustomChain(
|
||||
'mainnet',
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
const WEB_SOCKET = require('ws')
|
||||
const WEB_SOCKET = SA.nodeModules.ws
|
||||
let socketServer
|
||||
let port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
|
||||
|
||||
CL.servers.EVENT_SERVER.onMessage(messageToEventServer, onResponse)
|
||||
PL.servers.EVENT_SERVER.onMessage(messageToEventServer, onResponse)
|
||||
|
||||
function onResponse(message) {
|
||||
socket.send(message)
|
||||
@@ -97,7 +97,8 @@
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Client -> Web Sockets Interface -> run -> setUpWebSocketServer -> err.message = ' + err.message.substring(0, 1000))
|
||||
console.log('[ERROR] Client -> Web Sockets Interface -> run -> setUpWebSocketServer -> err.message = ' + err.message)
|
||||
console.log('[ERROR] Client -> Web Sockets Interface -> run -> setUpWebSocketServer -> err.message = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
+162
-190
@@ -1,194 +1,166 @@
|
||||
exports.newPlatformApp = function newPlatformApp() {
|
||||
|
||||
/* Load Environment Variables */
|
||||
let ENVIRONMENT = require('../Environment.js');
|
||||
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
|
||||
global.env = ENVIRONMENT_MODULE
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
if (err.message && err.message.indexOf("EADDRINUSE") > 0) {
|
||||
console.log("The Superalgos Platform Client cannot be started. Reason: the port configured migth be being used by another application, or Superalgos Platform Client might be already running.")
|
||||
return
|
||||
}
|
||||
console.log('[ERROR] Platform App -> uncaughtException -> err.message = ' + err.message)
|
||||
console.log('[ERROR] Platform App -> uncaughtException -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] Platform App -> uncaughtException -> err = ' + err)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
// Signal user that a necissary node module is missing
|
||||
if (reason.code == 'MODULE_NOT_FOUND') {
|
||||
console.log("[ERROR] Dependency library not found. Please try running the 'node setup' command and then restart the Superalgos Platform Client.")
|
||||
console.log('[ERROR] Platform App -> reason = ' + JSON.stringify(reason))
|
||||
process.exit(1)
|
||||
}
|
||||
console.log('[ERROR] Platform App -> unhandledRejection -> reason = ' + JSON.stringify(reason))
|
||||
console.log('[ERROR] Platform App -> unhandledRejection -> p = ' + JSON.stringify(p))
|
||||
process.exit(1)
|
||||
})
|
||||
try {
|
||||
/* Callbacks default responses. */
|
||||
|
||||
global.DEFAULT_OK_RESPONSE = {
|
||||
result: "Ok",
|
||||
message: "Operation Succeeded"
|
||||
};
|
||||
|
||||
global.DEFAULT_FAIL_RESPONSE = {
|
||||
result: "Fail",
|
||||
message: "Operation Failed"
|
||||
};
|
||||
|
||||
global.DEFAULT_RETRY_RESPONSE = {
|
||||
result: 'Retry',
|
||||
message: 'Retry Later'
|
||||
let thisObject = {
|
||||
run: run
|
||||
}
|
||||
|
||||
global.CUSTOM_OK_RESPONSE = {
|
||||
result: 'Ok, but check Message',
|
||||
message: 'Custom Message'
|
||||
return thisObject
|
||||
|
||||
async function run() {
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
if (err.message && err.message.indexOf("EADDRINUSE") > 0) {
|
||||
console.log("The Superalgos Platform Client cannot be started. Reason: the port configured migth be being used by another application, or Superalgos Platform Client might be already running.")
|
||||
return
|
||||
}
|
||||
console.log('[ERROR] Platform App -> uncaughtException -> err.message = ' + err.message)
|
||||
console.log('[ERROR] Platform App -> uncaughtException -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] Platform App -> uncaughtException -> err = ' + err)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
// Signal user that a necissary node module is missing
|
||||
if (reason.code == 'MODULE_NOT_FOUND') {
|
||||
console.log("[ERROR] Dependency library not found. Please try running the 'node setup' command and then restart the Superalgos Platform Client.")
|
||||
console.log('[ERROR] Platform App -> reason = ' + JSON.stringify(reason))
|
||||
process.exit(1)
|
||||
}
|
||||
console.log('[ERROR] Platform App -> unhandledRejection -> reason = ' + JSON.stringify(reason))
|
||||
console.log('[ERROR] Platform App -> unhandledRejection -> p = ' + JSON.stringify(p))
|
||||
process.exit(1)
|
||||
})
|
||||
try {
|
||||
/* Callbacks default responses. */
|
||||
|
||||
global.DEFAULT_OK_RESPONSE = {
|
||||
result: "Ok",
|
||||
message: "Operation Succeeded"
|
||||
};
|
||||
|
||||
global.DEFAULT_FAIL_RESPONSE = {
|
||||
result: "Fail",
|
||||
message: "Operation Failed"
|
||||
};
|
||||
|
||||
global.DEFAULT_RETRY_RESPONSE = {
|
||||
result: 'Retry',
|
||||
message: 'Retry Later'
|
||||
}
|
||||
|
||||
global.CUSTOM_OK_RESPONSE = {
|
||||
result: 'Ok, but check Message',
|
||||
message: 'Custom Message'
|
||||
}
|
||||
|
||||
global.CUSTOM_FAIL_RESPONSE = {
|
||||
result: 'Fail Because',
|
||||
message: 'Custom Message'
|
||||
}
|
||||
|
||||
/* Servers */
|
||||
let WEB_SERVER = require('./Client/webServer.js')
|
||||
let DATA_FILE_SERVER = require('./Client/dataFileServer.js')
|
||||
let PROJECT_FILE_SERVER = require('./Client/projectFileServer.js')
|
||||
let UI_FILE_SERVER = require('./Client/uiFileServer.js')
|
||||
let PLUGIN_SERVER = require('./Client/pluginServer.js')
|
||||
let EVENT_SERVER = require('./Client/eventServer.js')
|
||||
let TASK_MANAGER_SERVER = require('./Client/taskManagerServer.js')
|
||||
let CCXT_SERVER = require('./Client/ccxtServer.js')
|
||||
let WEB3_SERVER = require('./Client/web3Server.js')
|
||||
let GITHUB_SERVER = require('./Client/githubServer.js')
|
||||
|
||||
/* Network Interfaces */
|
||||
let WEB_SOCKETS_INTERFACE = require('./Client/webSocketsInterface.js')
|
||||
let HTTP_INTERFACE = require('./Client/httpInterface.js')
|
||||
/*
|
||||
Setting up servers running inside this Client.
|
||||
*/
|
||||
PL.servers = {}
|
||||
console.log('SUPERALGOS PLATFORM CLIENT SERVERS:')
|
||||
console.log('')
|
||||
|
||||
PL.servers.WEB_SERVER = WEB_SERVER.newWebServer()
|
||||
PL.servers.WEB_SERVER.initialize()
|
||||
PL.servers.WEB_SERVER.run()
|
||||
console.log('Web Server .................................................. Started')
|
||||
|
||||
PL.servers.UI_FILE_SERVER = UI_FILE_SERVER.newUIFileServer()
|
||||
PL.servers.UI_FILE_SERVER.initialize()
|
||||
PL.servers.UI_FILE_SERVER.run()
|
||||
console.log('UI File Server .............................................. Started')
|
||||
|
||||
PL.servers.PROJECT_FILE_SERVER = PROJECT_FILE_SERVER.newProjectFileServer()
|
||||
PL.servers.PROJECT_FILE_SERVER.initialize()
|
||||
PL.servers.PROJECT_FILE_SERVER.run()
|
||||
console.log('Project File Server ......................................... Started')
|
||||
|
||||
PL.servers.PLUGIN_SERVER = PLUGIN_SERVER.newPluginServer()
|
||||
PL.servers.PLUGIN_SERVER.initialize()
|
||||
PL.servers.PLUGIN_SERVER.run()
|
||||
console.log('Plugin Server ............................................... Started')
|
||||
|
||||
PL.servers.DATA_FILE_SERVER = DATA_FILE_SERVER.newDataFileServer()
|
||||
PL.servers.DATA_FILE_SERVER.initialize()
|
||||
PL.servers.DATA_FILE_SERVER.run()
|
||||
console.log('Data File Server ............................................ Started')
|
||||
|
||||
PL.servers.EVENT_SERVER = EVENT_SERVER.newEventServer()
|
||||
PL.servers.EVENT_SERVER.initialize()
|
||||
PL.servers.EVENT_SERVER.run()
|
||||
console.log('Events Server ............................................... Started')
|
||||
|
||||
TASK_MANAGER_SERVER = TASK_MANAGER_SERVER.newTaskManagerServer()
|
||||
TASK_MANAGER_SERVER.initialize()
|
||||
TASK_MANAGER_SERVER.run()
|
||||
console.log('Task Manager Server ......................................... Started')
|
||||
|
||||
PL.servers.CCXT_SERVER = CCXT_SERVER.newCCXTServer()
|
||||
PL.servers.CCXT_SERVER.initialize()
|
||||
PL.servers.CCXT_SERVER.run()
|
||||
console.log('CCXT Server ................................................. Started')
|
||||
|
||||
PL.servers.WEB3_SERVER = WEB3_SERVER.newWeb3Server()
|
||||
PL.servers.WEB3_SERVER.initialize()
|
||||
PL.servers.WEB3_SERVER.run()
|
||||
console.log('WEB3 Server ................................................. Started')
|
||||
|
||||
PL.servers.GITHUB_SERVER = GITHUB_SERVER.newGithubServer()
|
||||
PL.servers.GITHUB_SERVER.initialize()
|
||||
PL.servers.GITHUB_SERVER.run()
|
||||
console.log('Github Server ............................................... Started')
|
||||
|
||||
console.log('')
|
||||
console.log('SUPERALGOS PLATFORM CLIENT INTERFACES:')
|
||||
console.log('')
|
||||
|
||||
WEB_SOCKETS_INTERFACE = WEB_SOCKETS_INTERFACE.newWebSocketsInterface()
|
||||
WEB_SOCKETS_INTERFACE.initialize()
|
||||
console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
HTTP_INTERFACE = HTTP_INTERFACE.newHttpInterface()
|
||||
HTTP_INTERFACE.initialize()
|
||||
console.log('Http Interface .............................................. Listening at port ' + global.env.CLIENT_HTTP_INTERFACE_PORT)
|
||||
|
||||
console.log('')
|
||||
console.log("You are running Superalgos Beta 11")
|
||||
console.log('')
|
||||
console.log("What's new? These are the main new features in this version:")
|
||||
console.log('')
|
||||
console.log('Governance System ........................................... Automates the distribution of SA Tokens and allow users to vote on the direction of the project.')
|
||||
console.log('TensorFlow Integration ...................................... Allows creating and training ML models and use them in trading strategies.')
|
||||
console.log('')
|
||||
console.log("What's next? This is the current development pipeline:")
|
||||
console.log('')
|
||||
console.log('Superalgos P2P Network ...................................... Will allow algo-traders to share trading signals with Superalgos users consuming these signals via a mobile app.')
|
||||
console.log('Real-time Trading Signals ................................... Will allow users to emit trading signals and be rewarded with SA Tokens.')
|
||||
console.log('Superalgos Mobile ........................................... Will allow users to consume trading signals for free and autonomously execute trades from their mobile phones.')
|
||||
console.log('Ethereum Integration ........................................ Will allow mining data from an Ethereum network node, and bring it into the Superalgos workflow. [Looking for an Ethereum dev that would like to continue this line of development.]')
|
||||
|
||||
console.log('')
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Platform App -> Error = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
global.CUSTOM_FAIL_RESPONSE = {
|
||||
result: 'Fail Because',
|
||||
message: 'Custom Message'
|
||||
}
|
||||
|
||||
/* Servers */
|
||||
let WEB_SERVER = require('./Client/webServer.js')
|
||||
let DATA_FILE_SERVER = require('./Client/dataFileServer.js')
|
||||
let PROJECT_FILE_SERVER = require('./Client/projectFileServer.js')
|
||||
let UI_FILE_SERVER = require('./Client/uiFileServer.js')
|
||||
let PLUGIN_SERVER = require('./Client/pluginServer.js')
|
||||
let EVENT_SERVER = require('./Client/eventServer.js')
|
||||
let TASK_MANAGER_SERVER = require('./Client/taskManagerServer.js')
|
||||
let CCXT_SERVER = require('./Client/ccxtServer.js')
|
||||
let WEB3_SERVER = require('./Client/web3Server.js')
|
||||
let GITHUB_SERVER = require('./Client/githubServer.js')
|
||||
|
||||
/* Network Interfaces */
|
||||
let WEB_SOCKETS_INTERFACE = require('./Client/webSocketsInterface.js')
|
||||
let HTTP_INTERFACE = require('./Client/httpInterface.js')
|
||||
|
||||
|
||||
/*
|
||||
The CL object is accesible everywhere at the Superalgos Client.
|
||||
It provides access to all modules built for this Client.
|
||||
*/
|
||||
global.CL = {}
|
||||
/*
|
||||
The SA object is accesible everywhere at the Superalgos Client.
|
||||
It provides access to all modules built for Superalgos in general.
|
||||
*/
|
||||
global.SA = {}
|
||||
/*
|
||||
First thing is to load the project schema file.
|
||||
*/
|
||||
global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA)
|
||||
/*
|
||||
Setting up the modules that will be available for the Servers Running inside this Client
|
||||
*/
|
||||
let MULTI_PROJECT = require('../MultiProject.js');
|
||||
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
|
||||
MULTI_PROJECT_MODULE.initialize(CL, 'CL')
|
||||
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
|
||||
/*
|
||||
Setting up external dependencies.
|
||||
*/
|
||||
SA.nodeModules = {
|
||||
fs: require('fs'),
|
||||
nodeFetch: require('node-fetch'),
|
||||
open: require('open'),
|
||||
http: require('http'),
|
||||
ccxt: require('ccxt')
|
||||
}
|
||||
/*
|
||||
Setting up servers running inside this Client.
|
||||
*/
|
||||
CL.servers = {}
|
||||
console.log('SUPERALGOS PLATFORM CLIENT SERVERS:')
|
||||
console.log('')
|
||||
|
||||
CL.servers.WEB_SERVER = WEB_SERVER.newWebServer()
|
||||
CL.servers.WEB_SERVER.initialize()
|
||||
CL.servers.WEB_SERVER.run()
|
||||
console.log('Web Server .................................................. Started')
|
||||
|
||||
CL.servers.UI_FILE_SERVER = UI_FILE_SERVER.newUIFileServer()
|
||||
CL.servers.UI_FILE_SERVER.initialize()
|
||||
CL.servers.UI_FILE_SERVER.run()
|
||||
console.log('UI File Server .............................................. Started')
|
||||
|
||||
CL.servers.PROJECT_FILE_SERVER = PROJECT_FILE_SERVER.newProjectFileServer()
|
||||
CL.servers.PROJECT_FILE_SERVER.initialize()
|
||||
CL.servers.PROJECT_FILE_SERVER.run()
|
||||
console.log('Project File Server ......................................... Started')
|
||||
|
||||
CL.servers.PLUGIN_SERVER = PLUGIN_SERVER.newPluginServer()
|
||||
CL.servers.PLUGIN_SERVER.initialize()
|
||||
CL.servers.PLUGIN_SERVER.run()
|
||||
console.log('Plugin Server ............................................... Started')
|
||||
|
||||
CL.servers.DATA_FILE_SERVER = DATA_FILE_SERVER.newDataFileServer()
|
||||
CL.servers.DATA_FILE_SERVER.initialize()
|
||||
CL.servers.DATA_FILE_SERVER.run()
|
||||
console.log('Data File Server ............................................ Started')
|
||||
|
||||
CL.servers.EVENT_SERVER = EVENT_SERVER.newEventServer()
|
||||
CL.servers.EVENT_SERVER.initialize()
|
||||
CL.servers.EVENT_SERVER.run()
|
||||
console.log('Events Server ............................................... Started')
|
||||
|
||||
TASK_MANAGER_SERVER = TASK_MANAGER_SERVER.newTaskManagerServer()
|
||||
TASK_MANAGER_SERVER.initialize()
|
||||
TASK_MANAGER_SERVER.run()
|
||||
console.log('Task Manager Server ......................................... Started')
|
||||
|
||||
CL.servers.CCXT_SERVER = CCXT_SERVER.newCCXTServer()
|
||||
CL.servers.CCXT_SERVER.initialize()
|
||||
CL.servers.CCXT_SERVER.run()
|
||||
console.log('CCXT Server ................................................. Started')
|
||||
|
||||
CL.servers.WEB3_SERVER = WEB3_SERVER.newWeb3Server()
|
||||
CL.servers.WEB3_SERVER.initialize()
|
||||
CL.servers.WEB3_SERVER.run()
|
||||
console.log('WEB3 Server ................................................. Started')
|
||||
|
||||
CL.servers.GITHUB_SERVER = GITHUB_SERVER.newGithubServer()
|
||||
CL.servers.GITHUB_SERVER.initialize()
|
||||
CL.servers.GITHUB_SERVER.run()
|
||||
console.log('Github Server ............................................... Started')
|
||||
|
||||
console.log('')
|
||||
console.log('SUPERALGOS PLATFORM CLIENT INTERFACES:')
|
||||
console.log('')
|
||||
|
||||
WEB_SOCKETS_INTERFACE = WEB_SOCKETS_INTERFACE.newWebSocketsInterface()
|
||||
WEB_SOCKETS_INTERFACE.initialize()
|
||||
console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
HTTP_INTERFACE = HTTP_INTERFACE.newHttpInterface()
|
||||
HTTP_INTERFACE.initialize()
|
||||
console.log('Http Interface .............................................. Listening at port ' + global.env.CLIENT_HTTP_INTERFACE_PORT)
|
||||
|
||||
console.log('')
|
||||
console.log("You are running Superalgos Beta 11")
|
||||
console.log('')
|
||||
console.log("What's new? These are the main new features in this version:")
|
||||
console.log('')
|
||||
console.log('Governance System ........................................... Automates the distribution of SA Tokens and allow users to vote on the direction of the project.')
|
||||
console.log('TensorFlow Integration ...................................... Allows creating and training ML models and use them in trading strategies.')
|
||||
console.log('')
|
||||
console.log("What's next? This is the current development pipeline:")
|
||||
console.log('')
|
||||
console.log('Superalgos P2P Network ...................................... Will allow algo-traders to share trading signals with Superalgos users consuming these signals via a mobile app.')
|
||||
console.log('Real-time Trading Signals ................................... Will allow users to emit trading signals and be rewarded with SA Tokens.')
|
||||
console.log('Superalgos Mobile ........................................... Will allow users to consume trading signals for free and autonomously execute trades from their mobile phones.')
|
||||
console.log('Ethereum Integration ........................................ Will allow mining data from an Ethereum network node, and bring it into the Superalgos workflow.')
|
||||
|
||||
console.log('')
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Platform App -> Error = ' + err.stack)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -459,6 +459,32 @@ function newCanvas() {
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
event.shiftKey === true &&
|
||||
(event.ctrlKey === true || event.metaKey === true) &&
|
||||
(event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.saveFloatingObjectToBeMoved || event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.saveFloatingObjectToBeMoved.toLowerCase())
|
||||
|
||||
) {
|
||||
UI.projects.foundations.spaces.floatingSpace.saveFloatingObjectToBeMoved()
|
||||
if (event.preventDefault !== undefined) {
|
||||
event.preventDefault()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
event.shiftKey === true &&
|
||||
(event.ctrlKey === true || event.metaKey === true) &&
|
||||
(event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.moveSavedFloatingObjectToMouse || event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.moveSavedFloatingObjectToMouse.toLowerCase())
|
||||
|
||||
) {
|
||||
UI.projects.foundations.spaces.floatingSpace.moveSavedFloatingObjectToMouse(thisObject.mouse.position)
|
||||
if (event.preventDefault !== undefined) {
|
||||
event.preventDefault()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
let nodeOnFocus = await UI.projects.foundations.spaces.designSpace.workspace.getNodeThatIsOnFocus()
|
||||
if (nodeOnFocus !== undefined) {
|
||||
if (nodeOnFocus.payload.uiObject.codeEditor !== undefined) {
|
||||
|
||||
@@ -195,7 +195,7 @@ function newEventsServerClient(networkNode) {
|
||||
if (networkNode !== undefined) {
|
||||
if (networkNode.payload !== undefined) {
|
||||
if (networkNode.payload.uiObject !== undefined) {
|
||||
networkNode.payload.uiObject.setErrorMessage('Failed to Connect to Superalgos Client via WebSockets. Retrying in 1 minute. Check at this node config if the host property has the IP address of the computer running Superalgos Client.')
|
||||
networkNode.payload.uiObject.setErrorMessage('Failed to Connect to Superalgos Platform Client via WebSockets. Retrying in 1 minute. Check at this node config if the host property has the IP address of the computer running Superalgos Platform Client.')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ function newEventsServerClient(networkNode) {
|
||||
if (networkNode !== undefined) {
|
||||
if (networkNode.payload !== undefined) {
|
||||
if (networkNode.payload.uiObject !== undefined) {
|
||||
networkNode.payload.uiObject.setStatus('Connected to Superalgos Client via WebSockets.')
|
||||
networkNode.payload.uiObject.setStatus('Connected to Superalgos Platform Client via WebSockets.')
|
||||
retryCommandsPhysics()
|
||||
}
|
||||
}
|
||||
|
||||
Generated
-3700
File diff suppressed because it is too large.
Load diff
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "Superalgos-Plarform",
|
||||
"version": "0.0.11",
|
||||
"description": "Superalgos Plarform",
|
||||
"main": "PlatformApp.js",
|
||||
"author": {
|
||||
"name": "Luis-Fernando-Molina"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/rest": "^18.9.0",
|
||||
"ccxt": "^1.51.98",
|
||||
"child_process": "^1.0.2",
|
||||
"ethereumjs-common": "^1.5.2",
|
||||
"ethereumjs-tx": "^2.1.2",
|
||||
"ethers": "^5.4.4",
|
||||
"lookpath": "^1.2.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"open": "^8.2.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"simple-git": "^2.42.0",
|
||||
"web3": "^1.5.2",
|
||||
"ws": "^8.2.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
/*
|
||||
This module represents the execution root of the Platform App.
|
||||
We use this module that is outside the Platform folder to
|
||||
load all node dependencies and get them ready to the actual App.
|
||||
*/
|
||||
|
||||
/*
|
||||
The PL object is accesible everywhere at the Superalgos Platform Client.
|
||||
It provides access to all modules built for this Client.
|
||||
*/
|
||||
global.PL = {}
|
||||
/*
|
||||
The SA object is accesible everywhere at the Superalgos Desktop App.
|
||||
It provides access to all modules built for Superalgos in general.
|
||||
*/
|
||||
global.SA = {}
|
||||
/* Load Environment Variables */
|
||||
let ENVIRONMENT = require('./Environment.js');
|
||||
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
|
||||
global.env = ENVIRONMENT_MODULE
|
||||
/*
|
||||
First thing is to load the project schema file.
|
||||
*/
|
||||
global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA)
|
||||
/*
|
||||
Setting up the modules that will be available, defined at the Project Schema file.
|
||||
*/
|
||||
let MULTI_PROJECT = require('./MultiProject.js');
|
||||
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
|
||||
MULTI_PROJECT_MODULE.initialize(PL, 'PL')
|
||||
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
|
||||
/*
|
||||
Setting up external dependencies.
|
||||
*/
|
||||
SA.nodeModules = {
|
||||
fs: require('fs'),
|
||||
util: require('util'),
|
||||
path: require('path'),
|
||||
ws: require('ws'),
|
||||
web3: require('web3'),
|
||||
ethers: require('ethers'),
|
||||
ethereumjsTx: require('ethereumjs-tx'),
|
||||
ethereumjsCommon: require('ethereumjs-common'),
|
||||
nodeFetch: require('node-fetch'),
|
||||
open: require('open'),
|
||||
http: require('http'),
|
||||
ccxt: require('ccxt'),
|
||||
octokit: require("@octokit/rest"),
|
||||
simpleGit: require('simple-git'),
|
||||
lookpath: require('lookpath')
|
||||
}
|
||||
|
||||
run()
|
||||
|
||||
async function run() {
|
||||
PL.app = require('./Platform/PlatformApp.js').newPlatformApp()
|
||||
await PL.app.run()
|
||||
console.log('Superalgos Platform App is Running!')
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"type": "Docs Space Settings",
|
||||
"level": 4,
|
||||
"propertyNameAtParent": "docsSpaceSettings",
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "Docs Space->"
|
||||
},
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{\"indexContent\": true \n }"
|
||||
},
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"type": "Docs Space Style",
|
||||
"level": 4,
|
||||
"propertyNameAtParent": "docsSpaceStyle",
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "Docs Space->"
|
||||
},
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{\"backgroundColor\":\"UI_COLOR.BLACK\",\"node\":{\"fontSize\":16,\"imageSize\":60,\"type\":{\"fontColor\":\"UI_COLOR.WHITE\"},\"name\":{\"fontColor\":\"UI_COLOR.WHITE\"},\"menuItem\":{\"backgroundColor\":\"UI_COLOR.BLACK\",\"fontColor\":\"UI_COLOR.WHITE\",\"fontSize\":14,\"imageSize\":14}}}"
|
||||
},
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true
|
||||
}
|
||||
+13
-10
@@ -3,22 +3,25 @@
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "spaceStyle",
|
||||
"label": "Add Space Style",
|
||||
"relatedUiObject": "Space Style",
|
||||
"propertyToCheckFor": "docsSpaceStyle",
|
||||
"label": "Add Docs Space Style",
|
||||
"relatedUiObject": "Docs Space Style",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "spaceSettings",
|
||||
"label": "Add Space Settings",
|
||||
"relatedUiObject": "Space Settings",
|
||||
"propertyToCheckFor": "docsSpaceSettings",
|
||||
"label": "Add Docs Space Settings",
|
||||
"relatedUiObject": "Docs Space Settings",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"actionFunction": "payload.executeAction",
|
||||
@@ -32,15 +35,15 @@
|
||||
"level": 0,
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "spaceStyle",
|
||||
"name": "docsSpaceStyle",
|
||||
"type": "node",
|
||||
"childType": "Space Style",
|
||||
"childType": "Docs Space Style",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "spaceSettings",
|
||||
"name": "docsSpaceSettings",
|
||||
"type": "node",
|
||||
"childType": "Space Settings",
|
||||
"childType": "Docs Space Settings",
|
||||
"autoAdd": true
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"type": "Education Project",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"label": "Add Tutorial",
|
||||
"iconProject": "Education",
|
||||
"relatedUiObject": "Tutorial",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"label": "Add Docs Space",
|
||||
"relatedUiObject": "Docs Space",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Foundations",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity"
|
||||
}
|
||||
],
|
||||
"isProjectHead": true,
|
||||
"isTitleAllwaysVisible": false,
|
||||
"addLeftIcons": true,
|
||||
"isPinned": true,
|
||||
"positionLocked": true,
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "projectDefinition",
|
||||
"type": "node",
|
||||
"childType": "Project Definition",
|
||||
"project": "Foundations",
|
||||
"autoAdd": true
|
||||
}
|
||||
],
|
||||
"icon": "education"
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"type": "Docs Space Settings",
|
||||
"definition": {
|
||||
"text": "This node allows the user to determine how the docs space will be loaded by the current workspace.",
|
||||
"updated": 1631587592724
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Properties",
|
||||
"updated": 1631587516173
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "indexContent defines whether the contents of the docs space will be indexed for searching upon loading the workspace. If false docs space will be disabled allowing faster load times for development."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"type": "Docs Space Style",
|
||||
"definition": {
|
||||
"text": "This node is currently a place holder that will eventually allow users to adjust the visual apperance of the docs space.",
|
||||
"updated": 1631589004055
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Right click and select the pencil button to enter edit mode."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -23,8 +23,8 @@ function newFoundationsDocsSearchEngine() {
|
||||
*/
|
||||
let docsSpaceNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadByNodeType('Docs Space')
|
||||
if (docsSpaceNode !== undefined) {
|
||||
if (docsSpaceNode.spaceSettings !== undefined) {
|
||||
let indexContent = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(docsSpaceNode.spaceSettings.payload, 'indexContent')
|
||||
if (docsSpaceNode.docsSpaceSettings !== undefined) {
|
||||
let indexContent = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(docsSpaceNode.docsSpaceSettings.payload, 'indexContent')
|
||||
if (indexContent === false) {
|
||||
callbackFunction()
|
||||
return
|
||||
|
||||
@@ -12,6 +12,7 @@ function newEducationTutorialSpace() {
|
||||
playTutorialStep: playTutorialStep,
|
||||
resumeTutorialStep: resumeTutorialStep,
|
||||
resetTutorialProgress: resetTutorialProgress,
|
||||
sidePanelTab: undefined,
|
||||
container: undefined,
|
||||
physics: physics,
|
||||
draw: draw,
|
||||
@@ -37,6 +38,8 @@ function newEducationTutorialSpace() {
|
||||
resize()
|
||||
|
||||
let browserResizedEventSubscriptionId
|
||||
let openingEventSubscriptionId
|
||||
let closingEventSubscriptionId
|
||||
|
||||
let tutorialRootNode
|
||||
let currentNode
|
||||
@@ -104,6 +107,8 @@ function newEducationTutorialSpace() {
|
||||
batchConfigChangesCounter = 0
|
||||
workspacesCounter = 0
|
||||
|
||||
setupSidePanelTab()
|
||||
|
||||
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
|
||||
let workspace = UI.projects.foundations.spaces.designSpace.workspace
|
||||
workspace.executeAction({ name: 'Play Tutorials', project: 'Foundations' })
|
||||
@@ -112,6 +117,8 @@ function newEducationTutorialSpace() {
|
||||
|
||||
function finalize() {
|
||||
canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
|
||||
thisObject.sidePanelTab.container.eventHandler.stopListening(openingEventSubscriptionId)
|
||||
thisObject.sidePanelTab.container.eventHandler.stopListening(closingEventSubscriptionId)
|
||||
|
||||
tutorialRootNode = undefined
|
||||
currentNode = undefined
|
||||
@@ -130,8 +137,14 @@ function newEducationTutorialSpace() {
|
||||
}
|
||||
|
||||
function getContainer(point, purpose) {
|
||||
|
||||
if (thisObject.sidePanelTab === undefined) { return }
|
||||
|
||||
let container
|
||||
|
||||
container = thisObject.sidePanelTab.getContainer(point, purpose)
|
||||
if (container !== undefined) { return container }
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
return thisObject.container
|
||||
} else {
|
||||
@@ -145,11 +158,14 @@ function newEducationTutorialSpace() {
|
||||
switch (currentStatus) {
|
||||
case 'Stopped': {
|
||||
makeInvisible()
|
||||
//thisObject.sidePanelTab.close()
|
||||
currentNode = undefined
|
||||
break
|
||||
}
|
||||
case 'Playing Tutorial': {
|
||||
makeVsible()
|
||||
// Animation Caused the advance() function to be called skipping the first tutorial step commented out until better implementation can be added
|
||||
//thisObject.sidePanelTab.open()
|
||||
break
|
||||
}
|
||||
case 'Playing Topic': {
|
||||
@@ -978,8 +994,8 @@ function newEducationTutorialSpace() {
|
||||
|
||||
function resumeTutorial(node) {
|
||||
if (UI.projects.foundations.spaces.designSpace.workspace.isInitialized !== true) { return }
|
||||
|
||||
navigationStack = []
|
||||
//Testing if removing the navigationStack reset here fixes the tutorial resume issues
|
||||
//navigationStack = []
|
||||
node.payload.uiObject.isPlaying = true
|
||||
tutorialRootNode = node
|
||||
currentNode = node
|
||||
@@ -1000,7 +1016,8 @@ function newEducationTutorialSpace() {
|
||||
}
|
||||
|
||||
function resumeTutorialTopic(node) {
|
||||
navigationStack = []
|
||||
//Testing if removing the navigationStack reset here fixes the tutorial resume issues
|
||||
//navigationStack = []
|
||||
currentTopicNode = node
|
||||
currentNode = node
|
||||
currentStatus = 'Playing Topic'
|
||||
@@ -1020,7 +1037,8 @@ function newEducationTutorialSpace() {
|
||||
}
|
||||
|
||||
function resumeTutorialStep(node) {
|
||||
navigationStack = []
|
||||
//Testing if removing the navigationStack reset here fixes the tutorial resume issues
|
||||
//navigationStack = []
|
||||
currentStepNode = node
|
||||
currentNode = node
|
||||
currentStatus = 'Playing Step'
|
||||
@@ -1509,4 +1527,37 @@ function newEducationTutorialSpace() {
|
||||
function draw() {
|
||||
if (isInitialized === false) { return }
|
||||
}
|
||||
|
||||
function setupSidePanelTab() {
|
||||
thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Education', 'tutorial', 'Tutorial', 'left')
|
||||
|
||||
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening)
|
||||
closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing)
|
||||
}
|
||||
|
||||
function onOpening() {
|
||||
//console.log('onOpening');
|
||||
if (currentStatus !== "Stopped"){return}
|
||||
|
||||
let nodeResume = navigationStack.pop()
|
||||
switch (nodeResume.type) {
|
||||
case 'Tutorial': {
|
||||
resumeTutorial(nodeResume)
|
||||
break
|
||||
}
|
||||
case 'Tutorial Topic': {
|
||||
resumeTutorialTopic(nodeResume)
|
||||
break
|
||||
}
|
||||
case 'Tutorial Step': {
|
||||
resumeTutorialStep(nodeResume)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onClosing() {
|
||||
//console.log('onClosing');
|
||||
stop()
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -19330,7 +19330,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Indicator Bot",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"config": "{\n\"codeName\": \"RSI\"\n}",
|
||||
"project": "Foundations",
|
||||
"processes": [
|
||||
@@ -19383,7 +19383,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Indicator Bot",
|
||||
"Foundations",
|
||||
"b2fc1830-30e3-407a-9cd2-ab93a9e36cc7"
|
||||
@@ -19535,7 +19535,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Indicator Bot",
|
||||
"Foundations",
|
||||
"b2fc1830-30e3-407a-9cd2-ab93a9e36cc7"
|
||||
@@ -19829,7 +19829,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Indicator Bot",
|
||||
"Foundations",
|
||||
"b2fc1830-30e3-407a-9cd2-ab93a9e36cc7"
|
||||
@@ -19920,7 +19920,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Indicator Bot",
|
||||
"Foundations",
|
||||
"b2fc1830-30e3-407a-9cd2-ab93a9e36cc7"
|
||||
@@ -20717,7 +20717,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -38266,7 +38266,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Plotter",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"config": "{\n\"codeName\": \"Plotter RSI\"\n}",
|
||||
"project": "Foundations",
|
||||
"modules": [
|
||||
@@ -39291,7 +39291,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -39363,7 +39363,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -39435,7 +39435,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -39507,7 +39507,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -39664,7 +39664,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -39736,7 +39736,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -39808,7 +39808,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -39880,7 +39880,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40037,7 +40037,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40109,7 +40109,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40181,7 +40181,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40253,7 +40253,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40410,7 +40410,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40482,7 +40482,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40554,7 +40554,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40626,7 +40626,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40783,7 +40783,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -40855,7 +40855,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41012,7 +41012,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41084,7 +41084,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41241,7 +41241,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41313,7 +41313,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41470,7 +41470,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41542,7 +41542,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41699,7 +41699,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41771,7 +41771,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -41985,7 +41985,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -42057,7 +42057,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -42214,7 +42214,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -42286,7 +42286,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -42358,7 +42358,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
@@ -42430,7 +42430,7 @@
|
||||
"63b3bd4b-97da-47a7-8f72-b9eaf0632ebb"
|
||||
],
|
||||
[
|
||||
"Relative Strenght Index (RSI)",
|
||||
"Relative Strength Index (RSI)",
|
||||
"Plotter",
|
||||
"Foundations",
|
||||
"d87c1a49-c376-404b-98ff-62feac714c64"
|
||||
|
||||
+6330
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -166,11 +166,11 @@
|
||||
},
|
||||
{
|
||||
"type": "Task",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"bot": {
|
||||
"type": "Indicator Bot Instance",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"config": "{ \n\"parameter1\": \"Value for parameter1 defined at the Product Definition\"\n}",
|
||||
"project": "Foundations",
|
||||
"processes": [
|
||||
@@ -2736,7 +2736,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Bot Products",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"dataProducts": [
|
||||
{
|
||||
@@ -21362,7 +21362,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Bot Layers",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"layers": [
|
||||
{
|
||||
@@ -31933,7 +31933,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Bot Layers",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"layers": [
|
||||
{
|
||||
|
||||
@@ -408,17 +408,17 @@
|
||||
},
|
||||
{
|
||||
"type": "Task",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"bot": {
|
||||
"type": "Indicator Bot Instance",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"config": "{ \n\"parameter1\": \"Value for parameter1 defined at the Product Definition\"\n}",
|
||||
"project": "Foundations",
|
||||
"processes": [
|
||||
{
|
||||
"type": "Indicator Process Instance",
|
||||
"name": "Relative Strenght Index (RSI) Multi-Time-Frame-Market",
|
||||
"name": "Relative Strength Index (RSI) Multi-Time-Frame-Market",
|
||||
"project": "Foundations",
|
||||
"id": "ffa5490a-b87c-4d25-a0bf-3a978ba22521",
|
||||
"savedPayload": {
|
||||
@@ -450,7 +450,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Indicator Process Instance",
|
||||
"name": "Relative Strenght Index (RSI) Multi-Time-Frame-Daily",
|
||||
"name": "Relative Strength Index (RSI) Multi-Time-Frame-Daily",
|
||||
"project": "Foundations",
|
||||
"id": "69ff12a5-65b8-4d00-ad9d-329f502aab42",
|
||||
"savedPayload": {
|
||||
@@ -3601,7 +3601,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Bot Products",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"dataProducts": [
|
||||
{
|
||||
@@ -25409,7 +25409,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Bot Layers",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"layers": [
|
||||
{
|
||||
@@ -39990,7 +39990,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Bot Layers",
|
||||
"name": "Relative Strenght Index (RSI)",
|
||||
"name": "Relative Strength Index (RSI)",
|
||||
"project": "Foundations",
|
||||
"layers": [
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File renamed without changes.
@@ -4,6 +4,7 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
|
||||
getDirectories: getDirectories,
|
||||
getAllFilesInDirectoryAndSubdirectories: getAllFilesInDirectoryAndSubdirectories,
|
||||
pathFromDate: pathFromDate,
|
||||
pathFromDatetime: pathFromDatetime,
|
||||
mkDirByPathSync: mkDirByPathSync
|
||||
}
|
||||
|
||||
@@ -21,8 +22,8 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
|
||||
}
|
||||
|
||||
function getAllFilesInDirectoryAndSubdirectories(dir, callback) {
|
||||
const { promisify } = require('util');
|
||||
const { resolve } = require('path');
|
||||
const { promisify } = SA.nodeModules.util
|
||||
const { resolve } = SA.nodeModules.path;
|
||||
const fs = SA.nodeModules.fs;
|
||||
const readdir = promisify(fs.readdir);
|
||||
const stat = promisify(fs.stat);
|
||||
@@ -55,18 +56,38 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
|
||||
}
|
||||
|
||||
function pathFromDate(timestamp) {
|
||||
|
||||
let file = { date: new Date(timestamp) }
|
||||
|
||||
file.year = file.date.getUTCFullYear()
|
||||
file.month = file.date.getUTCMonth() + 1
|
||||
file.day = file.date.getUTCDate()
|
||||
|
||||
return file.year + '/' +
|
||||
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
|
||||
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)
|
||||
}
|
||||
|
||||
function pathFromDatetime(timestamp) {
|
||||
|
||||
let file = { date: new Date(timestamp) }
|
||||
|
||||
file.year = file.date.getUTCFullYear()
|
||||
file.month = file.date.getUTCMonth() + 1
|
||||
file.day = file.date.getUTCDate()
|
||||
file.hour = file.date.getUTCHours()
|
||||
file.minute = file.date.getMinutes()
|
||||
|
||||
return file.year + '/' +
|
||||
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
|
||||
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2) + '/' +
|
||||
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.hour, 2) + '/' +
|
||||
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.minute, 2)
|
||||
}
|
||||
|
||||
/* Function to create folders of missing folders at any path. */
|
||||
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
|
||||
const path = require('path')
|
||||
const path = SA.nodeModules.path
|
||||
|
||||
targetDir = targetDir.substring(0, targetDir.lastIndexOf('/') + 1);
|
||||
|
||||
@@ -77,7 +98,7 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
|
||||
return targetDir.split(sep).reduce((parentDir, childDir) => {
|
||||
const curDir = path.resolve(baseDir, parentDir, childDir);
|
||||
try {
|
||||
const fs = require('fs')
|
||||
const fs = SA.nodeModules.fs
|
||||
fs.mkdirSync(curDir);
|
||||
} catch (err) {
|
||||
if (err.code === 'EEXIST') { // curDir already exists!
|
||||
|
||||
@@ -6,7 +6,7 @@ exports.newFoundationsUtilitiesHttpRequests = function () {
|
||||
|
||||
return thisObject
|
||||
|
||||
function getRequestBody(httpRequest, callback) { // Gets the de body from a POST httpRequest to the web server
|
||||
function getRequestBody(httpRequest, httpResponse, callback) { // Gets the de body from a POST httpRequest to the web server
|
||||
try {
|
||||
|
||||
let body = ''
|
||||
@@ -26,10 +26,12 @@ exports.newFoundationsUtilitiesHttpRequests = function () {
|
||||
httpRequest.on('error', function (err) {
|
||||
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
|
||||
callback()
|
||||
})
|
||||
} catch (err) {
|
||||
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,12 @@
|
||||
"dontShowAtFullscreen": true,
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Social Bots",
|
||||
"relatedUiObject": "Social Bots",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add Missing Children",
|
||||
"label": "Add Missing Children",
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
"dontShowAtFullscreen": true,
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Social Bots",
|
||||
"relatedUiObject": "Social Bots",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add Missing Children",
|
||||
"label": "Add Missing Children",
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
"dontShowAtFullscreen": true,
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Social Bots",
|
||||
"relatedUiObject": "Social Bots",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add Missing Children",
|
||||
"label": "Add Missing Children",
|
||||
|
||||
@@ -7,13 +7,6 @@
|
||||
"relatedUiObject": "Network",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Tutorial",
|
||||
"iconProject": "Education",
|
||||
"relatedUiObject": "Tutorial",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Plugins",
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
"dontShowAtFullscreen": true,
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Social Bots",
|
||||
"relatedUiObject": "Social Bots",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add Missing Children",
|
||||
"label": "Add Missing Children",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{\"node\":{\"distancePercentage\":60,\"radiusPercentage\":85,\"massPercentage\":100,\"animationSteps\":2,\"menuItem\":{\"widthPercentage\":100,\"heightPercentage\":60,\"radiusPercentage\":90}},\"physics\":false,\"shortcuts\":{\"toggleMapMode\":\"M\",\"toggleDrawRelationshipLines\":\"R\",\"toggleDrawParentLines\":\"C\",\"saveWorkspace\":\"S\",\"adjustAspectRatio\":\"A\"}}"
|
||||
"config": "{\"node\":{\"distancePercentage\":60,\"radiusPercentage\":85,\"massPercentage\":100,\"animationSteps\":2,\"menuItem\":{\"widthPercentage\":100,\"heightPercentage\":60,\"radiusPercentage\":90}},\"physics\":false,\"shortcuts\":{\"toggleMapMode\":\"M\",\"toggleDrawRelationshipLines\":\"R\",\"toggleDrawParentLines\":\"C\",\"saveWorkspace\":\"S\",\"adjustAspectRatio\":\"A\"} \n }"
|
||||
},
|
||||
"menuItems": [
|
||||
{
|
||||
|
||||
@@ -13,12 +13,6 @@
|
||||
"relatedUiObject": "Design Space",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Docs Space",
|
||||
"relatedUiObject": "Docs Space",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type": "Project Schema File",
|
||||
"definition": {
|
||||
"text": "It is the most basic and low level system-wide configuration file. You will find it at the Projects folder. It contains a list of all integrated projects and for each one the list of javascript modules organized in different categories, like Function Libraries, Utilities, Spaces, Globals, etc; in turn organized into the broather categories UI, TS and CL.",
|
||||
"text": "It is the most basic and low level system-wide configuration file. You will find it at the Projects folder. It contains a list of all integrated projects and for each one the list of javascript modules organized in different categories, like Function Libraries, Utilities, Spaces, Globals, etc; in turn organized into the broather categories UI, TS and PL.",
|
||||
"updated": 1614939492529
|
||||
},
|
||||
"paragraphs": [
|
||||
|
||||
+2
-2
@@ -141,7 +141,7 @@
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"text": "parameterValue = \nMath.trunc((new Date()).valueOf() / \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS",
|
||||
"text": "parameterValue = \nMath.trunc((new Date()).valueOf() / \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS",
|
||||
"updated": 1622477009814
|
||||
},
|
||||
{
|
||||
@@ -151,7 +151,7 @@
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"text": "parameterValue = Math.trunc((new Date()).valueOf() / \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1",
|
||||
"text": "parameterValue = Math.trunc((new Date()).valueOf() / \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1",
|
||||
"updated": 1622477088684
|
||||
},
|
||||
{
|
||||
|
||||
+33
-17
@@ -16,26 +16,50 @@
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Properties",
|
||||
"updated": 1609863924784
|
||||
"updated": 1631554214199
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "node refers to every node in the design space."
|
||||
"text": "\"physics\" determines whether the environment is static (false) or dynamic (true). When physics is set to true, nodes in the design space are affected by th gravitational pull and repulsion of other nodes.",
|
||||
"updated": 1631588883144
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "radiusPercentage is the radius of the circular nodes' menu applied as a percentage of an arbitrary default radius.",
|
||||
"updated": 1609863960583
|
||||
"text": "detachUsingMouse defines if you can detach nodes from it's parent or reference parents only using the mouse (when true) or if you can not use the mouse for that and can only do it using the detach buttons on the icon's menu (when false)."
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Properties"
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "massPercentage is the refernce mass of nodes that affect the attraction and repulsion of the environment's pysics whe the physics setting is set to true.",
|
||||
"updated": 1609863964761
|
||||
"text": "\"node\" here refers to every node in the design space. This collection of properties adjusts the settings of all nodes in the design space.",
|
||||
"updated": 1631588871268
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "menuItem refers to the items on the right-hand side of nodes' menus.",
|
||||
"updated": 1609863969621
|
||||
"text": "distancePercentage adjusts the baseline distance between nodes.",
|
||||
"updated": 1631588124341
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "radiusPercentage is the radius of the circular nodes' menu applied as a percentage of an arbitrary default radius. A higher value will lead to a larger node menu.",
|
||||
"updated": 1631588202567
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "massPercentage is the reference mass of nodes that affects the attraction and repulsion of the environment's physics when the physics setting is set to true.",
|
||||
"updated": 1631588798797
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "animationSteps adjusts the amount of steps the animation takes to open a node menu upon hovering over it. A higher value leads to smoother transtion.",
|
||||
"updated": 1631588728860
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "menuItem refers to the items on the right-hand side of a node's menus and has the following three properties.",
|
||||
"updated": 1631588761551
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
@@ -50,15 +74,7 @@
|
||||
{
|
||||
"style": "List",
|
||||
"text": "radiusPercentage is the reference radious of the circular matrix that governs the distribution of items in the circular menu. Larger numbers cause items to spread appart while smaller numbers makes items lie closer to each other.",
|
||||
"updated": 1609863985113
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "physics determines wether the environment is static (false) or dynamic (true). When physics is set to true, nodes in the design space are affected by th gravitational pull and repulsion of other nodes."
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "detachUsingMouse defines if you can detach nodes from it's parent or reference parents only using the mouse (when true) or if you can not use the mouse for that and can only do it using the detach buttons on the icon's menu (when false)."
|
||||
"updated": 1631554041849
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
|
||||
@@ -462,11 +462,11 @@ exports.newFoundationsBotModulesFetchingProcess = function (processIndex) {
|
||||
break
|
||||
}
|
||||
case '@BeginCurrentMinute': {
|
||||
parameterValue = Math.trunc((new Date()).valueOf() / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
|
||||
parameterValue = Math.trunc((new Date()).valueOf() / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
|
||||
break
|
||||
}
|
||||
case '@EndCurrentMinute': {
|
||||
parameterValue = Math.trunc((new Date()).valueOf() / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1
|
||||
parameterValue = Math.trunc((new Date()).valueOf() / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -582,7 +582,7 @@ exports.newFoundationsBotModulesFetchingProcess = function (processIndex) {
|
||||
Now that we have the endpointNode, the parameters and all the information
|
||||
needed to place the call to the API.
|
||||
*/
|
||||
const fetch = require('node-fetch')
|
||||
const fetch = SA.nodeModules.nodeFetch
|
||||
let url = protocol + '://' +
|
||||
hostName +
|
||||
portNumber +
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "api-data-fetcher-bot",
|
||||
"version": "1.0.0",
|
||||
"description": "Api Fetcher Bot",
|
||||
"main": "FetchingProcess.js",
|
||||
"author": "Luis Molina, Harrellbm",
|
||||
"dependencies": {
|
||||
"node-fetch": "2.6.1"
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -94,7 +94,7 @@
|
||||
thisReport.beginingOfMarket.days + " " +
|
||||
thisReport.beginingOfMarket.hours + ":" +
|
||||
thisReport.beginingOfMarket.minutes +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
|
||||
/* Second, we get the report from Exchange Raw Data, to know when the marted ends. */
|
||||
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Ending Point')
|
||||
@@ -158,15 +158,15 @@
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.lastBandFile = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.lastBandFile = new Date(
|
||||
contextVariables.lastBandFile.valueOf() +
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
buildBands();
|
||||
return;
|
||||
@@ -199,16 +199,16 @@
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.lastBandFile = new Date(
|
||||
contextVariables.lastBandFile.valueOf() +
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
beginingOfMarket = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[INFO] start -> getContextVariables -> thisReport.lastFile === undefined")
|
||||
@@ -237,7 +237,7 @@
|
||||
|
||||
try {
|
||||
let n;
|
||||
processDate = new Date(contextVariables.lastBandFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
|
||||
processDate = new Date(contextVariables.lastBandFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
|
||||
let fromDate = new Date(processDate.valueOf())
|
||||
let lastDate = TS.projects.foundations.utilities.dateTimeFunctions.removeTime(new Date())
|
||||
|
||||
@@ -249,8 +249,8 @@
|
||||
function advanceTime() {
|
||||
|
||||
try {
|
||||
processDate = new Date(processDate.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
previousDay = new Date(processDate.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
processDate = new Date(processDate.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
previousDay = new Date(processDate.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[INFO] start -> buildBands -> advanceTime -> processDate = " + processDate)
|
||||
@@ -784,7 +784,7 @@
|
||||
try {
|
||||
let dataRange = {
|
||||
begin: pBegin.valueOf(),
|
||||
end: pEnd.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
end: pEnd.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
|
||||
let fileContent = JSON.stringify(dataRange);
|
||||
|
||||
+11
-11
@@ -89,7 +89,7 @@
|
||||
thisReport.beginingOfMarket.days + " " +
|
||||
thisReport.beginingOfMarket.hours + ":" +
|
||||
thisReport.beginingOfMarket.minutes +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
|
||||
/* Second, we get the report from Exchange Raw Data, to know when the marted ends. */
|
||||
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Ending Point')
|
||||
@@ -125,7 +125,7 @@
|
||||
thisReport.lastFile.year + "-" +
|
||||
thisReport.lastFile.month + "-" +
|
||||
thisReport.lastFile.days + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
|
||||
/* Finally we get our own Status Report. */
|
||||
statusReport = statusDependenciesModule.reportsByMainUtility.get('Self Reference')
|
||||
@@ -150,15 +150,15 @@
|
||||
beginingOfMarket = new Date(thisReport.beginingOfMarket)
|
||||
if (beginingOfMarket.valueOf() !== contextVariables.datetimeBeginingOfMarketFile.valueOf()) { // Reset Mechanism for Begining of the Market
|
||||
|
||||
beginingOfMarket = new Date(contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" + (contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" + contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
beginingOfMarket = new Date(contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" + (contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" + contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeLastProducedFile.valueOf() -
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
|
||||
|
||||
buildCandles()
|
||||
return
|
||||
@@ -171,7 +171,7 @@
|
||||
For that reason we go back one day, the partial information is discarded
|
||||
and added again with whatever new info is available.
|
||||
*/
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
buildCandles()
|
||||
return
|
||||
|
||||
@@ -180,13 +180,13 @@
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
|
||||
|
||||
buildCandles()
|
||||
return
|
||||
@@ -216,7 +216,7 @@
|
||||
advanceTime()
|
||||
|
||||
function advanceTime() {
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[INFO] start -> buildCandles -> advanceTime -> New processing time @ " + contextVariables.datetimeLastProducedFile.getUTCFullYear() + "/" + (contextVariables.datetimeLastProducedFile.getUTCMonth() + 1) + "/" + contextVariables.datetimeLastProducedFile.getUTCDate() + ".")
|
||||
@@ -665,7 +665,7 @@
|
||||
try {
|
||||
let dataRange = {
|
||||
begin: pBegin.valueOf(),
|
||||
end: pEnd.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
end: pEnd.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
|
||||
let fileContent = JSON.stringify(dataRange);
|
||||
|
||||
+10
-10
@@ -107,7 +107,7 @@
|
||||
thisReport.beginingOfMarket.days + " " +
|
||||
thisReport.beginingOfMarket.hours + ":" +
|
||||
thisReport.beginingOfMarket.minutes +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
|
||||
/* Second, we get the report from Exchange Raw Data, to know when the marted ends. */
|
||||
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Ending Point')
|
||||
@@ -143,7 +143,7 @@
|
||||
thisReport.lastFile.year + "-" +
|
||||
thisReport.lastFile.month + "-" +
|
||||
thisReport.lastFile.days + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
|
||||
/* Finally we get our own Status Report. */
|
||||
statusReport = statusDependenciesModule.reportsByMainUtility.get('Self Reference')
|
||||
@@ -174,15 +174,15 @@
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeLastProducedFile.valueOf() -
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
|
||||
|
||||
buildCandles()
|
||||
return
|
||||
@@ -196,7 +196,7 @@
|
||||
For that reason we go back one day, the partial information is discarded and
|
||||
added again with whatever new info is available.
|
||||
*/
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
findPreviousContent()
|
||||
return
|
||||
@@ -205,15 +205,15 @@
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeLastProducedFile.valueOf() -
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
|
||||
|
||||
buildCandles()
|
||||
return
|
||||
@@ -394,7 +394,7 @@
|
||||
date and then adding again all the elements found right now at that date and then
|
||||
from there into the future.
|
||||
*/
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[INFO] start -> buildCandles -> advanceTime -> New processing time @ " + contextVariables.datetimeLastProducedFile.getUTCFullYear() + "/" + (contextVariables.datetimeLastProducedFile.getUTCMonth() + 1) + "/" + contextVariables.datetimeLastProducedFile.getUTCDate() + ".")
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
thisReport.beginingOfMarket.days + " " +
|
||||
thisReport.beginingOfMarket.hours + ":" +
|
||||
thisReport.beginingOfMarket.minutes +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS
|
||||
)
|
||||
} else { // This is the standard way.
|
||||
contextVariables.dateBeginOfMarket = new Date(thisReport.beginingOfMarket)
|
||||
@@ -198,7 +198,7 @@
|
||||
contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" +
|
||||
(contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS
|
||||
)
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
@@ -242,7 +242,7 @@
|
||||
let botNeverRan = true;
|
||||
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME =
|
||||
new Date(contextVariables.lastFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well when we advance time at the begining of the loop.
|
||||
new Date(contextVariables.lastFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well when we advance time at the begining of the loop.
|
||||
let fromDate = new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.valueOf())
|
||||
let lastDate = TS.projects.foundations.utilities.dateTimeFunctions.removeTime(new Date())
|
||||
|
||||
@@ -251,9 +251,9 @@
|
||||
function advanceTime() {
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME =
|
||||
new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.valueOf() +
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
previousDay = new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.valueOf() -
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[INFO] start -> processTimeFrames -> advanceTime -> TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME = " +
|
||||
@@ -541,7 +541,7 @@
|
||||
function writeDataRange(pBegin, pEnd, productCodeName, callBack) {
|
||||
let dataRange = {
|
||||
begin: pBegin.valueOf(),
|
||||
end: pEnd.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
end: pEnd.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
};
|
||||
let fileContent = JSON.stringify(dataRange)
|
||||
let fileName = '/Data.Range.json';
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
type: 'Time Range',
|
||||
config: {
|
||||
initialDatetime: (new Date()).valueOf(),
|
||||
finalDatetime: (new Date()).valueOf() + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
finalDatetime: (new Date()).valueOf() + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -292,8 +292,8 @@
|
||||
|
||||
/* Session Type Forced Values */
|
||||
let today = (new Date()).valueOf()
|
||||
let aYearAgo = today - TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
let aYearFromNow = today + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
let aYearAgo = today - SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
let aYearFromNow = today + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
switch (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type) {
|
||||
case 'Back Learning Session': {
|
||||
useDefaultDatetimes(aYearAgo, today)
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ exports.newFoundationsBotModulesLearningEpisode = function (processIndex) {
|
||||
learningEngine.learningCurrent.learningEpisode.learningEpisodeStatistics.days.value =
|
||||
learningEngine.learningCurrent.learningEpisode.learningEpisodeCounters.periods.value *
|
||||
sessionParameters.timeFrame.config.value /
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
|
||||
function cycleBasedStatistics() {
|
||||
|
||||
+3
-3
@@ -312,7 +312,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
|
||||
if (sessionParameters.heartbeats.config.date === true || sessionParameters.heartbeats.config.candleIndex === true) {
|
||||
/* We will produce a simulation level heartbeat in order to inform the user this is running. */
|
||||
|
||||
heartBeatDate = new Date(Math.trunc(learningEngine.learningCurrent.learningEpisode.candle.begin.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
heartBeatDate = new Date(Math.trunc(learningEngine.learningCurrent.learningEpisode.candle.begin.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
let fromDate = new Date(sessionParameters.timeRange.config.initialDatetime)
|
||||
let lastDate = new Date(sessionParameters.timeRange.config.finalDatetime)
|
||||
@@ -502,7 +502,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
|
||||
the day, we will advance current process day one day. By doing so, during the next execution, the
|
||||
simulation will receive the candles and indicators files of the next day.
|
||||
*/
|
||||
let candlesPerDay = TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
|
||||
let candlesPerDay = SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
|
||||
if (
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES &&
|
||||
learningEngine.learningCurrent.learningEpisode.candle.index.value + 1 + 1 === candlesPerDay
|
||||
@@ -516,7 +516,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
|
||||
*/
|
||||
learningEngine.learningCurrent.learningEpisode.candle.index.value = 0
|
||||
learningEngine.learningCurrent.learningEpisode.processDate.value =
|
||||
learningEngine.learningCurrent.learningEpisode.processDate.value + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
learningEngine.learningCurrent.learningEpisode.processDate.value + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
+26
-26
@@ -15,12 +15,12 @@
|
||||
|
||||
const MAX_OHLCVs_PER_EXECUTION = 10000000
|
||||
const symbol = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName + '/' + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName
|
||||
const ccxt = require('ccxt')
|
||||
const ccxt = SA.nodeModules.ccxt
|
||||
/*
|
||||
This next is required when using an exchange that uses fetchTrades in place of fetchOHLCVs
|
||||
in order to be able to access the method that builds the OHLCVs, and this method is inside the CCTX library.
|
||||
*/
|
||||
const ccxtMisc = require('./node_modules/ccxt/js/base/functions/misc')
|
||||
const ccxtMisc = SA.nodeModules.ccxtMisc
|
||||
|
||||
let fetchType = "by Time"
|
||||
let lastId
|
||||
@@ -217,8 +217,8 @@
|
||||
thisReport = statusDependencies.statusReports.get(reportKey)
|
||||
|
||||
if (thisReport.file.beginingOfMarket !== undefined) { // This means this is not the first time this process has run.
|
||||
beginingOfMarket = new Date(thisReport.file.beginingOfMarket.year + "-" + thisReport.file.beginingOfMarket.month + "-" + thisReport.file.beginingOfMarket.days + " " + thisReport.file.beginingOfMarket.hours + ":" + thisReport.file.beginingOfMarket.minutes + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
lastFile = new Date(thisReport.file.lastFile.year + "-" + thisReport.file.lastFile.month + "-" + thisReport.file.lastFile.days + " " + thisReport.file.lastFile.hours + ":" + thisReport.file.lastFile.minutes + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
beginingOfMarket = new Date(thisReport.file.beginingOfMarket.year + "-" + thisReport.file.beginingOfMarket.month + "-" + thisReport.file.beginingOfMarket.days + " " + thisReport.file.beginingOfMarket.hours + ":" + thisReport.file.beginingOfMarket.minutes + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
lastFile = new Date(thisReport.file.lastFile.year + "-" + thisReport.file.lastFile.month + "-" + thisReport.file.lastFile.days + " " + thisReport.file.lastFile.hours + ":" + thisReport.file.lastFile.minutes + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
lastId = thisReport.file.lastId
|
||||
lastCandleOfTheDay = thisReport.file.lastCandleOfTheDay
|
||||
} else { // This means this is the first time this process has run.
|
||||
@@ -449,7 +449,7 @@
|
||||
await exchange.fetchOHLCV(symbol, '1d', earliestMarketSince, searchSize, params)
|
||||
|
||||
if (earlyOHLCVs.length === searchSize && previousMarketSince !== earlyOHLCVs[0][0]) { // If array is full, and the date returned isn't the same then we are still working in valid data, search further back
|
||||
earliestMarketSince = (earlyOHLCVs[0][0] - (TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
|
||||
earliestMarketSince = (earlyOHLCVs[0][0] - (SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
|
||||
previousMarketSince = earlyOHLCVs[0][0]
|
||||
|
||||
} else if (earlyOHLCVs.length === searchSize && previousMarketSince === earlyOHLCVs[0][0]) { // If array is full, but the first OHLCV date is the same as last time then we've found our Market Start
|
||||
@@ -463,7 +463,7 @@
|
||||
return earlyOHLCVs[0][0]
|
||||
|
||||
} else if ((earlyOHLCVs.length === 0 && searchSize !== 1)) { // If array is empty, we've gone too far, half the search size and retry
|
||||
earliestMarketSince = (earliestMarketSince + (TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
|
||||
earliestMarketSince = (earliestMarketSince + (SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
|
||||
if (searchSize > 1) {
|
||||
searchSize = Math.floor(searchSize / 2)
|
||||
}
|
||||
@@ -504,7 +504,7 @@
|
||||
await exchange.fetchOHLCV(symbol, '1m', since, limit, params)
|
||||
|
||||
if (nextValidOHLCVs.length === 0) {
|
||||
since = (since + (TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * limit))
|
||||
since = (since + (SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * limit))
|
||||
|
||||
} else {
|
||||
foundDate = true
|
||||
@@ -549,7 +549,7 @@
|
||||
let OHLCV = OHLCVs[0]
|
||||
|
||||
initialProcessTimestamp = OHLCV[0] // 'timestamp'
|
||||
beginingOfMarket = new Date(Math.trunc(OHLCV[0] / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // 'timestamp'
|
||||
beginingOfMarket = new Date(Math.trunc(OHLCV[0] / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // 'timestamp'
|
||||
fromDate = new Date(beginingOfMarket.valueOf())
|
||||
firstTimeThisProcessRun = false
|
||||
}
|
||||
@@ -627,11 +627,11 @@
|
||||
let startOfFetchTrades = since
|
||||
let endOfFetchTrades
|
||||
if (lastFile === undefined) {
|
||||
endOfFetchTrades = (Math.trunc(since / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
endOfFetchTrades = (Math.trunc(since / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
} else {
|
||||
endOfFetchTrades = lastFile.valueOf()
|
||||
}
|
||||
endOfFetchTrades += TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
endOfFetchTrades += SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
while (TS.projects.foundations.globals.taskVariables.IS_TASK_STOPPING !== true) {
|
||||
var trades = await exchange.fetchTrades(symbol, startOfFetchTrades, limit, params)
|
||||
if (trades.length > 0) {
|
||||
@@ -680,7 +680,7 @@
|
||||
let heartBeatCounter = 0
|
||||
let savingProcedureFinished = false
|
||||
let endOfTheOHLCVArrayReached = false
|
||||
let currentDay = Math.trunc((initialProcessTimestamp - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
let currentDay = Math.trunc((initialProcessTimestamp - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
let lastCandle = {
|
||||
begin: 0,
|
||||
@@ -742,8 +742,8 @@
|
||||
hold at least the last know value.
|
||||
*/
|
||||
let candle = {
|
||||
begin: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
|
||||
end: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
|
||||
begin: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
|
||||
end: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
|
||||
open: lastCandle.close,
|
||||
close: lastCandle.close,
|
||||
min: lastCandle.close,
|
||||
@@ -751,8 +751,8 @@
|
||||
}
|
||||
|
||||
let volume = {
|
||||
begin: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
|
||||
end: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
|
||||
begin: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
|
||||
end: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
|
||||
buy: lastVolume.buy,
|
||||
sell: lastVolume.sell
|
||||
}
|
||||
@@ -796,7 +796,7 @@
|
||||
timestamp in order to calculate OHLCVMinute.
|
||||
*/
|
||||
let OHLCV = {
|
||||
timestamp: (new Date()).valueOf() + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS,
|
||||
timestamp: (new Date()).valueOf() + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS,
|
||||
open: 0,
|
||||
hight: 0,
|
||||
low: 0,
|
||||
@@ -824,7 +824,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
let candleMinute = Math.trunc(candle.begin / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
|
||||
let candleMinute = Math.trunc(candle.begin / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
|
||||
let OHLCVMinute
|
||||
/*
|
||||
Some exchanges return inconsistent data. It is not guaranteed
|
||||
@@ -833,7 +833,7 @@
|
||||
between timestamps will be the same. To fix this, we will do this.
|
||||
*/
|
||||
|
||||
OHLCVMinute = Math.trunc(OHLCV.timestamp / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
|
||||
OHLCVMinute = Math.trunc(OHLCV.timestamp / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
|
||||
|
||||
/*
|
||||
If the minute of the record item received from the exchange is
|
||||
@@ -873,7 +873,7 @@
|
||||
}
|
||||
|
||||
/* Recalculate this to see if we need to break the loop*/
|
||||
OHLCVMinute = Math.trunc(OHLCV.timestamp / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
|
||||
OHLCVMinute = Math.trunc(OHLCV.timestamp / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -981,14 +981,14 @@
|
||||
let fileName = 'Data.json'
|
||||
|
||||
filesToCreate++
|
||||
fileStorage.createTextFile(getFilePath(day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, CANDLES_FOLDER_NAME) + '/' + fileName, candlesFileContent + '\n', onFileCreated);
|
||||
fileStorage.createTextFile(getFilePath(day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, CANDLES_FOLDER_NAME) + '/' + fileName, candlesFileContent + '\n', onFileCreated);
|
||||
|
||||
filesToCreate++
|
||||
fileStorage.createTextFile(getFilePath(day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, VOLUMES_FOLDER_NAME) + '/' + fileName, volumesFileContent + '\n', onFileCreated);
|
||||
fileStorage.createTextFile(getFilePath(day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, VOLUMES_FOLDER_NAME) + '/' + fileName, volumesFileContent + '\n', onFileCreated);
|
||||
|
||||
if (ohlcvsFileContent !== undefined) {
|
||||
filesToCreate++
|
||||
fileStorage.createTextFile(getFilePath(day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, OHLCVS_FOLDER_NAME) + '/' + fileName, ohlcvsFileContent + '\n', onFileCreated);
|
||||
fileStorage.createTextFile(getFilePath(day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, OHLCVS_FOLDER_NAME) + '/' + fileName, ohlcvsFileContent + '\n', onFileCreated);
|
||||
mustLoadRawData = true
|
||||
} else {
|
||||
mustLoadRawData = false
|
||||
@@ -1010,11 +1010,11 @@
|
||||
let dataLength = rawDataArray.length
|
||||
if (dataLength > 0) {
|
||||
// first get the start of the day after this day we are checking
|
||||
let timestamp = (day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) +
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
let timestamp = (day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) +
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
if (rawDataArray[dataLength - 1][0] < timestamp) {
|
||||
// there is no data for the next day, so now trim this day's data to remove anything before it
|
||||
timestamp -= TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
timestamp -= SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
let dataIndex = 0
|
||||
while (dataIndex < dataLength - 1) {
|
||||
if (rawDataArray[dataIndex][0] < timestamp) { // this data is from a previous day
|
||||
@@ -1043,7 +1043,7 @@
|
||||
return;
|
||||
}
|
||||
filesCreated++
|
||||
lastFile = new Date((currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS))
|
||||
lastFile = new Date((currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS))
|
||||
if (filesCreated === filesToCreate) {
|
||||
controlLoop()
|
||||
}
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "exchange-raw-data",
|
||||
"version": "0.0.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ccxt": {
|
||||
"version": "1.51.98",
|
||||
"resolved": "https://registry.npmjs.org/ccxt/-/ccxt-1.51.98.tgz",
|
||||
"integrity": "sha512-3sgRDrOnD6IE06yGr+F0YcQh22eNyKiZ3nQP+QdZt8W/zUUsl4CaHT5I7Zqqz7ObKdv4YcdMCv8j9khTpBNz4w=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "exchange-raw-data",
|
||||
"version": "0.0.6",
|
||||
"description": "Sensor Bot",
|
||||
"main": "HistoricOHLCVs.js",
|
||||
"author": {
|
||||
"name": "Luis-Fernando-Molina"
|
||||
},
|
||||
"dependencies": {
|
||||
"ccxt": "^1.51.98"
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ exports.newFoundationsBotModulesCheckWebhook = function (processIndex) {
|
||||
|
||||
function saveMessages() {
|
||||
try {
|
||||
let http = require('http');
|
||||
let http = SA.nodeModules.http
|
||||
let url = 'http://' + global.env.WEB_SERVER_URL +
|
||||
':' + global.env.CLIENT_HTTP_INTERFACE_PORT +
|
||||
'/Webhook/Fetch-Messages/' +
|
||||
|
||||
@@ -38,7 +38,7 @@ exports.newFoundationsBotModulesDiscordBot = function (processIndex) {
|
||||
function finalize() {}
|
||||
|
||||
function sendMessage(message) {
|
||||
const https = require('https')
|
||||
const https = SA.nodeModules.https
|
||||
|
||||
try {
|
||||
message = formatMessage(message)
|
||||
|
||||
@@ -38,7 +38,7 @@ exports.newFoundationsBotModulesSlackBot = function (processIndex) {
|
||||
function finalize() {}
|
||||
|
||||
function sendMessage(message) {
|
||||
const https = require('https')
|
||||
const https = SA.nodeModules.https
|
||||
|
||||
try {
|
||||
message = formatMessage(message)
|
||||
|
||||
@@ -22,7 +22,7 @@ exports.newFoundationsBotModulesTelegramBot = function (processIndex) {
|
||||
|
||||
thisObject.chatId = chatId
|
||||
|
||||
const Telegraf = require('telegraf')
|
||||
const { Telegraf } = SA.nodeModules.telegraf
|
||||
|
||||
thisObject.telegramBot = new Telegraf(botToken)
|
||||
thisObject.telegramBot.start((ctx) => ctx.reply('Hi! I am the Telegram Bot that will tell you what happens with your trading session.'))
|
||||
@@ -41,9 +41,7 @@ exports.newFoundationsBotModulesTelegramBot = function (processIndex) {
|
||||
|
||||
thisObject.telegramBot.launch()
|
||||
|
||||
const Telegram = require('telegraf/telegram')
|
||||
|
||||
thisObject.telegramAPI = new Telegram(botToken)
|
||||
thisObject.telegramAPI = thisObject.telegramBot.telegram
|
||||
|
||||
const message = "Telegram bot is starting. For assistance type /help."
|
||||
thisObject.telegramAPI.sendMessage(thisObject.chatId, message)
|
||||
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
||||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
},
|
||||
"module-alias": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz",
|
||||
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q=="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
},
|
||||
"sandwich-stream": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz",
|
||||
"integrity": "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ=="
|
||||
},
|
||||
"telegraf": {
|
||||
"version": "3.38.0",
|
||||
"resolved": "https://registry.npmjs.org/telegraf/-/telegraf-3.38.0.tgz",
|
||||
"integrity": "sha512-va4VlrKWp64JrowFoZX/NPzzA6q38kvaIukVXOWFO1V+jR1G8+hCfgJy4TX8Z3rwLJzwaBEet1QhikHDRZWl3A==",
|
||||
"requires": {
|
||||
"debug": "^4.0.1",
|
||||
"minimist": "^1.2.0",
|
||||
"module-alias": "^2.2.2",
|
||||
"node-fetch": "^2.2.0",
|
||||
"sandwich-stream": "^2.0.1",
|
||||
"telegram-typings": "^3.6.0"
|
||||
}
|
||||
},
|
||||
"telegram-typings": {
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/telegram-typings/-/telegram-typings-3.6.1.tgz",
|
||||
"integrity": "sha512-njVv1EAhIZnmQVLocZEADYUyqA1WIXuVcDYlsp+mXua/XB0pxx+PKtMSPeZ/EE4wPWTw9h/hA9ASTT6yQelkiw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "announcements",
|
||||
"version": "0.0.6",
|
||||
"description": "Social Bots",
|
||||
"main": "SocialBots.js",
|
||||
"author": {
|
||||
"name": "Luis-Fernando-Molina"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^4.3.1",
|
||||
"minimist": "^1.2.5",
|
||||
"module-alias": "^2.2.2",
|
||||
"ms": "^2.1.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"sandwich-stream": "^2.0.2",
|
||||
"telegraf": "^3.38.0",
|
||||
"telegram-typings": "^3.6.1"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
let options = {}
|
||||
let exchange
|
||||
|
||||
const ccxt = require('ccxt')
|
||||
const ccxt = SA.nodeModules.ccxt
|
||||
|
||||
return thisObject;
|
||||
|
||||
|
||||
Generated
-13
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "apis",
|
||||
"version": "0.0.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ccxt": {
|
||||
"version": "1.51.98",
|
||||
"resolved": "https://registry.npmjs.org/ccxt/-/ccxt-1.51.98.tgz",
|
||||
"integrity": "sha512-3sgRDrOnD6IE06yGr+F0YcQh22eNyKiZ3nQP+QdZt8W/zUUsl4CaHT5I7Zqqz7ObKdv4YcdMCv8j9khTpBNz4w=="
|
||||
}
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "apis",
|
||||
"version": "0.0.6",
|
||||
"description": "Exchange APIs",
|
||||
"main": "ExchangeAPI.js",
|
||||
"author": {
|
||||
"name": "Luis-Fernando-Molina"
|
||||
},
|
||||
"dependencies": {
|
||||
"ccxt": "^1.51.98"
|
||||
}
|
||||
}
|
||||
+156
-81
@@ -1,7 +1,7 @@
|
||||
exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
exports.newFoundationsBotModulesSnapshots = function(processIndex) {
|
||||
/*
|
||||
This module encapsulates the snapshots functionality.
|
||||
*/
|
||||
This module encapsulates the snapshots functionality.
|
||||
*/
|
||||
const MODULE_NAME = 'Snapshots'
|
||||
|
||||
let thisObject = {
|
||||
@@ -28,20 +28,21 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
positions: []
|
||||
}
|
||||
|
||||
let positionKeys = new Map() // This is to prevent adding the same indicator / variable to the output collection.
|
||||
let positionKeys = new Map() // This is to prevent adding the same indicator / variable to the output collection.
|
||||
let strategyKeys = new Map()
|
||||
let createHeaders = true // This is going to be true only once
|
||||
let createCloseHeaders = true // This is going to be true only once
|
||||
let createHeaders = true // This is going to be true only once
|
||||
let createCloseHeaders = true // This is going to be true only once
|
||||
let closeValues
|
||||
let strategyValues
|
||||
let addToStrategyValues
|
||||
let positionValues
|
||||
let addToPositionValues
|
||||
let snapshotAvailable = false
|
||||
|
||||
/*
|
||||
These 3 are the main data structures available to users
|
||||
when writing conditions and formulas.
|
||||
*/
|
||||
These 3 are the main data structures available to users
|
||||
when writing conditions and formulas.
|
||||
*/
|
||||
let chart
|
||||
let exchange
|
||||
let market
|
||||
@@ -52,6 +53,12 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
tradingEngine = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingEngine
|
||||
tradingSystem = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingSystem
|
||||
sessionParameters = TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters
|
||||
// first trade forces overwrite of the existing file
|
||||
if (tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.positions.value > 1) {
|
||||
snapshotAvailable = true
|
||||
createHeaders = false // This is going to be true only once
|
||||
createCloseHeaders = false
|
||||
}
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
@@ -70,9 +77,9 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
|
||||
function updateChart(pChart, pExchange, pMarket) {
|
||||
/*
|
||||
We need these 3 data structures to be a local objects
|
||||
accessible while evaluating conditions and formulas.
|
||||
*/
|
||||
We need these 3 data structures to be a local objects
|
||||
accessible while evaluating conditions and formulas.
|
||||
*/
|
||||
chart = pChart
|
||||
exchange = pExchange
|
||||
market = pMarket
|
||||
@@ -80,9 +87,9 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
|
||||
function strategyEntry() {
|
||||
/*
|
||||
We will record here a snapshot of all values used in conditions and formulas within the Trading System.
|
||||
If the strategy exists with a trade, this information will be added to the snapshots file.
|
||||
*/
|
||||
We will record here a snapshot of all values used in conditions and formulas within the Trading System.
|
||||
If the strategy exists with a trade, this information will be added to the snapshots file.
|
||||
*/
|
||||
|
||||
strategyKeys = new Map()
|
||||
strategyValues = []
|
||||
@@ -147,24 +154,26 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
let property = schemaDocument.childrenNodesProperties[i]
|
||||
|
||||
switch (property.type) {
|
||||
case 'node': {
|
||||
if (property.name !== previousPropertyName) {
|
||||
case 'node':
|
||||
{
|
||||
if (property.name !== previousPropertyName) {
|
||||
if (node[property.name] !== undefined) {
|
||||
evalNode(node[property.name])
|
||||
}
|
||||
previousPropertyName = property.name
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'array':
|
||||
{
|
||||
if (node[property.name] !== undefined) {
|
||||
evalNode(node[property.name])
|
||||
let nodePropertyArray = node[property.name]
|
||||
for (let m = 0; m < nodePropertyArray.length; m++) {
|
||||
evalNode(nodePropertyArray[m])
|
||||
}
|
||||
}
|
||||
previousPropertyName = property.name
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'array': {
|
||||
if (node[property.name] !== undefined) {
|
||||
let nodePropertyArray = node[property.name]
|
||||
for (let m = 0; m < nodePropertyArray.length; m++) {
|
||||
evalNode(nodePropertyArray[m])
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,10 +182,10 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
function evalCondition(node) {
|
||||
|
||||
/*
|
||||
The code can be at the condition node if it was done with the Conditions Editor, or it can also be
|
||||
at a Javascript Code node. If there is a Javascript object we will give it preference and take the code
|
||||
from there. Otherwise we will take the code from the Condition node.
|
||||
*/
|
||||
The code can be at the condition node if it was done with the Conditions Editor, or it can also be
|
||||
at a Javascript Code node. If there is a Javascript object we will give it preference and take the code
|
||||
from there. Otherwise we will take the code from the Condition node.
|
||||
*/
|
||||
|
||||
let nodeWithCode = node
|
||||
if (node.javascriptCode !== undefined) {
|
||||
@@ -211,14 +220,15 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
instruction = instruction.replace(/!==/g, '')
|
||||
instruction = instruction.replace(/==/g, '')
|
||||
instruction = instruction.replace(/===/g, '')
|
||||
instruction = instruction.replace(/{/g, '')
|
||||
instruction = instruction.replace(/}/g, '')
|
||||
instruction = instruction.replace(/{/g, '') //this wrecks something in JS markup?
|
||||
instruction = instruction.replace(/}/g, '') //this wrecks something in JS markup?
|
||||
if (instruction.indexOf('chart') >= 0) {
|
||||
let parts = instruction.split('.')
|
||||
let timeFrame = parts[1]
|
||||
let product = parts[2]
|
||||
let property
|
||||
checkPrevious(3)
|
||||
|
||||
function checkPrevious(index) {
|
||||
property = parts[index]
|
||||
if (property === 'previous') {
|
||||
@@ -293,19 +303,35 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
|
||||
function getResults(openDatetime, closeDatetime) {
|
||||
|
||||
let closeHeaders = ['Trade Number', 'Open Datetime', 'Close Datetime', 'Strategy Name', 'Trigger On Situation', 'Take Position Situation', 'Result In Base Asset', 'Result In Quoted Asset', 'ROI in Base Asset', 'ROI in Quoted Asset', 'Exit Type']
|
||||
let baseOpen = tradingEngine.tradingCurrent.strategyCloseStage.stageBaseAsset.sizeFilled.value - tradingEngine.tradingCurrent.strategyCloseStage.stageBaseAsset.feesPaid.value
|
||||
let baseClose = tradingEngine.tradingCurrent.strategyOpenStage.stageBaseAsset.sizeFilled.value - tradingEngine.tradingCurrent.strategyOpenStage.stageBaseAsset.feesPaid.value
|
||||
let quoteOpen = tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value - tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.feesPaid.value
|
||||
let quoteClose = tradingEngine.tradingCurrent.strategyCloseStage.stageQuotedAsset.sizeFilled.value - tradingEngine.tradingCurrent.strategyCloseStage.stageQuotedAsset.feesPaid.value
|
||||
let qouteProfit = ((quoteClose / quoteOpen * 100) - 100)
|
||||
let baseProfit = ((baseClose / baseOpen * 100) - 100)
|
||||
|
||||
let closeHeaders = ['Trade Number', 'Open Datetime', 'Close Datetime', 'Strategy Name', 'Trigger On Situation', 'Take Position Situation', 'Open Position in Base Asset', 'Close Position in Base Asset', 'Open Position in Quoted Asset', 'Close Position in Quoted Asset', 'Result In Base Asset', 'Result In Quoted Asset', 'ROI in Base Asset', '% P/L Base Asset', 'P/L Type Base Asset', 'ROI in Quoted Asset', '% P/L Quoted Asset', 'P/L Type Quoted Asset', 'Exit Type']
|
||||
closeValues = [
|
||||
tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.positions.value, // Position Number
|
||||
(new Date(openDatetime)).toISOString(), // Open Datetime
|
||||
(new Date(closeDatetime)).toISOString(), // Open Datetime
|
||||
tradingEngine.tradingCurrent.strategy.strategyName.value, // Strategy Name
|
||||
tradingEngine.tradingCurrent.strategy.situationName.value, // Trigger On Situation
|
||||
tradingEngine.tradingCurrent.position.situationName.value, // Take Position Situation
|
||||
tradingEngine.tradingCurrent.position.positionBaseAsset.hitFail.value, // Result in Base Asset
|
||||
tradingEngine.tradingCurrent.position.positionQuotedAsset.hitFail.value, // Result in Base Asset
|
||||
tradingEngine.tradingCurrent.position.positionBaseAsset.ROI.value, // ROI in Base Asseet
|
||||
tradingEngine.tradingCurrent.position.positionQuotedAsset.ROI.value, // ROI in Quoted Asset
|
||||
tradingEngine.tradingCurrent.position.exitType.value // Exit Type
|
||||
tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.positions.value, // Position Number
|
||||
(new Date(openDatetime)).toISOString(), // Open Datetime
|
||||
(new Date(closeDatetime)).toISOString(), // Open Datetime
|
||||
tradingEngine.tradingCurrent.strategy.strategyName.value, // Strategy Name
|
||||
tradingEngine.tradingCurrent.strategy.situationName.value, // Trigger On Situation
|
||||
tradingEngine.tradingCurrent.position.situationName.value, // Take Position Situation
|
||||
baseOpen, // open position in base asset
|
||||
baseClose, // close position in base asset
|
||||
quoteOpen, //open quote in base asset
|
||||
quoteClose, // close quote in base asset
|
||||
tradingEngine.tradingCurrent.position.positionBaseAsset.hitFail.value, // Result in Base Asset
|
||||
tradingEngine.tradingCurrent.position.positionQuotedAsset.hitFail.value, // Result in Base Asset
|
||||
tradingEngine.tradingCurrent.position.positionBaseAsset.ROI.value, // ROI in Base Asset <- not sure this works as intended
|
||||
baseProfit + '%', // % profit / loss in base Asset
|
||||
baseProfit === 0 ? 'Even' : (baseProfit > 0 ? "Profit" : "Loss"),
|
||||
|
||||
tradingEngine.tradingCurrent.position.positionQuotedAsset.ROI.value, // ROI in Quoted Asset <- not sure this works as intended
|
||||
qouteProfit + '%', // % profit loss in quoted Asset
|
||||
qouteProfit === 0 ? 'Even' : (qouteProfit > 0 ? "Profit" : "Loss"),
|
||||
tradingEngine.tradingCurrent.position.exitType.value // Exit Type
|
||||
]
|
||||
|
||||
if (createCloseHeaders === true) {
|
||||
@@ -333,46 +359,95 @@ exports.newFoundationsBotModulesSnapshots = function (processIndex) {
|
||||
try {
|
||||
let fileStorage = TS.projects.foundations.taskModules.fileStorage.newFileStorage(processIndex);
|
||||
|
||||
let fileContent = "";
|
||||
let separator = "\r\n";
|
||||
let fileName = pFileName + '.csv'
|
||||
|
||||
parseRecord(snapshots.headers)
|
||||
|
||||
for (let i = 0; i < snapshotArray.length; i++) {
|
||||
let record = snapshotArray[i];
|
||||
parseRecord(record)
|
||||
}
|
||||
|
||||
function parseRecord(record) {
|
||||
for (let j = 0; j < record.length; j++) {
|
||||
let property = record[j]
|
||||
|
||||
fileContent = fileContent + '' + property
|
||||
if (j !== record.length - 1) {
|
||||
fileContent = fileContent + ","
|
||||
}
|
||||
}
|
||||
fileContent = fileContent + separator
|
||||
}
|
||||
|
||||
fileContent = "" + fileContent + "";
|
||||
|
||||
let fileName = pFileName + '.csv';
|
||||
let filePath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT + "/Output/" + TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_FOLDER_NAME + "/" + SNAPSHOTS_FOLDER_NAME;
|
||||
let filePath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT + '/Output/' + TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_FOLDER_NAME + '/' + SNAPSHOTS_FOLDER_NAME;
|
||||
filePath += '/' + fileName
|
||||
|
||||
fileStorage.createTextFile(filePath, fileContent + '\n', onFileCreated);
|
||||
//Get contents of current file if available, otherwise start empty file
|
||||
if (snapshotAvailable) {
|
||||
getSnapShotFile(filePath)
|
||||
} else {
|
||||
writeOutput('')
|
||||
}
|
||||
|
||||
function onFileCreated(err) {
|
||||
if (err.result !== TS.projects.foundations.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] writeSnapshotFile -> onFileCreated -> err = " + err.stack);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] writeSnapshotFile -> onFileCreated -> filePath = " + filePath);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] writeSnapshotFile -> onFileCreated -> market = " + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName + "_" + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName);
|
||||
function writeOutput(fileContent) {
|
||||
let separator = '\r\n';
|
||||
|
||||
parseRecord(snapshots.headers)
|
||||
|
||||
for (let i = 0; i < snapshotArray.length; i++) {
|
||||
let record = snapshotArray[i];
|
||||
parseRecord(record)
|
||||
}
|
||||
|
||||
function parseRecord(record) {
|
||||
for (let j = 0; j < record.length; j++) {
|
||||
let property = record[j]
|
||||
|
||||
fileContent = fileContent + '' + property
|
||||
if (j !== record.length - 1) {
|
||||
fileContent = fileContent + ","
|
||||
}
|
||||
}
|
||||
fileContent = fileContent + separator
|
||||
}
|
||||
|
||||
fileContent = "" + fileContent + "";
|
||||
|
||||
fileStorage.createTextFile(filePath, fileContent + '\n', onFileCreated)
|
||||
|
||||
function onFileCreated(err) {
|
||||
if (err.result !== TS.projects.foundations.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] writeSnapshotFile -> onFileCreated -> err = ' + err.stack);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] writeSnapshotFile -> onFileCreated -> filePath = ' + filePath);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] writeSnapshotFile -> onFileCreated -> market = ' + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName + '_' + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(
|
||||
processIndex
|
||||
).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(
|
||||
MODULE_NAME,
|
||||
'[ERROR] writeSnapshotFile -> err = ' + err.stack
|
||||
)
|
||||
}
|
||||
catch (err) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] writeSnapshotFile -> err = " + err.stack);
|
||||
//get file contents
|
||||
function getSnapShotFile(filePath) {
|
||||
|
||||
try {
|
||||
|
||||
let fileStorage = TS.projects.foundations.taskModules.fileStorage.newFileStorage(processIndex);
|
||||
|
||||
fileStorage.getTextFile(filePath, onFileReceived)
|
||||
|
||||
function onFileReceived(err, text) {
|
||||
if (err.result === TS.projects.foundations.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
try {
|
||||
writeOutput(text)
|
||||
} catch (err) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> fileName = ' + filePath);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> filePath = ' + filePath);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> err = ' + err.stack);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> Asuming this is a temporary situation. Requesting a Retry.');
|
||||
callBackFunction(TS.projects.foundations.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
}
|
||||
} else {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> err = ' + err.stack);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> filePath = ' + filePath);
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).UNEXPECTED_ERROR = err;
|
||||
callBackFunction(err)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> err = ' + err.stack);
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] start -> loadExistingFiles -> loopBody -> readExistingFile -> onFileReceived -> filePath = ' + filePath);
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).UNEXPECTED_ERROR = err;
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -113,7 +113,7 @@ exports.newFoundationsBotModulesTradingEpisode = function (processIndex) {
|
||||
tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.days.value =
|
||||
tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.periods.value *
|
||||
sessionParameters.timeFrame.config.value /
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
|
||||
function cycleBasedStatistics() {
|
||||
|
||||
+1
-1
@@ -1286,7 +1286,7 @@ exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
|
||||
}
|
||||
|
||||
function updateStatistics(tradingEngineOrder) {
|
||||
tradingEngineOrder.orderStatistics.days.value = tradingEngineOrder.orderCounters.periods.value * sessionParameters.timeFrame.config.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
tradingEngineOrder.orderStatistics.days.value = tradingEngineOrder.orderCounters.periods.value * sessionParameters.timeFrame.config.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
tradingEngineOrder.orderStatistics.days.value = TS.projects.foundations.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderStatistics.days.value, 10)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -513,7 +513,7 @@ exports.newFoundationsBotModulesTradingPosition = function (processIndex) {
|
||||
/* Days Calculation */
|
||||
tradingEngine.tradingCurrent.position.positionStatistics.days.value =
|
||||
tradingEngine.tradingCurrent.position.positionCounters.periods.value *
|
||||
sessionParameters.timeFrame.config.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
sessionParameters.timeFrame.config.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
|
||||
tradingEngine.tradingCurrent.position.positionStatistics.days.value = TS.projects.foundations.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngine.tradingCurrent.position.positionStatistics.days.value, 10)
|
||||
}
|
||||
|
||||
+3
-3
@@ -303,7 +303,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
if (sessionParameters.heartbeats.config.date === true || sessionParameters.heartbeats.config.candleIndex === true) {
|
||||
/* We will produce a simulation level heartbeat in order to inform the user this is running. */
|
||||
|
||||
heartBeatDate = new Date(Math.trunc(tradingEngine.tradingCurrent.tradingEpisode.candle.begin.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
heartBeatDate = new Date(Math.trunc(tradingEngine.tradingCurrent.tradingEpisode.candle.begin.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
let fromDate = new Date(sessionParameters.timeRange.config.initialDatetime)
|
||||
let lastDate = new Date(sessionParameters.timeRange.config.finalDatetime)
|
||||
@@ -493,7 +493,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
the day, we will advance current process day one day. By doing so, during the next execution, the
|
||||
simulation will receive the candles and indicators files of the next day.
|
||||
*/
|
||||
let candlesPerDay = TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
|
||||
let candlesPerDay = SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
|
||||
if (
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.index.value + 1 + 1 === candlesPerDay
|
||||
@@ -507,7 +507,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
*/
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.index.value = 0
|
||||
tradingEngine.tradingCurrent.tradingEpisode.processDate.value =
|
||||
tradingEngine.tradingCurrent.tradingEpisode.processDate.value + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
tradingEngine.tradingCurrent.tradingEpisode.processDate.value + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
type: 'Time Range',
|
||||
config: {
|
||||
initialDatetime: (new Date()).valueOf(),
|
||||
finalDatetime: (new Date()).valueOf() + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
finalDatetime: (new Date()).valueOf() + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -300,8 +300,8 @@
|
||||
|
||||
/* Session Type Forced Values */
|
||||
let today = (new Date()).valueOf()
|
||||
let aYearAgo = today - TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
let aYearFromNow = today + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
let aYearAgo = today - SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
let aYearFromNow = today + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
switch (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type) {
|
||||
case 'Backtesting Session': {
|
||||
useDefaultDatetimes(aYearAgo, today)
|
||||
|
||||
@@ -315,7 +315,7 @@ exports.newFoundationsFunctionLibrariesDataDependenciesFunctions = function () {
|
||||
/*
|
||||
We will need to fetch the data of the current day and the previous day, in order for .previous properties in conditions and formulas to work well.
|
||||
*/
|
||||
let previousDate = new Date(processDate.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
let previousDate = new Date(processDate.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
let currentDate = new Date(processDate.valueOf())
|
||||
|
||||
let previousFile = await getDataFileFromDate(previousDate)
|
||||
|
||||
@@ -215,15 +215,15 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeLastProducedFile.valueOf() -
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
|
||||
|
||||
callbackFirstRun()
|
||||
return
|
||||
@@ -236,7 +236,7 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
|
||||
For that reason we go back one day, the partial information is discarded and
|
||||
added again with whatever new info is available.
|
||||
*/
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
callbackNotFirstRun()
|
||||
return
|
||||
@@ -249,15 +249,15 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
|
||||
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
|
||||
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
|
||||
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.datetimeLastProducedFile = new Date(
|
||||
contextVariables.datetimeLastProducedFile.valueOf() -
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
|
||||
|
||||
callbackFirstRun()
|
||||
return
|
||||
@@ -298,7 +298,7 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
|
||||
from there into the future.
|
||||
*/
|
||||
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() +
|
||||
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[INFO] advanceTime -> New processing time @ " +
|
||||
|
||||
@@ -100,7 +100,7 @@ exports.newFoundationsFunctionLibrariesProcessFilesFunctions = function () {
|
||||
}
|
||||
|
||||
function startFromBegining() {
|
||||
contextVariables.lastFile = new Date(contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" + (contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" + contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" + TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
contextVariables.lastFile = new Date(contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" + (contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" + contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" + SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[INFO] start -> getContextVariables -> startFromBegining -> contextVariables.lastFile = " + contextVariables.lastFile)
|
||||
@@ -147,7 +147,7 @@ exports.newFoundationsFunctionLibrariesProcessFilesFunctions = function () {
|
||||
async function writeDataRange(productCodeName) {
|
||||
let dataRange = {
|
||||
begin: contextVariables.dateBeginOfMarket.valueOf(),
|
||||
end: processDate.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
end: processDate.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
|
||||
let fileContent = JSON.stringify(dataRange)
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
|
||||
let system = { // These are the available system variables to be used in User Code and Formulas
|
||||
timeFrame: timeFrame,
|
||||
ONE_DAY_IN_MILISECONDS: TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
ONE_DAY_IN_MILISECONDS: SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
|
||||
}
|
||||
let variable = {} // This is the structure where the user will define its own variables that will be shared across different code blocks and formulas.
|
||||
let results = []
|
||||
@@ -312,8 +312,8 @@
|
||||
let yesterday = {}
|
||||
let system = { // These are the available system variables to be used in User Code and Formulas
|
||||
timeFrame: timeFrame,
|
||||
ONE_DAY_IN_MILISECONDS: TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS,
|
||||
ONE_MIN_IN_MILISECONDS: TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
|
||||
ONE_DAY_IN_MILISECONDS: SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS,
|
||||
ONE_MIN_IN_MILISECONDS: SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
|
||||
}
|
||||
let variable = {} // This is the structure where the user will define its own variables that will be shared across different code blocks and formulas.
|
||||
let results = []
|
||||
@@ -407,7 +407,7 @@
|
||||
|
||||
if (processingDailyFiles) {
|
||||
/* Initialization of Last Instance */
|
||||
lastInstantOfTheDay = currentDay.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
|
||||
lastInstantOfTheDay = currentDay.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
|
||||
|
||||
if (interExecutionMemory[productName] === undefined) {
|
||||
/* The first time the intialization variables goes to the Inter Execution Memory. */
|
||||
@@ -515,7 +515,7 @@
|
||||
at the next day, in whole, even if it starts in the previous day.
|
||||
*/
|
||||
|
||||
let lastInstantOdDay = currentDay.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
|
||||
let lastInstantOdDay = currentDay.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
|
||||
|
||||
if (record.end < currentDay.valueOf() - 1) { continue; }
|
||||
if (record.end === lastInstantOdDay) { continue; }
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
let responseWaiters = new Map()
|
||||
|
||||
let WEB_SOCKETS_CLIENT
|
||||
const WEB_SOCKET = require('ws')
|
||||
const WEB_SOCKET = SA.nodeModules.ws
|
||||
|
||||
if (host === undefined) {
|
||||
host = 'localhost'
|
||||
@@ -49,7 +49,7 @@
|
||||
WEB_SOCKETS_CLIENT.onerror = err => {
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> On connection error -> error = ' + err.stack)
|
||||
console.log('[ERROR] This could mean that the port '+ port +' is taken by some other app running at your system. To resolve this issue, please pick another port number and change it at the .ENV file inside the Superalgos folder AND at the .Environment.js file inside the TaskServer folder. After that run the app again. ')
|
||||
console.log('[ERROR] If you are debugging, it can also mean that the Superalgos Client is not running. ')
|
||||
console.log('[ERROR] If you are debugging, it can also mean that the Superalgos Platform Client is not running. ')
|
||||
}
|
||||
WEB_SOCKETS_CLIENT.onopen = () => {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
|
||||
const ip = require("ip");
|
||||
const ip = SA.nodeModules.ip
|
||||
const MODULE_NAME = 'FileStorage'
|
||||
const MAX_RETRY = 10
|
||||
const FAST_RETRY_TIME_IN_MILISECONDS = 500
|
||||
@@ -8,16 +8,17 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
|
||||
let thisObject = {
|
||||
asyncGetTextFile: asyncGetTextFile,
|
||||
asyncCreateTextFile: asyncCreateTextFile,
|
||||
asyncCreateTextFile: asyncCreateTextFile,
|
||||
getTextFile: getTextFile,
|
||||
createTextFile: createTextFile,
|
||||
deleteTextFile: deleteTextFile
|
||||
}
|
||||
|
||||
|
||||
|
||||
let logger
|
||||
if (TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT === undefined) { // Dummy logger
|
||||
logger = {}
|
||||
|
||||
function write() {
|
||||
|
||||
}
|
||||
@@ -31,16 +32,17 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
/* This function allows its caller to work with async / await instead of callbacks */
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
||||
getTextFile(filePath, onFileRead, noRetry, canUsePrevious)
|
||||
getTextFile(filePath, onFileRead, noRetry, canUsePrevious)
|
||||
|
||||
function onFileRead(err, text) {
|
||||
|
||||
|
||||
let response = {
|
||||
err: err,
|
||||
text: text
|
||||
}
|
||||
resolve(response)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
return promise
|
||||
}
|
||||
@@ -49,15 +51,16 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
/* This function allows its caller to work with async / await instead of callbacks */
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
||||
createTextFile(filePath, fileContent, onFileWriten, keepPrevious, noTemp)
|
||||
createTextFile(filePath, fileContent, onFileWriten, keepPrevious, noTemp)
|
||||
|
||||
function onFileWriten(err) {
|
||||
|
||||
|
||||
let response = {
|
||||
err: err
|
||||
}
|
||||
resolve(response)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
return promise
|
||||
}
|
||||
@@ -78,8 +81,13 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
fileLocation = global.env.PATH_TO_PROJECTS + '/' + filePath
|
||||
mustBeJason = false
|
||||
} else {
|
||||
if (filePath.indexOf('.csv') > 0) {
|
||||
mustBeJason = false
|
||||
} else {
|
||||
mustBeJason = true
|
||||
}
|
||||
fileLocation = global.env.PATH_TO_DATA_STORAGE + '/' + filePath
|
||||
mustBeJason = true
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -89,7 +97,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
/* Here we actually reaad the file. */
|
||||
if (host === undefined || host === 'localhost' || host === ip.address() || host === '127.0.0.1') {
|
||||
/* We read the file from the local file system. */
|
||||
const fs = require('fs')
|
||||
const fs = SA.nodeModules.fs
|
||||
fs.readFile(fileLocation, onFileRead)
|
||||
} else {
|
||||
/* We read the file via a web server over http */
|
||||
@@ -145,7 +153,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
}
|
||||
|
||||
/*
|
||||
We are going to check if the file is a valir JSON object
|
||||
We are going to check if the file is a valid JSON object
|
||||
*/
|
||||
try {
|
||||
let jsonCheck = JSON.parse(text.toString())
|
||||
@@ -161,7 +169,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
|
||||
if (host === undefined || host === 'localhost' || host === ip.address() || host === '127.0.0.1') {
|
||||
/* We read the file from the local file system. */
|
||||
const fs = require('fs')
|
||||
const fs = SA.nodeModules.fs
|
||||
fs.readFile(fileLocation + '.Previous.json', onPreviousFileRead)
|
||||
} else {
|
||||
/* We read the file via a web server over http */
|
||||
@@ -250,7 +258,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
Here we write the file with a temporary name so as to avoid dirty read from other processes.
|
||||
Then we delete the original file, if exists, and finally we rename the temporary into the original name.
|
||||
*/
|
||||
const fs = require('fs')
|
||||
const fs = SA.nodeModules.fs
|
||||
if (noTemp === true) {
|
||||
fs.writeFile(fileLocation, fileContent, onFileWriten)
|
||||
} else {
|
||||
@@ -400,7 +408,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
|
||||
logger.write(MODULE_NAME, '[INFO] FileStorage -> deleteTextFile -> fileLocation: ' + fileLocation)
|
||||
|
||||
const fs = require('fs')
|
||||
const fs = SA.nodeModules.fs
|
||||
fs.unlink(fileLocation, onUnlinked)
|
||||
|
||||
function onUnlinked(err) {
|
||||
@@ -447,7 +455,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
/* The filePath received is the one that is needed to fetch data from with fs. To do it via http we need to remove the prefix that includes this: ./Data-Storage/ */
|
||||
filePath = filePath.substring(15, filePath.length)
|
||||
|
||||
let http = require('http');
|
||||
let http = SA.nodeModules.http
|
||||
let url = 'http://' + host +
|
||||
':' + port +
|
||||
'/Storage/' +
|
||||
@@ -457,7 +465,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
|
||||
let request = http.get(url, onResponse);
|
||||
|
||||
request.on('error', function (err) {
|
||||
request.on('error', function(err) {
|
||||
logger.write(MODULE_NAME, "[ERROR] getFileViaHTTP -> onError -> err = " + err.stack);
|
||||
logger.write(MODULE_NAME, "[ERROR] getFileViaHTTP -> onError -> Failed to fetch file via HTTP. Will retry later. ");
|
||||
callBackFunction(TS.projects.foundations.globals.standardResponses.DEFAULT_RETRY_RESPONSE);
|
||||
@@ -498,4 +506,4 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
|
||||
callBackFunction(TS.projects.foundations.globals.standardResponses.DEFAULT_RETRY_RESPONSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "task-modules",
|
||||
"version": "0.0.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ip": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
|
||||
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
|
||||
},
|
||||
"ws": {
|
||||
"version": "7.4.6",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
|
||||
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "task-modules",
|
||||
"version": "0.0.6",
|
||||
"description": "Tasks Server",
|
||||
"main": "EventServerClient.js",
|
||||
"author": {
|
||||
"name": "Luis-Fernando-Molina"
|
||||
},
|
||||
"dependencies": {
|
||||
"ip": "^1.1.5",
|
||||
"ws": "^7.4.6"
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ exports.newFoundationsUtilitiesDateTimeFunctions = function () {
|
||||
|
||||
function removeTime(datetime) {
|
||||
let date = new Date(datetime)
|
||||
return new Date(date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "-" + date.getUTCDate() + " " + "00:00" + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
return new Date(date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "-" + date.getUTCDate() + " " + "00:00" + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
|
||||
}
|
||||
|
||||
function getPercentage(fromDate, currentDate, lastDate) {
|
||||
@@ -26,8 +26,8 @@ exports.newFoundationsUtilitiesDateTimeFunctions = function () {
|
||||
}
|
||||
|
||||
function areTheseDatesEqual(date1, date2) {
|
||||
let day1Days = Math.trunc(date1.valueOf() / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
let day2Days = Math.trunc(date2.valueOf() / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
let day1Days = Math.trunc(date1.valueOf() / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
let day2Days = Math.trunc(date2.valueOf() / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
|
||||
|
||||
if (day1Days === day2Days) {
|
||||
return true
|
||||
|
||||
@@ -779,48 +779,14 @@ function newFoundationsActionSwitch() {
|
||||
UI.projects.foundations.functionLibraries.socialBotsFunctions.sendSlackTestMessage(action.node, action.callBackFunction)
|
||||
}
|
||||
break
|
||||
case 'Copy Position':
|
||||
case 'Save node to be moved':
|
||||
{
|
||||
UI.projects.foundations.utilities.clipboard.copyTextToClipboard( action.node.payload.position.x + ';' + action.node.payload.position.y)
|
||||
action.node.payload.uiObject.setInfoMessage('Position copied')
|
||||
UI.projects.foundations.spaces.floatingSpace.saveFloatingObjectToBeMoved()
|
||||
}
|
||||
break
|
||||
case 'Snap to Position':
|
||||
case 'Snap saved node to position':
|
||||
{
|
||||
navigator.clipboard.readText()
|
||||
.then(text => {
|
||||
//console.log('Pasted content: ', text);
|
||||
let newPosition = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
let newVector = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
let positionArray = text.split(";",2)
|
||||
|
||||
newPosition.x = positionArray[0]
|
||||
newPosition.y = positionArray[1]
|
||||
|
||||
if (newPosition.x >= 0 && newPosition.x <= UI.projects.foundations.spaces.floatingSpace.container.frame.width) {
|
||||
newVector.x = newPosition.x - action.node.payload.position.x
|
||||
|
||||
if (newPosition.y >= 0 && newPosition.y <= UI.projects.foundations.spaces.floatingSpace.container.frame.height) {
|
||||
|
||||
newVector.y = newPosition.y - action.node.payload.position.y
|
||||
action.node.payload.floatingObject.container.displace(newVector)
|
||||
action.node.payload.uiObject.setInfoMessage('Snapped to new position')
|
||||
}
|
||||
}
|
||||
else {
|
||||
action.node.payload.uiObject.setErrorMessage('[Error]:Failed to read clipboard contents')
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('[Error]:Failed to read clipboard contents: ', err);
|
||||
action.node.payload.uiObject.setErrorMessage('[Error]:Failed to read clipboard contents')
|
||||
});
|
||||
UI.projects.foundations.spaces.floatingSpace.moveFloatingObject(action.node.payload.position)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ function newFoundationsFunctionLibraryWorkspaceFunctions() {
|
||||
|
||||
if (alreadyExist === false) {
|
||||
let child = UI.projects.foundations.functionLibraries.uiObjectsFromNodes.addUIObject(node, project + ' Project', rootNodes, project)
|
||||
if (child === undefined) { continue }
|
||||
child.project = project
|
||||
child.projectDefinition.name = project
|
||||
child.projectDefinition.config = "{ \n \"codeName\": \"" + project + "\"\n}"
|
||||
|
||||
@@ -301,6 +301,13 @@ function newCircularMenuItem() {
|
||||
|
||||
function onMouseOver(point) {
|
||||
if (thisObject.container.frame.isThisPointHere(point, true, false) === true) {
|
||||
let text = thisObject.action
|
||||
|
||||
if(thisObject.payload.uiObject.payload.referenceParent !== undefined && thisObject.action === 'Reference Detach'){
|
||||
text = text + ' -> [Existing Reference] Type : [' + thisObject.payload.uiObject.payload.referenceParent.type + '] , Name : [' + thisObject.payload.uiObject.payload.referenceParent.name + ']'
|
||||
}
|
||||
|
||||
thisObject.payload.uiObject.setInfoMessage(text)
|
||||
isMouseOver = true
|
||||
} else {
|
||||
isMouseOver = false
|
||||
|
||||
@@ -16,6 +16,7 @@ function newFoundationsFloatingSpace() {
|
||||
drawChainLines: true,
|
||||
style: undefined,
|
||||
settings: undefined,
|
||||
floatingObjetSaved: undefined,
|
||||
toggleDrawChainLines: toggleDrawChainLines,
|
||||
toggleDrawReferenceLines: toggleDrawReferenceLines,
|
||||
toggleMapMode: toggleMapMode,
|
||||
@@ -38,7 +39,10 @@ function newFoundationsFloatingSpace() {
|
||||
physics: physics,
|
||||
getContainer: getContainer,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
finalize: finalize,
|
||||
saveFloatingObjectToBeMoved: saveFloatingObjectToBeMoved,
|
||||
moveSavedFloatingObjectToMouse: moveSavedFloatingObjectToMouse,
|
||||
moveFloatingObject: moveFloatingObject
|
||||
}
|
||||
|
||||
thisObject.container = newContainer()
|
||||
@@ -106,7 +110,9 @@ function newFoundationsFloatingSpace() {
|
||||
toggleDrawRelationshipLines: "R",
|
||||
toggleDrawParentLines: "C",
|
||||
saveWorkspace: "S",
|
||||
adjustAspectRatio: "A"
|
||||
adjustAspectRatio: "A",
|
||||
saveFloatingObjectToBeMoved: "Z",
|
||||
moveSavedFloatingObjectToMouse: "X"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,6 +570,13 @@ function newFoundationsFloatingSpace() {
|
||||
if (configSettings.shortcuts.adjustAspectRatio !== undefined) {
|
||||
thisObject.settings.shortcuts.adjustAspectRatio = configSettings.shortcuts.adjustAspectRatio
|
||||
}
|
||||
if (configSettings.shortcuts.saveFloatingObjectToBeMoved !== undefined) {
|
||||
thisObject.settings.shortcuts.saveFloatingObjectToBeMoved = configSettings.shortcuts.saveFloatingObjectToBeMoved
|
||||
}
|
||||
if (configSettings.shortcuts.moveSavedFloatingObjectToMouse !== undefined) {
|
||||
thisObject.settings.shortcuts.moveSavedFloatingObjectToMouse = configSettings.shortcuts.moveSavedFloatingObjectToMouse
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,4 +620,57 @@ function newFoundationsFloatingSpace() {
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.fill()
|
||||
}
|
||||
|
||||
function saveFloatingObjectToBeMoved() {
|
||||
|
||||
thisObject.floatingObjetSaved = undefined
|
||||
|
||||
if(floatingObjetOnFocus.isOnFocus === true){
|
||||
thisObject.floatingObjetSaved = floatingObjetOnFocus
|
||||
}
|
||||
if(thisObject.floatingObjetSaved === undefined){
|
||||
UI.projects.foundations.spaces.cockpitSpace.setStatus('No node on focus', 100, UI.projects.foundations.spaces.cockpitSpace.statusTypes.WARNING)
|
||||
}else{
|
||||
UI.projects.foundations.spaces.cockpitSpace.setStatus('Type : [' + thisObject.floatingObjetSaved.payload.node.type + '] , Name : [' + thisObject.floatingObjetSaved.payload.node.name + '] -> Node saved and ready to be moved', 100, UI.projects.foundations.spaces.cockpitSpace.statusTypes.ALL_GOOD)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function moveSavedFloatingObjectToMouse(mousePosition) {
|
||||
|
||||
mousePosition.y = mousePosition.y + CURRENT_TOP_MARGIN
|
||||
let positionConv
|
||||
positionConv = thisObject.container.frame.frameThisPoint(mousePosition)
|
||||
positionConv.x = (2 * mousePosition.x) - positionConv.x
|
||||
positionConv.y = (2 * mousePosition.y) - positionConv.y
|
||||
|
||||
moveFloatingObject(positionConv)
|
||||
|
||||
}
|
||||
|
||||
function moveFloatingObject(position){
|
||||
|
||||
if(thisObject.floatingObjetSaved === undefined){
|
||||
UI.projects.foundations.spaces.cockpitSpace.setStatus('No node saved, unable to move.', 100, UI.projects.foundations.spaces.cockpitSpace.statusTypes.WARNING)
|
||||
}else{
|
||||
|
||||
let newPosition = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
let newVector = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
newPosition.x = position.x
|
||||
newPosition.y = position.y
|
||||
|
||||
newVector.x = newPosition.x - thisObject.floatingObjetSaved.payload.position.x
|
||||
newVector.y = newPosition.y - thisObject.floatingObjetSaved.payload.position.y
|
||||
|
||||
thisObject.floatingObjetSaved.container.displace(newVector)
|
||||
UI.projects.foundations.spaces.cockpitSpace.setStatus('Type : [' + UI.projects.foundations.spaces.floatingSpace.floatingObjetSaved.payload.node.type + '] , Name : [' + UI.projects.foundations.spaces.floatingSpace.floatingObjetSaved.payload.node.name + '] -> Snapped to new position', 100, UI.projects.foundations.spaces.cockpitSpace.statusTypes.ALL_GOOD)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -367,7 +367,7 @@ function newUiObjectConstructor() {
|
||||
}
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Copy Position',
|
||||
action: 'Save node to be moved',
|
||||
actionFunction: floatingObject.payload.executeAction,
|
||||
actionProject: 'Foundations',
|
||||
label: undefined,
|
||||
@@ -383,7 +383,7 @@ function newUiObjectConstructor() {
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Snap to Position',
|
||||
action: 'Snap saved node to position',
|
||||
actionFunction: floatingObject.payload.executeAction,
|
||||
actionProject: 'Foundations',
|
||||
label: undefined,
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"type": "Assets",
|
||||
"name": "Education-Project-CL",
|
||||
"config": "{\"codeName\":\"Education-Project-CL\"}",
|
||||
"name": "Education-Project-PL",
|
||||
"config": "{\"codeName\":\"Education-Project-PL\"}",
|
||||
"project": "Governance",
|
||||
"assetClasses": [
|
||||
{
|
||||
"type": "Asset Class",
|
||||
"name": "Client",
|
||||
"config": "{\n \"folderPath\": \"Education/CL\"\n}",
|
||||
"config": "{\n \"folderPath\": \"Education/PL\"\n}",
|
||||
"project": "Governance",
|
||||
"assetClasses": [],
|
||||
"assets": [],
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"type": "Assets",
|
||||
"name": "Ethereum-Project-CL",
|
||||
"config": "{\"codeName\":\"Ethereum-Project-CL\"}",
|
||||
"name": "Ethereum-Project-PL",
|
||||
"config": "{\"codeName\":\"Ethereum-Project-PL\"}",
|
||||
"project": "Governance",
|
||||
"assetClasses": [
|
||||
{
|
||||
"type": "Asset Class",
|
||||
"name": "Client",
|
||||
"config": "{\n \"folderPath\": \"Ethereum/CL\"\n}",
|
||||
"config": "{\n \"folderPath\": \"Ethereum/PL\"\n}",
|
||||
"project": "Governance",
|
||||
"assetClasses": [],
|
||||
"assets": [],
|
||||
Loaded 100 of 161 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user