Merge pull request #2912 from Luis-Fernando-Molina/develop

Contribution: Signal sent from Task reaching the P2P Network
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-12-05 13:51:57 -04:00
commit 39d402049c
21 files changed
+501 -28089

No files matched your search

+7 -7
View File
@@ -2,7 +2,7 @@ exports.newDesktopApp = function newDesktopApp() {
let thisObject = {
userProfiles: undefined,
p2pNetworkClient: undefined,
p2pNetworkClientIdentity: undefined,
p2pNetwork: undefined,
p2pNetworkPeers: undefined,
webSocketsInterface: undefined,
@@ -25,13 +25,13 @@ exports.newDesktopApp = function newDesktopApp() {
/*
We set up ourselves as a Network Client.
*/
thisObject.p2pNetworkClient = SA.projects.network.modules.p2pNetworkClient.newNetworkModulesP2PNetworkClient()
await thisObject.p2pNetworkClient.initialize()
thisObject.p2pNetworkClientIdentity = SA.projects.network.modules.p2pNetworkClientIdentity.newNetworkModulesP2PNetworkClientIdentity()
await thisObject.p2pNetworkClientIdentity.initialize()
/*
We will read all user profiles plugins and get from there our network identity.
*/
thisObject.userProfiles = SA.projects.network.modules.userProfiles.newNetworkModulesUserProfiles()
await thisObject.userProfiles.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClient)
await thisObject.userProfiles.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClientIdentity)
/*
We set up the P2P Network.
*/
@@ -43,7 +43,7 @@ exports.newDesktopApp = function newDesktopApp() {
thisObject.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
await thisObject.p2pNetworkPeers.initialize(
'Network Client',
thisObject.p2pNetworkClient,
thisObject.p2pNetworkClientIdentity,
thisObject.p2pNetwork,
global.env.DESKTOP_APP_MAX_OUTGOING_PEERS
)
@@ -68,11 +68,11 @@ exports.newDesktopApp = function newDesktopApp() {
*/
thisObject.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface()
thisObject.webSocketsInterface.initialize()
console.log('Desktop Client Web Sockets Interface ......................................... Listening at port ' + JSON.parse(DK.desktopApp.p2pNetworkClient.node.config).webSocketsPort)
console.log('Desktop Client Web Sockets Interface ......................................... Listening at port ' + JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webSocketsPort)
thisObject.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface()
thisObject.httpInterface.initialize()
console.log('Desktop Client Http Interface ................................................ Listening at port ' + JSON.parse(DK.desktopApp.p2pNetworkClient.node.config).webPort)
console.log('Desktop Client Http Interface ................................................ Listening at port ' + JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webPort)
}
}
}
+7 -7
View File
@@ -3,7 +3,7 @@ exports.newDesktopApp = function newDesktopApp() {
let thisObject = {
userProfiles: undefined,
p2pNetworkClient: undefined,
p2pNetworkClientIdentity: undefined,
p2pNetwork: undefined,
p2pNetworkPeers: undefined,
webSocketsInterface: undefined,
@@ -26,13 +26,13 @@ exports.newDesktopApp = function newDesktopApp() {
/*
We set up ourselves as a Network Client.
*/
thisObject.p2pNetworkClient = SA.projects.network.modules.p2pNetworkClient.newNetworkModulesP2PNetworkClient()
await thisObject.p2pNetworkClient.initialize()
thisObject.p2pNetworkClientIdentity = SA.projects.network.modules.p2pNetworkClientIdentity.newNetworkModulesP2PNetworkClientIdentity()
await thisObject.p2pNetworkClientIdentity.initialize()
/*
We will read all user profiles plugins and get from there our network identity.
*/
thisObject.userProfiles = SA.projects.network.modules.userProfiles.newNetworkModulesUserProfiles()
await thisObject.userProfiles.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClient)
await thisObject.userProfiles.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClientIdentity)
/*
We set up the P2P Network.
*/
@@ -44,7 +44,7 @@ exports.newDesktopApp = function newDesktopApp() {
thisObject.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
await thisObject.p2pNetworkPeers.initialize(
'Network Client',
thisObject.p2pNetworkClient,
thisObject.p2pNetworkClientIdentity,
thisObject.p2pNetwork,
global.env.DESKTOP_APP_MAX_OUTGOING_PEERS
)
@@ -67,13 +67,13 @@ exports.newDesktopApp = function newDesktopApp() {
let express = require('./backend/src/index')
let expressPort = JSON.parse(DK.desktopApp.p2pNetworkClient.node.config).webPort;
let expressPort = JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webPort;
express.startExpress(expressPort,SA);
console.log('express Interface ................................................ Listening at port ' + expressPort);
/*TODO change this to have a definite port number*/
let react = require('./frontend/scripts/start')
let reactPort = (+JSON.parse(DK.desktopApp.p2pNetworkClient.node.config).webPort + 1);
let reactPort = (+JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webPort + 1);
react.start(reactPort);
console.log('react Interface ................................................ Listening at port ' + reactPort);
}
+1
View File
@@ -33,6 +33,7 @@ exports.newEnvironment = function () {
DESKTOP_APP_SIGNING_ACCOUNT: 'Social-Trading-Desktop-App-1',
DESKTOP_APP_MAX_OUTGOING_PEERS: 1,
TASK_SERVER_APP_MAX_OUTGOING_PEERS: 1,
TASK_SERVER_APP_MAX_OUTGOING_HEADS: 1,
MOBILE_APP_SIGNING_ACCOUNT: 'Social-Trading-Mobile-App-1',
SERVER_APP_SIGNING_ACCOUNT: 'Social-Trading-Server-App-1',
PLATFORM_APP_SIGNING_ACCOUNT: 'Algo-Traders-Platform-1',
@@ -154,7 +154,7 @@ exports.newAlgorithmicTradingBotModulesTradingStages = function (processIndex) {
/* Initialize this */
tradingEngine.tradingCurrent.tradingEpisode.distanceToTradingEvent.triggerOn.value = 1
outgoingTradingSignalsModuleObject.broadcastSignal(triggerStage.triggerOn)
await outgoingTradingSignalsModuleObject.broadcastSignal(triggerStage.triggerOn)
announcementsModuleObject.makeAnnouncements(triggerStage.triggerOn)
if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type === 'Backtesting Session') {
@@ -1,20 +0,0 @@
{
"review": "Superalgos Project Review",
"pageNumber": 30,
"type": "Superalgos Review - Superalgos Review - Taking Crypto Trading to the Next Level Applying Machine Learning",
"definition": {
"text": "Great project, a lot of patience and creativity are needed!",
"updated": 1633159669760
},
"paragraphs": [
{
"style": "Text",
"text": "A very sophisticated pioneering technology in the modern world of trading cryptocurrency. The fineness and complexity of the structure show us, how much effort was put into developing Superalgos, thus hinting how reliable the outcome could be. Still superalgos could be very challenging and not for the faint-hearted amateurs. It needs a whole lot of serious work, consistency, concentration, understanding, patience and critical as well as creative thinking. Likewise a decent ability of problem solving.",
"updated": 1633159694958
},
{
"style": "Text",
"text": "BillyYan13"
}
]
}
@@ -0,0 +1,20 @@
{
"review": "Superalgos Project Review",
"pageNumber": 30,
"type": "Superalgos Review - Superalgos Review - Taking Crypto Trading to the Next Level with ML",
"definition": {
"text": "Great project, a lot of patience and creativity are needed!",
"updated": 1633159669760
},
"paragraphs": [
{
"style": "Text",
"text": "Taking Crypto Trading to the Next Level Applying Machine Learning: A very sophisticated pioneering technology in the modern world of trading cryptocurrency. The fineness and complexity of the structure show us, how much effort was put into developing Superalgos, thus hinting how reliable the outcome could be. Still superalgos could be very challenging and not for the faint-hearted amateurs. It needs a whole lot of serious work, consistency, concentration, understanding, patience and critical as well as creative thinking. Likewise a decent ability of problem solving.",
"updated": 1633159694958
},
{
"style": "Text",
"text": "BillyYan13"
}
]
}
@@ -1,4 +1,4 @@
function newFoundationsFunctionLibraryTaskFunctions() {
function newFoundationsFunctionLibraryTaskFunctions() {
let thisObject = {
synchronizeTaskWithBackEnd: synchronizeTaskWithBackEnd,
@@ -642,7 +642,7 @@
"poolWeightVotes": [
{
"type": "Pool Weight Vote",
"name": "Liquidity Rewards BTCB Pool",
"name": "",
"config": "{\r\n \"percentage\": 80\r\n}",
"project": "Governance",
"id": "2e6f62b7-74ed-4005-bd23-0c6b0e8e7d86",
@@ -697,7 +697,7 @@
},
{
"type": "Pool Weight Vote",
"name": "Liquidity Rewards BNB Pool",
"name": "",
"config": "{\r\n \"percentage\": 15\r\n}",
"project": "Governance",
"id": "0a9e7ec8-69a6-4de9-8972-931c492fa33e",
@@ -752,7 +752,7 @@
},
{
"type": "Pool Weight Vote",
"name": "Liquidity Rewards BUSD Pool",
"name": "",
"config": "{}",
"project": "Governance",
"id": "cfc1692a-0461-4bde-a4e6-ffb1b7620bf8",
@@ -864,7 +864,7 @@
"poolWeightVotes": [
{
"type": "Pool Weight Vote",
"name": "Team Positions Pool",
"name": "",
"config": "{}",
"project": "Governance",
"id": "89ee5b51-976d-4eaf-abc2-445c3a1dec2b",
@@ -960,7 +960,7 @@
"poolWeightVotes": [
{
"type": "Pool Weight Vote",
"name": "Support Rewards Pool",
"name": "",
"config": "{}",
"project": "Governance",
"id": "1c002437-998f-49d8-9a48-c4effe4ee7df",
@@ -1328,7 +1328,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "alexandrustefan",
"name": "",
"config": "{\r\n \"percentage\": 70\r\n}",
"project": "Governance",
"id": "da1969ba-e1fc-40f6-a246-41b0102b8e22",
@@ -1369,7 +1369,7 @@
},
{
"type": "User Delegate",
"name": "NAmorim",
"name": "",
"config": "{\n \"percentage\": 30\n}",
"project": "Governance",
"id": "d8d3a46a-bcc6-4fdc-88e0-f9a37a5ebaef",
@@ -1441,7 +1441,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "harrellbm",
"name": "",
"config": "{}",
"project": "Governance",
"id": "af0bdf1a-acf9-4621-ba01-8cbf7e1be56d",
@@ -1847,12 +1847,12 @@
"id": "5bbf87b3-0c88-4762-8963-dcc013778923",
"savedPayload": {
"position": {
"x": 37688.45333466609,
"y": 19598.585369022054
"x": 14620.594289134748,
"y": 46642.93366623567
},
"targetPosition": {
"x": 37687.45333466609,
"y": 19499.585369022054
"x": 14360.786667999417,
"y": 46492.93366623567
},
"floatingObject": {
"isPinned": false,
@@ -1870,12 +1870,12 @@
"id": "33c4f8e9-f8a3-4dea-91f4-1539e3aed0d3",
"savedPayload": {
"position": {
"x": 37687.45333466609,
"y": 19499.585369022054
"x": 14360.786667999417,
"y": 46492.93366623567
},
"targetPosition": {
"x": 37427.64571353076,
"y": 19349.585369022054
"x": 14100.979046864086,
"y": 46342.93366623567
},
"floatingObject": {
"isPinned": false,
@@ -1903,12 +1903,12 @@
"id": "ef671e4a-85ca-44a2-aaff-46986537af62",
"savedPayload": {
"position": {
"x": 37558.291427061515,
"y": 19577.363116908775
"x": 14256.270473925597,
"y": 46922.489162009115
},
"targetPosition": {
"x": 37505.291427061515,
"y": 19639.363116908775
"x": 14178.624760394841,
"y": 46632.711414122394
},
"floatingObject": {
"isPinned": false,
@@ -1926,12 +1926,12 @@
"id": "ad887d5f-998f-48c5-9db7-78e17c66f4e4",
"savedPayload": {
"position": {
"x": 37505.291427061515,
"y": 19639.363116908775
"x": 14178.624760394841,
"y": 46632.711414122394
},
"targetPosition": {
"x": 37427.64571353076,
"y": 19349.585369022054
"x": 14100.979046864086,
"y": 46342.93366623567
},
"floatingObject": {
"isPinned": false,
@@ -1961,12 +1961,12 @@
"id": "616fc2e6-2286-49ce-b037-9da2b153a8f5",
"savedPayload": {
"position": {
"x": 37345.64571353076,
"y": 19667.392990157387
"x": 13800.979046864086,
"y": 46862.54890850634
},
"targetPosition": {
"x": 37277.64571353076,
"y": 19609.392990157387
"x": 13950.979046864086,
"y": 46602.741287371005
},
"floatingObject": {
"isPinned": false,
@@ -1984,12 +1984,12 @@
"id": "0a06a54b-825b-4ff4-93cc-36465348ad26",
"savedPayload": {
"position": {
"x": 37277.64571353076,
"y": 19609.392990157387
"x": 13950.979046864086,
"y": 46602.741287371005
},
"targetPosition": {
"x": 37427.64571353076,
"y": 19349.585369022054
"x": 14100.979046864086,
"y": 46342.93366623567
},
"floatingObject": {
"isPinned": false,
@@ -2008,12 +2008,12 @@
"id": "abcc6b01-099e-42b4-84cc-24fb6daa7a15",
"savedPayload": {
"position": {
"x": 37427.64571353076,
"y": 19349.585369022054
"x": 14100.979046864086,
"y": 46342.93366623567
},
"targetPosition": {
"x": 37350,
"y": 19059.807621135333
"x": 14023.33333333333,
"y": 46053.15591834895
},
"floatingObject": {
"isPinned": false,
@@ -2047,12 +2047,12 @@
"id": "c958d032-f21f-4e60-9d93-410ca3f650f8",
"savedPayload": {
"position": {
"x": 37066,
"y": 19626.422863406
"x": 13573.33333333333,
"y": 46832.57878175495
},
"targetPosition": {
"x": 37050,
"y": 19579.422863406
"x": 13723.33333333333,
"y": 46572.77116061962
},
"floatingObject": {
"isPinned": false,
@@ -2070,12 +2070,12 @@
"id": "42843263-b1f3-4e4e-885a-5d8b9d7b647a",
"savedPayload": {
"position": {
"x": 37050,
"y": 19579.422863406
"x": 13723.33333333333,
"y": 46572.77116061962
},
"targetPosition": {
"x": 37200,
"y": 19319.615242270665
"x": 13873.33333333333,
"y": 46312.963539484284
},
"floatingObject": {
"isPinned": false,
@@ -2094,12 +2094,12 @@
"id": "de1b0ac7-1bcf-4412-af43-4597443c0ec3",
"savedPayload": {
"position": {
"x": 37200,
"y": 19319.615242270665
"x": 13873.33333333333,
"y": 46312.963539484284
},
"targetPosition": {
"x": 37350,
"y": 19059.807621135333
"x": 14023.33333333333,
"y": 46053.15591834895
},
"floatingObject": {
"isPinned": false,
@@ -2133,12 +2133,12 @@
"id": "90f0eaeb-99a4-4e19-ae05-c19567059dba",
"savedPayload": {
"position": {
"x": 36832.22225211328,
"y": 19368.260955801423
"x": 13433.55558544661,
"y": 46650.416874150374
},
"targetPosition": {
"x": 36910.22225211328,
"y": 19397.260955801423
"x": 13583.55558544661,
"y": 46390.60925301504
},
"floatingObject": {
"isPinned": false,
@@ -2156,12 +2156,12 @@
"id": "c4bdbb6a-5172-4f94-856e-02e930a8d8a9",
"savedPayload": {
"position": {
"x": 36910.22225211328,
"y": 19397.260955801423
"x": 13583.55558544661,
"y": 46390.60925301504
},
"targetPosition": {
"x": 37060.22225211328,
"y": 19137.45333466609
"x": 13733.55558544661,
"y": 46130.80163187971
},
"floatingObject": {
"isPinned": false,
@@ -2189,12 +2189,12 @@
"id": "358e8b10-6a2b-4711-b842-42ff37c8b9a0",
"savedPayload": {
"position": {
"x": 36684.44450422656,
"y": 19186.099048196847
"x": 13154.000089673167,
"y": 46286.093058941224
},
"targetPosition": {
"x": 36770.44450422656,
"y": 19215.099048196847
"x": 13443.777837559888,
"y": 46208.44734541047
},
"floatingObject": {
"isPinned": false,
@@ -2212,12 +2212,12 @@
"id": "bd3e6d5a-900f-4067-ab89-0a06d768c43b",
"savedPayload": {
"position": {
"x": 36770.44450422656,
"y": 19215.099048196847
"x": 13443.777837559888,
"y": 46208.44734541047
},
"targetPosition": {
"x": 37060.22225211328,
"y": 19137.45333466609
"x": 13733.55558544661,
"y": 46130.80163187971
},
"floatingObject": {
"isPinned": false,
@@ -2247,12 +2247,12 @@
"id": "3c08805f-d53a-4091-b671-4dfab46af594",
"savedPayload": {
"position": {
"x": 36877.414630977946,
"y": 19025.45333466609
"x": 13213.940343175947,
"y": 45830.80163187971
},
"targetPosition": {
"x": 36800.414630977946,
"y": 18987.45333466609
"x": 13473.747964311278,
"y": 45980.80163187971
},
"floatingObject": {
"isPinned": false,
@@ -2270,12 +2270,12 @@
"id": "0216b143-0e46-4da6-b2cb-e95556fc1bfd",
"savedPayload": {
"position": {
"x": 36800.414630977946,
"y": 18987.45333466609
"x": 13473.747964311278,
"y": 45980.80163187971
},
"targetPosition": {
"x": 37060.22225211328,
"y": 19137.45333466609
"x": 13733.55558544661,
"y": 46130.80163187971
},
"floatingObject": {
"isPinned": false,
@@ -2294,17 +2294,17 @@
"id": "b0db0d19-5529-4b96-ab4f-ac7d54e1e6db",
"savedPayload": {
"position": {
"x": 37060.22225211328,
"y": 19137.45333466609
"x": 13733.55558544661,
"y": 46130.80163187971
},
"targetPosition": {
"x": 37350,
"y": 19059.807621135333
"x": 14023.33333333333,
"y": 46053.15591834895
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -2327,7 +2327,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -2478,12 +2478,12 @@
"id": "e42dfedc-6906-4833-8737-44d5f45ab82e",
"savedPayload": {
"position": {
"x": 32395.879998667246,
"y": 19239.77774788672
"x": 13235.879998667244,
"y": 46233.12604510034
},
"targetPosition": {
"x": 32473.525712198003,
"y": 18950
"x": 13313.525712198,
"y": 45943.34829721362
},
"floatingObject": {
"isPinned": false,
@@ -2506,12 +2506,12 @@
"id": "c16d25bb-6e53-4229-acd1-6384d8765a0b",
"savedPayload": {
"position": {
"x": 32554.525712198003,
"y": 18873
"x": 13053.718091062668,
"y": 46093.34829721362
},
"targetPosition": {
"x": 32473.525712198003,
"y": 18950
"x": 13313.525712198,
"y": 45943.34829721362
},
"floatingObject": {
"isPinned": false,
@@ -2544,12 +2544,12 @@
"id": "6cfcae4f-d155-4d51-b912-7248fee0ed37",
"savedPayload": {
"position": {
"x": 31919.245636893895,
"y": 19359.506972394676
"x": 12759.245636893891,
"y": 46352.8552696083
},
"targetPosition": {
"x": 31950.604175874192,
"y": 19061.150403784195
"x": 12790.604175874187,
"y": 46054.498700997814
},
"floatingObject": {
"isPinned": false,
@@ -2572,12 +2572,12 @@
"id": "5a66ab0c-a5ae-420e-9d35-ee9a35c47400",
"savedPayload": {
"position": {
"x": 31717.460387437102,
"y": 19249.946521099148
"x": 12557.460387437095,
"y": 46243.29481831277
},
"targetPosition": {
"x": 31950.604175874192,
"y": 19061.150403784195
"x": 12790.604175874187,
"y": 46054.498700997814
},
"floatingObject": {
"isPinned": false,
@@ -2600,12 +2600,12 @@
"id": "e056b027-4b86-49c3-80cc-94b5d2bb582d",
"savedPayload": {
"position": {
"x": 31652.24760726371,
"y": 19029.791864803898
"x": 12492.247607263706,
"y": 46023.14016201752
},
"targetPosition": {
"x": 31950.604175874192,
"y": 19061.150403784195
"x": 12790.604175874187,
"y": 46054.498700997814
},
"floatingObject": {
"isPinned": false,
@@ -2623,12 +2623,12 @@
"id": "211939a7-a174-440d-8fc3-4218b2a38226",
"savedPayload": {
"position": {
"x": 31950.604175874192,
"y": 19061.150403784195
"x": 12790.604175874187,
"y": 46054.498700997814
},
"targetPosition": {
"x": 32183.747964311282,
"y": 18872.354286469243
"x": 13023.747964311278,
"y": 45865.70258368286
},
"floatingObject": {
"isPinned": false,
@@ -2740,12 +2740,12 @@
"id": "eef0e49a-4901-450e-89cf-61647315aff4",
"savedPayload": {
"position": {
"x": 31884.15910388491,
"y": 18888.055073342126
"x": 12724.159103884906,
"y": 45881.403370555745
},
"targetPosition": {
"x": 32183.747964311282,
"y": 18872.354286469243
"x": 13023.747964311278,
"y": 45865.70258368286
},
"floatingObject": {
"isPinned": false,
@@ -2768,12 +2768,12 @@
"id": "6319c0ae-81ac-457c-9ff1-213c99c432f2",
"savedPayload": {
"position": {
"x": 31932.146793927655,
"y": 18708.962575964735
"x": 12772.146793927652,
"y": 45702.31087317835
},
"targetPosition": {
"x": 32183.747964311282,
"y": 18872.354286469243
"x": 13023.747964311278,
"y": 45865.70258368286
},
"floatingObject": {
"isPinned": false,
@@ -3388,12 +3388,12 @@
"id": "232af7b2-e244-4829-939f-f6469a54655a",
"savedPayload": {
"position": {
"x": 32076.23757944769,
"y": 18592.280158520083
"x": 12916.237579447688,
"y": 45585.6284557337
},
"targetPosition": {
"x": 32183.747964311282,
"y": 18872.354286469243
"x": 13023.747964311278,
"y": 45865.70258368286
},
"floatingObject": {
"isPinned": false,
@@ -3411,12 +3411,12 @@
"id": "3699bf51-a7c1-4174-ac81-8cfeb400af54",
"savedPayload": {
"position": {
"x": 32183.747964311282,
"y": 18872.354286469243
"x": 13023.747964311278,
"y": 45865.70258368286
},
"targetPosition": {
"x": 32473.525712198003,
"y": 18950
"x": 13313.525712198,
"y": 45943.34829721362
},
"floatingObject": {
"isPinned": false,
@@ -3434,12 +3434,12 @@
"id": "5167a23f-1e17-4cd5-85a7-3c7f2a3019ac",
"savedPayload": {
"position": {
"x": 32473.525712198003,
"y": 18950
"x": 13313.525712198,
"y": 45943.34829721362
},
"targetPosition": {
"x": 32733.333333333336,
"y": 18800
"x": 13573.33333333333,
"y": 45793.34829721362
},
"floatingObject": {
"isPinned": false,
@@ -3721,12 +3721,12 @@
"id": "c27748af-db60-44fc-a095-530401057beb",
"savedPayload": {
"position": {
"x": 32473.525712198003,
"y": 18650
"x": 13313.525712198,
"y": 45643.34829721362
},
"targetPosition": {
"x": 32733.333333333336,
"y": 18800
"x": 13573.33333333333,
"y": 45793.34829721362
},
"floatingObject": {
"isPinned": false,
@@ -3745,12 +3745,12 @@
"id": "4809934c-d45d-4565-a686-5d96bd695b4f",
"savedPayload": {
"position": {
"x": 32733.333333333336,
"y": 18800
"x": 13573.33333333333,
"y": 45793.34829721362
},
"targetPosition": {
"x": 33033.333333333336,
"y": 18800
"x": 13873.33333333333,
"y": 45793.34829721362
},
"floatingObject": {
"isPinned": false,
@@ -3778,7 +3778,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
+2 -2
View File
@@ -29,10 +29,10 @@ exports.newNetworkModulesHttpInterface = function newNetworkModulesHttpInterface
let endpointOrFile = requestPath[1]
switch (endpointOrFile) {
case 'Signal':
case 'New-Signal':
{
let message = requestPath[2]
let response = await thisObject.clientInterface.messageReceived(message)
let response = 'Message Received' //await thisObject.clientInterface.messageReceived(message)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(response), httpResponse)
}
break
@@ -0,0 +1,74 @@
exports.newNetworkModulesHttpNetworkClient = function newNetworkModulesHttpNetworkClient() {
let thisObject = {
callerRole: undefined,
host: undefined,
port: undefined,
p2pNetworkNode: undefined,
p2pNetworkClientIdentity: undefined,
p2pNetworkClientCodeName: undefined,
sendMessage: sendMessage,
initialize: initialize,
finalize: finalize
}
let web3
return thisObject
function finalize() {
thisObject.host = undefined
thisObject.port = undefined
thisObject.p2pNetworkNode = undefined
thisObject.p2pNetworkClientIdentity = undefined
web3 = undefined
}
async function initialize(callerRole, p2pNetworkClientIdentity, p2pNetworkNode) {
thisObject.callerRole = callerRole
thisObject.p2pNetworkClientIdentity = p2pNetworkClientIdentity
thisObject.p2pNetworkClientCodeName = JSON.parse(thisObject.p2pNetworkClientIdentity.node.config).codeName
thisObject.p2pNetworkNode = p2pNetworkNode
web3 = new SA.nodeModules.web3()
thisObject.host = JSON.parse(thisObject.p2pNetworkNode.node.config).host
thisObject.port = JSON.parse(thisObject.p2pNetworkNode.node.config).webPort
}
async function sendMessage(message) {
/*
This function helps a caller to use await syntax while the called
function uses callbacks, specifically for retrieving files.
*/
let promise = new Promise((resolve, reject) => {
let signature = web3.eth.accounts.sign(JSON.stringify(message), SA.secrets.map.get(thisObject.p2pNetworkClientCodeName).privateKey)
let body = {
messageId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
messageType: 'Request',
signature: JSON.stringify(signature),
payload: JSON.stringify(message)
}
const axios = require('axios')
console.log('Sending Message to P2P Network Node')
axios
.post('http://localhost:31248/New-Signal', body)
.then(res => {
console.log(`statusCode: ${res.status}`)
console.log('Response Received from P2P Network Node: ' + res.data)
resolve()
})
.catch(error => {
console.error('[ERROR] Error trying to send message to the P2P Network node via its http interface -> Error = ' + error)
reject()
})
})
return promise
}
}
+3 -1
View File
@@ -1,7 +1,9 @@
exports.newNetworkModulesP2PNetwork = function newNetworkModulesP2PNetwork() {
/*
This module represents the P2P Network and it is needed to enable the connection
of this current node to other peers.
of this current node to other peers. The main feature here is the array on
nodes that we can potengially connect to. When we are running with the role of a Network Peer,
the list of available nodes will exclude ourselves.
*/
let thisObject = {
p2pNodesToConnect: undefined,
@@ -1,4 +1,4 @@
exports.newNetworkModulesP2PNetworkClient = function newNetworkModulesP2PNetworkClient() {
exports.newNetworkModulesP2PNetworkClientIdentity = function newNetworkModulesP2PNetworkClientIdentity() {
/*
This module represents the P2P Network Client running at the moment.
*/
+14 -4
View File
@@ -1,6 +1,16 @@
exports.newNetworkModulesP2PNetworkPeers = function newNetworkModulesP2PNetworkPeers() {
/*
This module holds the P2P Nodes we are coonected to.
Here we implement the mechanism to connect via websockets
to a set of Network Nodes and keep ourselves connected to them
so that when it is needed we can send messages to them, but also
we will receive incomming messages from them.
If connections are lost, we will re establish them so as to keep
ourselves connected to the configured amount of network nodes.
When an outgoing message is received, it will be rounted to one
of our pool of connected nodes.
*/
let thisObject = {
peers: undefined,
@@ -23,7 +33,7 @@ exports.newNetworkModulesP2PNetworkPeers = function newNetworkModulesP2PNetworkP
async function initialize(
callerRole,
p2pNetworkIdentity,
p2pNetworkClientIdentity,
p2pNetwork,
maxOutgoingPeers
) {
@@ -46,9 +56,9 @@ exports.newNetworkModulesP2PNetworkPeers = function newNetworkModulesP2PNetworkP
}
peer.p2pNetworkNode = p2pNetwork.p2pNodesToConnect[i]
if (isConnectedPeer(peer) === true) { continue }
if (isPeerConnected(peer) === true) { continue }
peer.webSocketsClient = SA.projects.network.modules.webSocketsNetworkClient.newNetworkModulesWebSocketsNetworkClient()
await peer.webSocketsClient.initialize(callerRole, p2pNetworkIdentity, peer.p2pNetworkNode, onConnectionClosed)
await peer.webSocketsClient.initialize(callerRole, p2pNetworkClientIdentity, peer.p2pNetworkNode, onConnectionClosed)
.then(addPeer)
.catch(onError)
@@ -75,7 +85,7 @@ exports.newNetworkModulesP2PNetworkPeers = function newNetworkModulesP2PNetworkP
}
}
function isConnectedPeer(peer) {
function isPeerConnected(peer) {
for (let i = 0; i < thisObject.peers.length; i++) {
let connectedPeer = thisObject.peers[i]
if (connectedPeer.p2pNetworkNode.node.id === peer.p2pNetworkNode.node.id) {
@@ -0,0 +1,94 @@
exports.newNetworkModulesP2PNetworkStart = function newNetworkModulesP2PNetworkStart() {
/*
This module assumes the p2p network is formed by network nodes connected to each other
not randombly but as a directed acyclic graph.
https://en.wikipedia.org/wiki/Directed_acyclic_graph
This module will identify which are the Start Nodes of the DAG, and be ready to send
messages via the http interface of nodes to some of them.
*/
let thisObject = {
peers: undefined,
sendMessage: sendMessage,
/* Framework Functions */
initialize: initialize,
finalize: finalize
}
const RECONNECT_DELAY = 10 * 1000
let intervalIdConnectToPeers
return thisObject
function finalize() {
thisObject.peers = undefined
clearInterval(intervalIdConnectToPeers)
}
async function initialize(
callerRole,
p2pNetworkClientIdentity,
p2pNetwork,
maxOutgoingPeers
) {
thisObject.peers = []
connectToPeers()
intervalIdConnectToPeers = setInterval(connectToPeers, RECONNECT_DELAY);
async function connectToPeers() {
if (thisObject.peers.length >= maxOutgoingPeers) { return }
for (let i = 0; i < p2pNetwork.p2pNodesToConnect.length; i++) {
if (thisObject.peers.length >= maxOutgoingPeers) { break }
let peer = {
p2pNetworkNode: undefined,
httpClient: undefined
}
peer.p2pNetworkNode = p2pNetwork.p2pNodesToConnect[i]
if (isPeerConnected(peer) === true) { continue }
if (isPeerOnline(peer) === false) { continue }
thisObject.peers.push(peer)
}
function isPeerConnected(peer) {
for (let i = 0; i < thisObject.peers.length; i++) {
let connectedPeer = thisObject.peers[i]
if (connectedPeer.p2pNetworkNode.node.id === peer.p2pNetworkNode.node.id) {
return true
}
}
}
async function isPeerOnline(peer) {
/*
Test if the peer is actually online.
*/
if (peer.httpClient === undefined) {
peer.httpClient = SA.projects.network.modules.webHttpNetworkClient.newNetworkModulesHttpNetworkClient()
peer.httpClient.initialize(callerRole, p2pNetworkClientIdentity, peer.p2pNetworkNode)
}
return true // TODO:: actually check if this node is online
}
}
}
async function sendMessage(message) {
/*
This function will send the message from a random picked network node
selected from the array of already verified online peers.
*/
let peerIndex = Math.max(Math.round(Math.random() * thisObject.peers.length) - 1, 0)
let peer = thisObject.peers[peerIndex]
return await peer.httpClient.sendMessage(message)
}
}
+4 -4
View File
@@ -18,7 +18,7 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
}
async function initialize(nodeCodeName, p2pNetworkIdentity) {
async function initialize(nodeCodeName, p2pNetworkClientIdentity) {
await loadAppSchemas()
await loadProfiles()
@@ -158,9 +158,9 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
if (
networkClient.id === SA.secrets.map.get(nodeCodeName).nodeId
) {
p2pNetworkIdentity.node = networkClient
p2pNetworkIdentity.blockchainAccount = blockchainAccount
p2pNetworkIdentity.userProfile = userProfile
p2pNetworkClientIdentity.node = networkClient
p2pNetworkClientIdentity.blockchainAccount = blockchainAccount
p2pNetworkClientIdentity.userProfile = userProfile
}
}
}
+16 -4
View File
@@ -1607,6 +1607,12 @@
"functionName": "newNetworkModulesWebSocketsNetworkClient",
"fileName": "WebSocketsNetworkClient.js"
},
{
"name": "Http Network Client",
"propertyName": "webHttpNetworkClient",
"functionName": "newNetworkModulesHttpNetworkClient",
"fileName": "HttpNetworkClient.js"
},
{
"name": "User Profiles",
"propertyName": "userProfiles",
@@ -1632,10 +1638,16 @@
"fileName": "P2PNetworkPeers.js"
},
{
"name": "P2P Network Client",
"propertyName": "p2pNetworkClient",
"functionName": "newNetworkModulesP2PNetworkClient",
"fileName": "P2PNetworkClient.js"
"name": "P2P Network Head",
"propertyName": "p2pNetworkStart",
"functionName": "newNetworkModulesP2PNetworkStart",
"fileName": "P2PNetworkStart.js"
},
{
"name": "P2P Network Client Identity",
"propertyName": "p2pNetworkClientIdentity",
"functionName": "newNetworkModulesP2PNetworkClientIdentity",
"fileName": "P2PNetworkClientIdentity.js"
}
],
"utilities": [
@@ -15,7 +15,7 @@ exports.newDesktopModulesHttpInterface = function newDesktopModulesHttpInterface
}
function initialize() {
let port = JSON.parse(DK.desktopApp.p2pNetworkClient.node.config).webPort
let port = JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webPort
/*
We will create an HTTP Server and leave it running forever.
*/
@@ -42,7 +42,7 @@ exports.newDesktopModulesHttpInterface = function newDesktopModulesHttpInterface
break
case 'ClientNode':
{
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(DK.desktopApp.p2pNetworkClient.node), httpResponse)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(DK.desktopApp.p2pNetworkClientIdentity.node), httpResponse)
}
break
case 'ProjectsSchema':
@@ -9,14 +9,28 @@ exports.newTradingSignalsModulesOutgoingTradingSignals = function (processIndex)
return thisObject
function initialize() {
}
function finalize() {
}
function broadcastSignal(node) {
async function broadcastSignal(node) {
if (node === undefined) { return }
if (node.outgoingSignals === undefined) { return }
if (node.outgoingSignals === undefined) { return }
if (node.outgoingSignals.signalReferences === undefined) { return }
for (let i = 0; i < node.outgoingSignals.signalReferences.length; i++) {
let signalReference = node.outgoingSignals.signalReferences[i]
if (signalReference.referenceParent === undefined) { return }
let signalMessage = {
signalId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
tradingSystemNodeType: node.type,
socialTradingBotNodeType: signalReference.referenceParent.type,
socialTradingBotNodeId: signalReference.referenceParent.id
}
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkStart.sendMessage(signalMessage)
}
}
}
+25 -11
View File
@@ -88,7 +88,7 @@ exports.newTaskServer = function newTaskServer() {
async function bootingProcess() {
try {
initializeProjectDefinitionNode()
await setupNetwork()
await setupP2PNetwork()
setupTaskHeartbeats()
startProcesses()
@@ -114,7 +114,7 @@ exports.newTaskServer = function newTaskServer() {
}
}
async function setupNetwork() {
async function setupP2PNetwork() {
/*
If we received a App Server Reference Node and a Signing Account, then we will connect to the P2P Network
*/
@@ -127,31 +127,45 @@ exports.newTaskServer = function newTaskServer() {
}
TS.projects.foundations.globals.taskConstants.P2P_NETWORK = {}
/*
We set up ourselves as a Network Client.
We set up the object that will hold our p2p network client identity, meaning the identity we will present to the network.
*/
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClient = SA.projects.network.modules.p2pNetworkClient.newNetworkModulesP2PNetworkClient()
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClient.initialize()
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClientIdentity = SA.projects.network.modules.p2pNetworkClientIdentity.newNetworkModulesP2PNetworkClientIdentity()
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClientIdentity.initialize()
/*
We will read all user profiles plugins and get from there our network identity.
We will read all user profiles plugins, store them in memory and get from there our own network client identity.
*/
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.userProfiles = SA.projects.network.modules.userProfiles.newNetworkModulesUserProfiles()
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.userProfiles.initialize(TS.projects.foundations.globals.taskConstants.TASK_NODE.taskServerAppReference.referenceParent.config.codeName, TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClient)
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.userProfiles.initialize(
TS.projects.foundations.globals.taskConstants.TASK_NODE.taskServerAppReference.referenceParent.config.codeName,
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClientIdentity
)
/*
We set up the P2P Network.
We set up the P2P Network, meaning the array of nodes we will be able to connect to.
*/
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetwork.initialize('Network Client')
/*
Set up the connections to network nodes.
Set up the connections to network peers nodes. These connections will be used to consume signals.
In this context peers means network nodes with a similar ranking that our network client identity.
*/
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkPeers.initialize(
'Network Client',
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClient,
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClientIdentity,
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetwork,
global.env.TASK_SERVER_APP_MAX_OUTGOING_PEERS
)
}
/*
Set up the connections to network start nodes. These connections will be used to send signals.
*/
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkStart = SA.projects.network.modules.p2pNetworkStart.newNetworkModulesP2PNetworkStart()
await TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkStart.initialize(
'Network Client',
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetworkClientIdentity,
TS.projects.foundations.globals.taskConstants.P2P_NETWORK.p2pNetwork,
global.env.TASK_SERVER_APP_MAX_OUTGOING_HEADS
)
}
function setupTaskHeartbeats() {
/*
+58 -27868
View File
File diff suppressed because it is too large. Load diff
+23 -22
View File
@@ -14,41 +14,23 @@
"postsetup": "npm start",
"dist": "electron-builder -c build/electron-builder.json",
"postinstall": "electron-builder install-app-deps",
"startNetwork" : "node network",
"startNetwork": "node network",
"startDesktop": "node desktop",
"startDesktopReact": "node desktop-react"
},
"dependencies": {
"@octokit/rest": "^18.12.0",
"ccxt": "^1.61.93",
"child_process": "^1.0.2",
"electron-updater": "^4.6.1",
"ethereumjs-common": "^1.5.2",
"ethereumjs-tx": "^2.1.2",
"ethers": "^5.5.1",
"http": "0.0.1-security",
"https": "^1.0.0",
"ip": "^1.1.5",
"lookpath": "^1.2.2",
"node-fetch": "^2.6.6",
"open": "^8.4.0",
"path": "^0.12.7",
"simple-git": "^2.47.0",
"telegraf": "^4.4.2",
"twitter": "^1.7.1",
"util": "^0.12.4",
"web3": "^1.6.1",
"ws": "^8.2.3",
"@babel/core": "7.12.3",
"@emotion/react": "^11.6.0",
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "^5.1.1",
"@mui/material": "^5.1.1",
"@octokit/rest": "^18.12.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.4.3",
"@reduxjs/toolkit": "^1.6.2",
"@svgr/webpack": "5.5.0",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"axios": "^0.24.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.6.0",
"babel-loader": "8.1.0",
@@ -57,9 +39,12 @@
"bfj": "^7.0.2",
"camelcase": "^6.1.0",
"case-sensitive-paths-webpack-plugin": "2.3.0",
"ccxt": "^1.61.93",
"child_process": "^1.0.2",
"css-loader": "4.3.0",
"dotenv": "8.2.0",
"dotenv-expand": "5.1.0",
"electron-updater": "^4.6.1",
"eslint": "^7.11.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
@@ -70,16 +55,26 @@
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^3.9.2",
"eslint-webpack-plugin": "^2.5.2",
"ethereumjs-common": "^1.5.2",
"ethereumjs-tx": "^2.1.2",
"ethers": "^5.5.1",
"file-loader": "6.1.1",
"fs-extra": "^9.0.1",
"html-webpack-plugin": "4.5.0",
"http": "0.0.1-security",
"https": "^1.0.0",
"identity-obj-proxy": "3.0.0",
"ip": "^1.1.5",
"jest": "26.6.0",
"jest-circus": "26.6.0",
"jest-resolve": "26.6.0",
"jest-watch-typeahead": "0.6.1",
"lookpath": "^1.2.2",
"mini-css-extract-plugin": "0.11.3",
"node-fetch": "^2.6.6",
"open": "^8.4.0",
"optimize-css-assets-webpack-plugin": "5.0.4",
"path": "^0.12.7",
"pnp-webpack-plugin": "1.6.4",
"postcss-flexbugs-fixes": "4.2.1",
"postcss-loader": "3.0.0",
@@ -99,15 +94,21 @@
"resolve-url-loader": "^3.1.2",
"sass-loader": "^10.0.5",
"semver": "7.3.2",
"simple-git": "^2.47.0",
"style-loader": "1.3.0",
"telegraf": "^4.4.2",
"terser-webpack-plugin": "4.2.3",
"ts-pnp": "1.2.0",
"twitter": "^1.7.1",
"url-loader": "4.1.1",
"util": "^0.12.4",
"web-vitals": "^1.1.2",
"web3": "^1.6.1",
"webpack": "4.44.2",
"webpack-dev-server": "3.11.1",
"webpack-manifest-plugin": "2.2.0",
"workbox-webpack-plugin": "5.1.4"
"workbox-webpack-plugin": "5.1.4",
"ws": "^8.2.3"
},
"optionalDependencies": {
"@tensorflow/tfjs-node": "^2.8.6"