Compare commits
1777
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef5516b288 | ||
|
|
f90651c567 | ||
|
|
ec61f7d65e | ||
|
|
39283d5118 | ||
|
|
deac1094d5 | ||
|
|
9adfc76ae0 | ||
|
|
62ca592934 | ||
|
|
748ca1e8f3 | ||
|
|
66bcc3f5af | ||
|
|
5ece100083 | ||
|
|
034c2438d4 | ||
|
|
eb8c6454f2 | ||
|
|
24100041c2 | ||
|
|
665b9276fd | ||
|
|
0b3a60ea28 | ||
|
|
9149adcdf8 | ||
|
|
3a4a1f87f4 | ||
|
|
d3570c2b6a | ||
|
|
59db24aa72 | ||
|
|
038969d465 | ||
|
|
8189982eb8 | ||
|
|
150f77b2a2 | ||
|
|
0542663fdd | ||
|
|
1bcd24e442 | ||
|
|
15f5cd3db6 | ||
|
|
1262a9ba17 | ||
|
|
b1045f6509 | ||
|
|
9ca61a497e | ||
|
|
a28d1064cf | ||
|
|
b90a04890d | ||
|
|
c02de655c8 | ||
|
|
fe1b93391d | ||
|
|
19c1716fdd | ||
|
|
068deb1546 | ||
|
|
6bedd675f1 | ||
|
|
ed1814d40d | ||
|
|
5c87e80b66 | ||
|
|
d76ee9274f | ||
|
|
f7c862aedd | ||
|
|
76185a07cd | ||
|
|
fd6f5a348d | ||
|
|
857e3e467c | ||
|
|
56eb3c0744 | ||
|
|
d0cbab98b9 | ||
|
|
744e4fa2dc | ||
|
|
eeeec548cb | ||
|
|
f57ed82f48 | ||
|
|
cbc5eacb5e | ||
|
|
f2b273e583 | ||
|
|
d10fbc656f | ||
|
|
4dd998faf1 | ||
|
|
12d4a9b47f | ||
|
|
5675caacfe | ||
|
|
b79213f4ac | ||
|
|
f9672c185f | ||
|
|
fa727b5bfa | ||
|
|
19cb4810b7 | ||
|
|
376d657e51 | ||
|
|
8576542530 | ||
|
|
41ad51eef7 | ||
|
|
d110195050 | ||
|
|
572aa35afd | ||
|
|
b28b9f8b7a | ||
|
|
a446ebb1b9 | ||
|
|
b7b5fe8d99 | ||
|
|
32ef271985 | ||
|
|
2162b83bfb | ||
|
|
8ad4a30a86 | ||
|
|
3ea218e975 | ||
|
|
fc1518c9b0 | ||
|
|
1c687eb5b8 | ||
|
|
f1163c38a7 | ||
|
|
250a2c18b8 | ||
|
|
b1669fe6ba | ||
|
|
446014f8f5 | ||
|
|
f6f3fff2a5 | ||
|
|
c99377ade2 | ||
|
|
8fb9b9d44c | ||
|
|
61da7a15d6 | ||
|
|
ad60d147ac | ||
|
|
5bd6fe813e | ||
|
|
201a487dbc | ||
|
|
35c3cee2cb | ||
|
|
2dbf1cfec0 | ||
|
|
894e32bc0b | ||
|
|
790b25990c | ||
|
|
acf3d24db0 | ||
|
|
c50d4bc7ab | ||
|
|
de649b8cd8 | ||
|
|
f4ea438bae | ||
|
|
1df95b9d62 | ||
|
|
5c3ea78b6d | ||
|
|
cc1ee098b7 | ||
|
|
11d80dc892 | ||
|
|
a3bdf08e15 | ||
|
|
45e4915cd8 | ||
|
|
526f1089bf | ||
|
|
6c31d4504c | ||
|
|
248a28b468 | ||
|
|
098ab80d4b | ||
|
|
2a478c30f4 | ||
|
|
67ba8d54f8 | ||
|
|
c5e9e9c676 | ||
|
|
5c539d837c | ||
|
|
c63db868a7 | ||
|
|
7791e09445 | ||
|
|
1879116a85 | ||
|
|
afe6894a0c | ||
|
|
9479130ea0 | ||
|
|
7f2fb7ae3d | ||
|
|
7600808fd8 | ||
|
|
5eff6838a4 | ||
|
|
933e733956 | ||
|
|
73df017948 | ||
|
|
ab004c1546 | ||
|
|
e1b639bb82 | ||
|
|
9da166478d | ||
|
|
57a4c1d7e7 | ||
|
|
56c07d0c73 | ||
|
|
14a642882d | ||
|
|
43765782a1 | ||
|
|
bce933f100 | ||
|
|
7c2166ec60 | ||
|
|
d8b3864470 | ||
|
|
5c489a36dc | ||
|
|
03fb6dc9ef | ||
|
|
5c1d8315a0 | ||
|
|
abf2fb3642 | ||
|
|
bccb2f3f1b | ||
|
|
c7f5e200ba | ||
|
|
8136a6ba2b | ||
|
|
a65d699111 | ||
|
|
faa85d013c | ||
|
|
e077ab234e | ||
|
|
6587f088ef | ||
|
|
05f8e5d14f | ||
|
|
24431b1c01 | ||
|
|
d92e34adef | ||
|
|
1719c7a2da | ||
|
|
ea023c9762 | ||
|
|
5957989d42 | ||
|
|
7a5204ec80 | ||
|
|
afcedf7276 | ||
|
|
88ea2a6395 | ||
|
|
1b1ecf3039 | ||
|
|
ad0b3e7aa1 | ||
|
|
b3cbd99d04 | ||
|
|
ed9564a6f3 | ||
|
|
67366c03f5 | ||
|
|
202ae5b22b | ||
|
|
55ec1f12cd | ||
|
|
a3598d4505 | ||
|
|
71f182bece | ||
|
|
e9c7c3bf8d | ||
|
|
00833bdb73 | ||
|
|
e94586e34a | ||
|
|
a9cd0d406d | ||
|
|
a91f6f2175 | ||
|
|
b448ab5116 | ||
|
|
f1feb86c4d | ||
|
|
2fa5d3cc6d | ||
|
|
9ddb80f3b2 | ||
|
|
863f4b3dcb | ||
|
|
7862ae0b4e | ||
|
|
427f1b12ab | ||
|
|
6dc18884a0 | ||
|
|
87940d70b9 | ||
|
|
876b150957 | ||
|
|
f1811e7534 | ||
|
|
825f1b4a87 | ||
|
|
1c67ef9a8d | ||
|
|
3681076cd0 | ||
|
|
118791958c | ||
|
|
7b00368d79 | ||
|
|
67192311b7 | ||
|
|
513e9aac18 | ||
|
|
d2a39907ed | ||
|
|
4d3b2326a0 | ||
|
|
5489cfeba6 | ||
|
|
7a757c291f | ||
|
|
c10d54621d | ||
|
|
d45ddd48f4 | ||
|
|
f1aaa38c58 | ||
|
|
411367b132 | ||
|
|
990705ff3f | ||
|
|
79639ed232 | ||
|
|
e8f28a0da6 | ||
|
|
33e49785d8 | ||
|
|
2160305573 | ||
|
|
a400c12d8f | ||
|
|
cc0fe7225d | ||
|
|
cdc8b5af63 | ||
|
|
8db15fc453 | ||
|
|
0c343e59a3 | ||
|
|
14a794a51d | ||
|
|
f992d610c8 | ||
|
|
d3df87ddf5 | ||
|
|
3840d36080 | ||
|
|
2e0e39e538 | ||
|
|
3010bb93e4 | ||
|
|
6247855fdc | ||
|
|
6feaa29437 | ||
|
|
9853f99a93 | ||
|
|
cccef388bf | ||
|
|
ac674e4793 | ||
|
|
30bf25c4d7 | ||
|
|
d2a8e311d9 | ||
|
|
e22fd8eb66 | ||
|
|
266f6685d2 | ||
|
|
9494e00084 | ||
|
|
0010deb175 | ||
|
|
8f7e932f96 | ||
|
|
6c74bd46ad | ||
|
|
ea28b7fe99 | ||
|
|
772bbc3571 | ||
|
|
1d62ee1dbf | ||
|
|
cbcef6ec87 | ||
|
|
ad95b50025 | ||
|
|
c33246083d | ||
|
|
8066e86f39 | ||
|
|
23a48b7fc6 | ||
|
|
8a58ab35fa | ||
|
|
4e8144a93d | ||
|
|
59dba187c3 | ||
|
|
aadfb226b1 | ||
|
|
7b0ba12a32 | ||
|
|
c4c176b7dd | ||
|
|
6c6c0457e1 | ||
|
|
c3686f2b88 | ||
|
|
8855c46e0a | ||
|
|
815a66587c | ||
|
|
f3025ec3dd | ||
|
|
a4a73c6df8 | ||
|
|
2704727a44 | ||
|
|
0719160bdb | ||
|
|
8122afe844 | ||
|
|
7b11b012c4 | ||
|
|
10ded62205 | ||
|
|
0c415f8077 | ||
|
|
39ab51a11c | ||
|
|
a936aa77d5 | ||
|
|
9e2745d2bf | ||
|
|
0211dfa9da | ||
|
|
f901f11693 | ||
|
|
a2fface4a8 | ||
|
|
ad4d40398e | ||
|
|
eafb9d55a0 | ||
|
|
187dd25a4d | ||
|
|
b8ef393172 | ||
|
|
c550d505ec | ||
|
|
617518c620 | ||
|
|
42d103b18d | ||
|
|
39c25ae192 | ||
|
|
1e2226512f | ||
|
|
8a76208a7f | ||
|
|
855693d108 | ||
|
|
a4af307c07 | ||
|
|
cb4a021ad7 | ||
|
|
d18c54c154 | ||
|
|
292d041f7f | ||
|
|
d38b049e43 | ||
|
|
248585ccd2 | ||
|
|
e0cf71c063 | ||
|
|
2675cbc598 | ||
|
|
eb466e97ab | ||
|
|
9f0c39a530 | ||
|
|
fbaf1b2fba | ||
|
|
8524cc9662 | ||
|
|
11dcc683cd | ||
|
|
da8f4c7af7 | ||
|
|
0d0359ce6f | ||
|
|
a219911a83 | ||
|
|
1e7d1dfec4 | ||
|
|
f6ceae0a7f | ||
|
|
5675ed0af0 | ||
|
|
2bb4c6c882 | ||
|
|
70f9a422e3 | ||
|
|
747ba72818 | ||
|
|
b8760cdcda | ||
|
|
50acdf9e2f | ||
|
|
7f0bab3530 | ||
|
|
71dfcde019 | ||
|
|
9e3a236ded | ||
|
|
94fc19c6d8 | ||
|
|
09deffd10e | ||
|
|
4733dfe959 | ||
|
|
57a82d82bd | ||
|
|
29ab2034e2 | ||
|
|
a5fa2073e6 | ||
|
|
01d7dda17a | ||
|
|
997371ba7f | ||
|
|
aa3eb1b1a1 | ||
|
|
0511c17643 | ||
|
|
afba87ca38 | ||
|
|
2439ffdb03 | ||
|
|
f348b8f7ba | ||
|
|
a6bdfa719e | ||
|
|
5fee7651de | ||
|
|
91512fc6c3 | ||
|
|
e5412ae1f0 | ||
|
|
80f8ffc81f | ||
|
|
8a541f34a7 | ||
|
|
bd55610ed4 | ||
|
|
c208df6979 | ||
|
|
403b4df77e | ||
|
|
e22b2076c8 | ||
|
|
c5086b6ff8 | ||
|
|
f8329e22ad | ||
|
|
54efdf93a9 | ||
|
|
56aec8bc45 | ||
|
|
a00b38fd01 | ||
|
|
47256b0f23 | ||
|
|
f28744c322 | ||
|
|
c1b9093d60 | ||
|
|
bbc3846975 | ||
|
|
11db10be4e | ||
|
|
3a02828758 | ||
|
|
d912c35616 | ||
|
|
49e0eecfda | ||
|
|
5d2ccbe959 | ||
|
|
7c2eed5496 | ||
|
|
77784fd955 | ||
|
|
5350f727ea | ||
|
|
c203040f3a | ||
|
|
9f2102e0e6 | ||
|
|
2aeab5fb4d | ||
|
|
3dacf39b67 | ||
|
|
bb3cf36253 | ||
|
|
26c71b82e6 | ||
|
|
b8d265f829 | ||
|
|
c6fe7bca70 | ||
|
|
b70604783b | ||
|
|
d067e5ea7f | ||
|
|
ff950b235f | ||
|
|
0f9fdda3ac | ||
|
|
32a986cc13 | ||
|
|
ab6ba2ae12 | ||
|
|
c3a203b8bb | ||
|
|
e3c910f2fc | ||
|
|
201ad526e2 | ||
|
|
592310c8ea | ||
|
|
159ce2a9de | ||
|
|
2d2a5b0447 | ||
|
|
7e86e6872c | ||
|
|
35ec33c772 | ||
|
|
6e17cab565 | ||
|
|
efc62fb167 | ||
|
|
e9d2303c57 | ||
|
|
8b285a1556 | ||
|
|
09c80b8df7 | ||
|
|
b1c54b4e1d | ||
|
|
cf24f96958 | ||
|
|
f81bd823ea | ||
|
|
a943d30fa3 | ||
|
|
0d11a0a74a | ||
|
|
adde2326ba | ||
|
|
d7dcf8020a | ||
|
|
6ec05a60bc | ||
|
|
b7434234ba | ||
|
|
be116cd92e | ||
|
|
9f8a62bd83 | ||
|
|
b6b475220c | ||
|
|
3977cfa33a | ||
|
|
2022326b5d | ||
|
|
1cd150224f | ||
|
|
9318d631f5 | ||
|
|
8179b83513 | ||
|
|
dade953a4c | ||
|
|
7410879cee | ||
|
|
aba8262dc1 | ||
|
|
babf0f3c9c | ||
|
|
824843f70f | ||
|
|
1c4e04fc19 | ||
|
|
32e430b7cf | ||
|
|
92752916f5 | ||
|
|
2c2e920c42 | ||
|
|
3ae1908c64 | ||
|
|
e898a3235a | ||
|
|
b8da4782e4 | ||
|
|
f8a005e8b8 | ||
|
|
5ffca71677 | ||
|
|
f65c149221 | ||
|
|
bba9ac16fb | ||
|
|
d0dc27347d | ||
|
|
a4918be425 | ||
|
|
9ea175af72 | ||
|
|
11c9085a6f | ||
|
|
04082339fc | ||
|
|
7e22bb3c78 | ||
|
|
0046c19e3e | ||
|
|
81a4f7cb82 | ||
|
|
38fa40506c | ||
|
|
cdf448b0ce | ||
|
|
5baf2fc840 | ||
|
|
76903714c2 | ||
|
|
7c12d24ae3 | ||
|
|
d228440ca3 | ||
|
|
4b193934b3 | ||
|
|
db57fd167f | ||
|
|
8bced0cfd3 | ||
|
|
4ab65e9347 | ||
|
|
72128b3830 | ||
|
|
3adea8ad3b | ||
|
|
77859b2ad2 | ||
|
|
ac7c4d9136 | ||
|
|
b186d22635 | ||
|
|
f30faf1eac | ||
|
|
7b5ab47845 | ||
|
|
9792a271e2 | ||
|
|
10ddfc5223 | ||
|
|
6532071a5f | ||
|
|
badf17ad72 | ||
|
|
e244e69acc | ||
|
|
1a115ffe70 | ||
|
|
bf10611862 | ||
|
|
4b91133703 | ||
|
|
c7391fae8b | ||
|
|
84975a2356 | ||
|
|
dfe6343f78 | ||
|
|
cf547534b7 | ||
|
|
bea6b06f2e | ||
|
|
a3a821c56b | ||
|
|
2d9c730189 | ||
|
|
65f065bb72 | ||
|
|
ce1e264e9f | ||
|
|
d581179af0 | ||
|
|
cfb583a378 | ||
|
|
c725360a5c | ||
|
|
782712eb97 | ||
|
|
eeb40cd1f1 | ||
|
|
50a2390696 | ||
|
|
d78c19d927 | ||
|
|
29e67f9a63 | ||
|
|
d002296c6f | ||
|
|
33f6bf2308 | ||
|
|
599634ebeb | ||
|
|
b15a2b216d | ||
|
|
f499be28cc | ||
|
|
65e725289f | ||
|
|
abbfb315b7 | ||
|
|
d3c026c322 | ||
|
|
bc4ce985fc | ||
|
|
64942f2427 | ||
|
|
eaf51dbd72 | ||
|
|
87794cff6c | ||
|
|
26db84d6e2 | ||
|
|
14929fc682 | ||
|
|
84e4627f82 | ||
|
|
a07cfe6a39 | ||
|
|
7d3370ffea | ||
|
|
5635bb1343 | ||
|
|
c0e55e3f28 | ||
|
|
21cc3f7cbd | ||
|
|
6ed55c361e | ||
|
|
6f33a1edae | ||
|
|
44f346f208 | ||
|
|
eee3b116b4 | ||
|
|
f3d911e553 | ||
|
|
7623228101 | ||
|
|
01c730c187 | ||
|
|
a86b2f6c84 | ||
|
|
a7b90592d4 | ||
|
|
dc93cd731c | ||
|
|
7c41beeb81 | ||
|
|
c26e702576 | ||
|
|
a0cfb7848b | ||
|
|
37b1a50b57 | ||
|
|
72dc5e892d | ||
|
|
e1e2833947 | ||
|
|
52d8b7c631 | ||
|
|
2efa45eb29 | ||
|
|
95dd39cf87 | ||
|
|
4f4acd686d | ||
|
|
b2e510c5ba | ||
|
|
817b1d8afa | ||
|
|
b0950f0da1 | ||
|
|
1d7245bdeb | ||
|
|
b23b489424 | ||
|
|
ecf9da582a | ||
|
|
67355c875d | ||
|
|
391c4720e3 | ||
|
|
912ec7b333 | ||
|
|
268c3f102e | ||
|
|
1d9bab14ce | ||
|
|
d8114f2386 | ||
|
|
979bcd2169 | ||
|
|
844c6e9482 | ||
|
|
647c9dc195 | ||
|
|
7b4eb04a50 | ||
|
|
88edca1a4e | ||
|
|
adcb984da3 | ||
|
|
df394d8404 | ||
|
|
3e2e454530 | ||
|
|
084d708832 | ||
|
|
7d6d779353 | ||
|
|
dff8824b1a | ||
|
|
276d26d5c1 | ||
|
|
a907a11252 | ||
|
|
3a79d2fb55 | ||
|
|
3380b37e56 | ||
|
|
6a3e7bea73 | ||
|
|
aef76f529f | ||
|
|
1ff20dae7f | ||
|
|
b421d81ba1 | ||
|
|
6b1b973ecc | ||
|
|
c2c43a6a07 | ||
|
|
e8bc44c86e | ||
|
|
eccbcbd7d1 | ||
|
|
9da7b7bcb7 | ||
|
|
def769b7c6 | ||
|
|
095dc5f462 | ||
|
|
7fee1bf4df | ||
|
|
1837bee95c | ||
|
|
d81417e847 | ||
|
|
7a1afa8a9a | ||
|
|
c1eaec74b7 | ||
|
|
485b3a43fe | ||
|
|
1b10d262ee | ||
|
|
960264cc32 | ||
|
|
0eb13a0164 | ||
|
|
532c0201e8 | ||
|
|
f8a4d3423d | ||
|
|
b57e0371a9 | ||
|
|
a9641e3f54 | ||
|
|
99dd678173 | ||
|
|
680ee2233d | ||
|
|
8107ab4f42 | ||
|
|
fd48fc006c | ||
|
|
e213eb3647 | ||
|
|
8b86e4b409 | ||
|
|
75faf05129 | ||
|
|
f142fec0c1 | ||
|
|
f397e323c2 | ||
|
|
e1eb98135a | ||
|
|
3ea96fec6f | ||
|
|
4251c2b24b | ||
|
|
27c7c8ea0b | ||
|
|
bcbe230f68 | ||
|
|
50989e9e4a | ||
|
|
00c47b2065 | ||
|
|
40772b09af | ||
|
|
216dbbc7d2 | ||
|
|
bd9fa1d162 | ||
|
|
8d7b63e885 | ||
|
|
23e229a61e | ||
|
|
45fd7e4479 | ||
|
|
af35bf32e0 | ||
|
|
180a0ff84e | ||
|
|
5cfda766a8 | ||
|
|
7481654408 | ||
|
|
65f537e7ac | ||
|
|
59d6a9ea42 | ||
|
|
f31827dd25 | ||
|
|
96cd514026 | ||
|
|
8cfea3e486 | ||
|
|
ef01b2b56c | ||
|
|
0b0360b72e | ||
|
|
03b1049241 | ||
|
|
c2934076f7 | ||
|
|
8870c95a08 | ||
|
|
d02ee2d8da | ||
|
|
7dab358863 | ||
|
|
e8809618d5 | ||
|
|
86629256ca | ||
|
|
73cbb6ecaf | ||
|
|
0bc3aa9965 | ||
|
|
7e2d6f0f8e | ||
|
|
833ae00ece | ||
|
|
1b86b2e3b1 | ||
|
|
31a95ca976 | ||
|
|
ce70fa69ac | ||
|
|
1dc087ea65 | ||
|
|
01bc9ccba2 | ||
|
|
0cbc38eb4c | ||
|
|
0f442aae54 | ||
|
|
9620a7a78b | ||
|
|
9cacfb0cfe | ||
|
|
80920eabb3 | ||
|
|
815c642304 | ||
|
|
8f2800d607 | ||
|
|
2b10dfe591 | ||
|
|
7bc5b892b9 | ||
|
|
03a1afd4d9 | ||
|
|
39443539fc | ||
|
|
e0c0bdd3f3 | ||
|
|
6bf9aaf884 | ||
|
|
0a9361f59e | ||
|
|
a0e0090afd | ||
|
|
b5f555cbe4 | ||
|
|
94c45f2bdd | ||
|
|
b1670380ee | ||
|
|
83bb2edec4 | ||
|
|
8716812610 | ||
|
|
3345eff347 | ||
|
|
5712193f72 | ||
|
|
9c67b79e44 | ||
|
|
8abdeed5a2 | ||
|
|
1326aed521 | ||
|
|
5c9597950b | ||
|
|
a3081bcf4c | ||
|
|
e6f7afd9b9 | ||
|
|
1f550b8939 | ||
|
|
e9d84c1c5d | ||
|
|
f3c35790f4 | ||
|
|
6d8919eecd | ||
|
|
94d9ddde75 | ||
|
|
d0379fd317 | ||
|
|
e1e5f65c03 | ||
|
|
9c1eee37cf | ||
|
|
dd216e93b7 | ||
|
|
779a6cc7bf | ||
|
|
29f7802cbe | ||
|
|
800d06ecc9 | ||
|
|
7edd92e26a | ||
|
|
242e9ee1ab | ||
|
|
b6128a6862 | ||
|
|
562f2670c3 | ||
|
|
c13f02a74c | ||
|
|
16055b41f6 | ||
|
|
184a66886e | ||
|
|
aea77ea0f7 | ||
|
|
e96ca81063 | ||
|
|
ed8cb75cc5 | ||
|
|
c4e14829bb | ||
|
|
83ef4815d0 | ||
|
|
7d7be12a48 | ||
|
|
b2965fa4a4 | ||
|
|
c1507c7fbe | ||
|
|
a5d85d523a | ||
|
|
4055b4c2d8 | ||
|
|
dd27f0d1ad | ||
|
|
be55e3f745 | ||
|
|
88005f2745 | ||
|
|
268270c733 | ||
|
|
f6ff35aa7b | ||
|
|
477f5c6d85 | ||
|
|
a9cfa38d06 | ||
|
|
6680d4495c | ||
|
|
1fb1b4edc1 | ||
|
|
cc350aae23 | ||
|
|
c5c76094f5 | ||
|
|
ec8d8ceacc | ||
|
|
d396b099ec | ||
|
|
e99bc425fd | ||
|
|
ed643887f9 | ||
|
|
d2a65ed71b | ||
|
|
36f5895985 | ||
|
|
2b5406e378 | ||
|
|
fd6cab202f | ||
|
|
f65189c964 | ||
|
|
905892065c | ||
|
|
3cdac9f5e3 | ||
|
|
cf5d686ca3 | ||
|
|
22fa93b002 | ||
|
|
5333d90140 | ||
|
|
a4e7d79d57 | ||
|
|
083a1f86a7 | ||
|
|
8c7f2325b2 | ||
|
|
b3f4444446 | ||
|
|
8e61bccbba | ||
|
|
70df26a046 | ||
|
|
d8bfe85888 | ||
|
|
4cc4c9d043 | ||
|
|
b016173231 | ||
|
|
38b88a589b | ||
|
|
fd7f970304 | ||
|
|
7c078b286f | ||
|
|
a7a338bf26 | ||
|
|
ce33c03bf8 | ||
|
|
24a80a903a | ||
|
|
087e86692f | ||
|
|
9ad1e92844 | ||
|
|
a8d2a8f837 | ||
|
|
b46c637e75 | ||
|
|
2a8fe5d39b | ||
|
|
05d77ba9aa | ||
|
|
a8bf27b54d | ||
|
|
070adb88e7 | ||
|
|
e0c1b7ab6b | ||
|
|
dbdb7cb16f | ||
|
|
d0064c3cf4 | ||
|
|
7fa38555d0 | ||
|
|
938aeadde8 | ||
|
|
4521a8564a | ||
|
|
f00333cc68 | ||
|
|
7cc7c94621 | ||
|
|
a23e505f7a | ||
|
|
eb54b91226 | ||
|
|
e421fd9eea | ||
|
|
36744390b8 | ||
|
|
fb42aafdef | ||
|
|
a9570d699b | ||
|
|
30d82d7d5b | ||
|
|
7a1b1f7ff0 | ||
|
|
c7cebb4f0e | ||
|
|
92b6d04051 | ||
|
|
fe1432facb | ||
|
|
c34463e63a | ||
|
|
6e36a600eb | ||
|
|
32496a9059 | ||
|
|
834718ac1b | ||
|
|
137c53f561 | ||
|
|
cbaddf7c02 | ||
|
|
2ef414d982 | ||
|
|
b857b3167d | ||
|
|
9455b2d907 | ||
|
|
f0b8d8850e | ||
|
|
aa885cab4c | ||
|
|
e4c336a120 | ||
|
|
430d7d6818 | ||
|
|
b894c69ee5 | ||
|
|
a2273e6878 | ||
|
|
de1503c2a8 | ||
|
|
5e50d7dd3d | ||
|
|
35bec1d96e | ||
|
|
cba90c8a0e | ||
|
|
a6e0cd3784 | ||
|
|
f844b3b64a | ||
|
|
a911d87849 | ||
|
|
1da9947f29 | ||
|
|
09c5bba03b | ||
|
|
c3374a69bd | ||
|
|
49b6b46082 | ||
|
|
52b28cb4e3 | ||
|
|
e7697e9c28 | ||
|
|
b44c834e98 | ||
|
|
2adb627c75 | ||
|
|
45cde78438 | ||
|
|
d1e5b32b06 | ||
|
|
87b359789b | ||
|
|
ab10c29972 | ||
|
|
dfd4e4d54d | ||
|
|
cbc8b73ef4 | ||
|
|
7669a4db3c | ||
|
|
87d6fc2581 | ||
|
|
621f1a20af | ||
|
|
22810c71aa | ||
|
|
8f923fbe4c | ||
|
|
bf8bcaab3a | ||
|
|
f9692944c3 | ||
|
|
3b7e405780 | ||
|
|
404f7912a6 | ||
|
|
9f3c91cc54 | ||
|
|
7e05489c8f | ||
|
|
1588d42088 | ||
|
|
fb7b43a30c | ||
|
|
f358d52f84 | ||
|
|
2a59cebe63 | ||
|
|
9ad99f7e6e | ||
|
|
816e9bf60f | ||
|
|
d08d9cc3b4 | ||
|
|
72f1bc6a8a | ||
|
|
ecc95c0b5b | ||
|
|
adcdf352f5 | ||
|
|
30c278b4c9 | ||
|
|
e632314360 | ||
|
|
be79ab80a0 | ||
|
|
8aaf00152e | ||
|
|
9a2dcff440 | ||
|
|
781e225025 | ||
|
|
06de4734f7 | ||
|
|
93736fdb62 | ||
|
|
f44a21dd5e | ||
|
|
7e49d8422a | ||
|
|
46aaad9387 | ||
|
|
43dcf7781e | ||
|
|
f6a266366b | ||
|
|
6cc519052c | ||
|
|
b1224f842c | ||
|
|
2b9c2dbd0e | ||
|
|
cb0720f670 | ||
|
|
c53a5df2d4 | ||
|
|
df5f0fda7a | ||
|
|
a8d442e819 | ||
|
|
273ee1745a | ||
|
|
a0277a5537 | ||
|
|
e0eefb0062 | ||
|
|
6118e21160 | ||
|
|
5f3c700834 | ||
|
|
d1ef0801a2 | ||
|
|
c3c4b384e9 | ||
|
|
c2ef41ae47 | ||
|
|
fd2ae34e2d | ||
|
|
10f01fac32 | ||
|
|
e19acec44f | ||
|
|
84073e86d8 | ||
|
|
92dee735e9 | ||
|
|
7a9112ea44 | ||
|
|
6306453ffe | ||
|
|
0898e16285 | ||
|
|
96cb7c9d6f | ||
|
|
1a3def6708 | ||
|
|
1705961d68 | ||
|
|
fc63d08b50 | ||
|
|
30ac9e5560 | ||
|
|
79004f352e | ||
|
|
4d5690bcd6 | ||
|
|
0f5520060a | ||
|
|
ce60ddced7 | ||
|
|
5e32ecfc58 | ||
|
|
afc5c770ae | ||
|
|
b14c3dacb8 | ||
|
|
a71aedd5af | ||
|
|
72c54793d1 | ||
|
|
4c5dfb56ba | ||
|
|
039be451d4 | ||
|
|
aac28af72f | ||
|
|
54fe3cf870 | ||
|
|
69d5a06066 | ||
|
|
5bbbefc026 | ||
|
|
58e20a44cf | ||
|
|
18db4519f8 | ||
|
|
7ed06a5dac | ||
|
|
1cd43c5356 | ||
|
|
b8e45d06f3 | ||
|
|
fa7044f036 | ||
|
|
f2535976d7 | ||
|
|
41d43b79d2 | ||
|
|
29363e35df | ||
|
|
388f7a6c2a | ||
|
|
688b75434d | ||
|
|
f529fbfcd5 | ||
|
|
f9e736472e | ||
|
|
18e6049878 | ||
|
|
cdbf14c392 | ||
|
|
0dea4d6762 | ||
|
|
c841c2c6bc | ||
|
|
f78866da48 | ||
|
|
e5af65a1aa | ||
|
|
fd51af9c33 | ||
|
|
eae56944b9 | ||
|
|
e37ad93b49 | ||
|
|
55516b32ca | ||
|
|
67babe0819 | ||
|
|
fc02d648f2 | ||
|
|
7ff1073be8 | ||
|
|
5ff772ef38 | ||
|
|
8a53f6b54c | ||
|
|
76dfeeb6a2 | ||
|
|
7b6170ba2e | ||
|
|
748bbd5624 | ||
|
|
14db83c833 | ||
|
|
6704ae5da4 | ||
|
|
92ac87b93d | ||
|
|
80ee398f89 | ||
|
|
88c0f2c7d6 | ||
|
|
f57dc3f4cb | ||
|
|
de0bd26466 | ||
|
|
deed317053 | ||
|
|
81aa44c545 | ||
|
|
39c6366b6a | ||
|
|
5ad53267d2 | ||
|
|
23f13fa0c3 | ||
|
|
b619a9210d | ||
|
|
fba0592c95 | ||
|
|
d569f83bcb | ||
|
|
9bbabb14ca | ||
|
|
267f75aa9e | ||
|
|
20cbf04596 | ||
|
|
f3dc04a9a0 | ||
|
|
2553c8df8d | ||
|
|
b3d366c000 | ||
|
|
67886ead73 | ||
|
|
c4f775b684 | ||
|
|
1bc5e34c9d | ||
|
|
9469f4293c | ||
|
|
bca6192327 | ||
|
|
bafd07ab9d | ||
|
|
d4fb3db23c | ||
|
|
8dae007be1 | ||
|
|
0723ec0573 | ||
|
|
eb2d58a689 | ||
|
|
f7c5b27ede | ||
|
|
f2e0ec2aa6 | ||
|
|
5e8e4f5f73 | ||
|
|
46d7472ac8 | ||
|
|
5b1b1b9b35 | ||
|
|
281beba0be | ||
|
|
0169214b3f | ||
|
|
23b774109a | ||
|
|
dd80c80b14 | ||
|
|
4799d41466 | ||
|
|
20aff4f54e | ||
|
|
6b74b9cbb2 | ||
|
|
45aa5f3dca | ||
|
|
d632491d65 | ||
|
|
d8c12c04d9 | ||
|
|
9c28aee88b | ||
|
|
9c92080d79 | ||
|
|
423a36c1b0 | ||
|
|
069e9ade9a | ||
|
|
478cb082c8 | ||
|
|
6444d222f2 | ||
|
|
1f4fee8904 | ||
|
|
cd44cc0d72 | ||
|
|
2f889aa341 | ||
|
|
b259db992e | ||
|
|
2aedf8d408 | ||
|
|
f00d0fe567 | ||
|
|
ae7eaad7ba | ||
|
|
3b2c62b4e4 | ||
|
|
eb4e78283e | ||
|
|
aac19ed53e | ||
|
|
cc97a654b9 | ||
|
|
3294832c39 | ||
|
|
5380122b7f | ||
|
|
7d9971a1a6 | ||
|
|
956460df10 | ||
|
|
01b79c9dee | ||
|
|
4d3dc3c1fc | ||
|
|
517cc26446 | ||
|
|
1b38361935 | ||
|
|
86259f9ed1 | ||
|
|
58309116b9 | ||
|
|
99f76678f7 | ||
|
|
dd20afb9e8 | ||
|
|
025792fe42 | ||
|
|
48ebaeb925 | ||
|
|
db6b6603af | ||
|
|
c187c276df | ||
|
|
3405818181 | ||
|
|
eca6a9bf47 | ||
|
|
23c1b17e2d | ||
|
|
d3bf069fd6 | ||
|
|
ee0872a472 | ||
|
|
f6e7dc0217 | ||
|
|
5d4ecbb691 | ||
|
|
96a6206c59 | ||
|
|
be6289fe22 | ||
|
|
c6e19cdf2a | ||
|
|
8f79f39723 | ||
|
|
780fce04ff | ||
|
|
780f975e7c | ||
|
|
d3f1ade376 | ||
|
|
588a3c95ea | ||
|
|
8f3f877810 | ||
|
|
c1dfd1b169 | ||
|
|
4469ee99c7 | ||
|
|
baf64da77c | ||
|
|
80b6d27611 | ||
|
|
08d30ca390 | ||
|
|
7adf7f7181 | ||
|
|
87b05e5ecd | ||
|
|
4033f4019f | ||
|
|
73823b4152 | ||
|
|
f725a977de | ||
|
|
424df55bcd | ||
|
|
1e5df05b2c | ||
|
|
18685d49dd | ||
|
|
b6197de956 | ||
|
|
d42b59dfa2 | ||
|
|
2df3a569b4 | ||
|
|
0d7fe35928 | ||
|
|
5e2e370c41 | ||
|
|
cd40e8ec48 | ||
|
|
103746b007 | ||
|
|
6bf508fc34 | ||
|
|
13dfe99d7c | ||
|
|
7c44fc3761 | ||
|
|
eb741cd9d3 | ||
|
|
8786c87f5e | ||
|
|
142942838b | ||
|
|
a9a33ae930 | ||
|
|
363e225a87 | ||
|
|
38036af25d | ||
|
|
04c5010e86 | ||
|
|
acf9d47467 | ||
|
|
ed0c83dbb2 | ||
|
|
9cf1ede9f2 | ||
|
|
80c93c226c | ||
|
|
39540f6850 | ||
|
|
6885c2ded8 | ||
|
|
1a4bae9e86 | ||
|
|
fb7f26ba6a | ||
|
|
c1fe2e975d | ||
|
|
37587029d2 | ||
|
|
c0c2f10228 | ||
|
|
1b04aa32e7 | ||
|
|
8e379fe853 | ||
|
|
c5279aa348 | ||
|
|
5a3d40169c | ||
|
|
9afff7174d | ||
|
|
f789e2d578 | ||
|
|
3d10ecf3f2 | ||
|
|
84f2988560 | ||
|
|
168cb749ee | ||
|
|
e24d57dded | ||
|
|
db4ad1b0e4 | ||
|
|
87d2252c43 | ||
|
|
2fbcd3fa57 | ||
|
|
9d2acc5a58 | ||
|
|
060418e4d6 | ||
|
|
59f0202485 | ||
|
|
1ec3f656a0 | ||
|
|
03b2b1ffda | ||
|
|
f27034652e | ||
|
|
ed2f8c7497 | ||
|
|
255315dd64 | ||
|
|
2dae62dbc2 | ||
|
|
0bf9caf2c1 | ||
|
|
7018e43f5e | ||
|
|
7c552f55a1 | ||
|
|
4a34245410 | ||
|
|
44dfb12195 | ||
|
|
08a56a6026 | ||
|
|
2905730db6 | ||
|
|
540f18cd69 | ||
|
|
c6748a8466 | ||
|
|
b3d9a3cc80 | ||
|
|
0fd12e1f1a | ||
|
|
259396c205 | ||
|
|
e98fb2063a | ||
|
|
89fdec328f | ||
|
|
59b4703152 | ||
|
|
03d177f7a7 | ||
|
|
816720f80f | ||
|
|
507d17aa69 | ||
|
|
4eb903b908 | ||
|
|
4e46b8c6b7 | ||
|
|
fc477d4f88 | ||
|
|
cd5029aaa0 | ||
|
|
e288edbfa9 | ||
|
|
f4faf0959e | ||
|
|
1cd52b8ed1 | ||
|
|
b71fd5282b | ||
|
|
28da06e485 | ||
|
|
52f15ce37c | ||
|
|
0755e4dc34 | ||
|
|
c445691bc9 | ||
|
|
489a6ed7a2 | ||
|
|
7aa52e4ff3 | ||
|
|
2697689c3c | ||
|
|
9941896c4e | ||
|
|
ba94eba05d | ||
|
|
557817ff91 | ||
|
|
a840c2034a | ||
|
|
823c920baf | ||
|
|
99b8734417 | ||
|
|
fed1b8d0ec | ||
|
|
fc3419e2c1 | ||
|
|
e43f3aac01 | ||
|
|
833691a2b7 | ||
|
|
7e4484f0b0 | ||
|
|
62a41aeb31 | ||
|
|
0ebed3095f | ||
|
|
5b2ef4ab31 | ||
|
|
0c8dae7f37 | ||
|
|
629e6b6cff | ||
|
|
2f7b1bcb4b | ||
|
|
65358f6404 | ||
|
|
76c191c7a8 | ||
|
|
894ccc72db | ||
|
|
ca39237d97 | ||
|
|
947a74d07e | ||
|
|
ed903a2f99 | ||
|
|
a2ae601e2e | ||
|
|
9a9ea8e338 | ||
|
|
4f1c4f179f | ||
|
|
2fc59ea595 | ||
|
|
8037ccf3c0 | ||
|
|
79d7ebad58 | ||
|
|
cd5e89bedc | ||
|
|
c4f5db9bb1 | ||
|
|
e89d345e85 | ||
|
|
f9de125bfd | ||
|
|
5001fbc474 | ||
|
|
cc75c7d630 | ||
|
|
93dee2d28c | ||
|
|
65d535ef2d | ||
|
|
b782cf277d | ||
|
|
0ebf4a7dbd | ||
|
|
22d4ad532d | ||
|
|
316dd6da66 | ||
|
|
1104a07808 | ||
|
|
b68454a392 | ||
|
|
8adee4168c | ||
|
|
99cf71878e | ||
|
|
a0bc67c316 | ||
|
|
ebbe3d78de | ||
|
|
97d9753621 | ||
|
|
11ee1f585e | ||
|
|
4a29bcc10d | ||
|
|
c14ce4f5f5 | ||
|
|
baa71182ee | ||
|
|
3ebcbfea24 | ||
|
|
8e34abfadc | ||
|
|
ea4d9eba29 | ||
|
|
5ee9a9858a | ||
|
|
ed2c96e039 | ||
|
|
4cb5d8b3bd | ||
|
|
73c5ffb99b | ||
|
|
2f8f1451c6 | ||
|
|
d2bdea6f0c | ||
|
|
0d157bb98e | ||
|
|
275af0cf0c | ||
|
|
59306ebb87 | ||
|
|
38c1d5c0fc | ||
|
|
8ce9b412f1 | ||
|
|
e9289a6b95 | ||
|
|
c37469f75b | ||
|
|
877432808b | ||
|
|
060770a409 | ||
|
|
272c3cf04b | ||
|
|
ada83e4c2c | ||
|
|
2547cab9fb | ||
|
|
e172dbf4f4 | ||
|
|
d03c4f00d2 | ||
|
|
2bd15150e3 | ||
|
|
2023fdd03a | ||
|
|
7b91d9d22c | ||
|
|
83141a61b3 | ||
|
|
52706719e6 | ||
|
|
e1c7ae5394 | ||
|
|
136c0a4deb | ||
|
|
14f386cf86 | ||
|
|
7c13b51b7f | ||
|
|
c7e457e357 | ||
|
|
69f6c6c5f3 | ||
|
|
92c5a7e7e9 | ||
|
|
0a9b1c9d48 | ||
|
|
c47033adc5 | ||
|
|
35c54b0186 | ||
|
|
0fe01e6371 | ||
|
|
6f40d41db9 | ||
|
|
85a218936f | ||
|
|
df79a409eb | ||
|
|
b07f3b8566 | ||
|
|
97ff78d359 | ||
|
|
21d59c2395 | ||
|
|
21c95922e0 | ||
|
|
97ceb9f785 | ||
|
|
5a390a3c03 | ||
|
|
ea78609f7c | ||
|
|
7e7849fd24 | ||
|
|
c3715d7126 | ||
|
|
71946bc5d5 | ||
|
|
15ede2f4f4 | ||
|
|
14ccd705c4 | ||
|
|
0fefcabb17 | ||
|
|
516535b8e4 | ||
|
|
b6a92cda57 | ||
|
|
68be25a50f | ||
|
|
4e7d6f5203 | ||
|
|
20f90952a3 | ||
|
|
0fc0ec71dc | ||
|
|
e6b4445fef | ||
|
|
dfc045f2cf | ||
|
|
fcc5a8b39f | ||
|
|
884ff3cbbb | ||
|
|
c007d3f7ae | ||
|
|
a8fde78b50 | ||
|
|
51ad32b29a | ||
|
|
f04d9c5c5f | ||
|
|
c42ee1e41e | ||
|
|
1a48645f68 | ||
|
|
06edcd1e91 | ||
|
|
bad1f28883 | ||
|
|
36e78ad75c | ||
|
|
1706874099 | ||
|
|
c0c03753a8 | ||
|
|
53948cddb5 | ||
|
|
41d42e07a0 | ||
|
|
ae6030e9a3 | ||
|
|
c03dba4e02 | ||
|
|
2a81376c19 | ||
|
|
ac182bfe3d | ||
|
|
d07b836ffa | ||
|
|
7467ce8ee9 | ||
|
|
889a796798 | ||
|
|
daeb3920ac | ||
|
|
35df064af9 | ||
|
|
f3ede68928 | ||
|
|
58d88ac334 | ||
|
|
9f6663b1df | ||
|
|
614c093a54 | ||
|
|
1658b3ed82 | ||
|
|
0561d75b9b | ||
|
|
0887739d86 | ||
|
|
62f43dcf16 | ||
|
|
b1684361ff | ||
|
|
15727ff6d1 | ||
|
|
7baee2c619 | ||
|
|
81b23b3495 | ||
|
|
e79d26d0c1 | ||
|
|
8031da44be | ||
|
|
fb08ae6349 | ||
|
|
0595f1b06f | ||
|
|
bb903b8eb4 | ||
|
|
046a369ce4 | ||
|
|
d12ab41b47 | ||
|
|
cc2c16ba09 | ||
|
|
2c98c8538d | ||
|
|
db0e91ac02 | ||
|
|
664af207a1 | ||
|
|
e34f44a620 | ||
|
|
bc7a931bd0 | ||
|
|
bb2055dcf4 | ||
|
|
ebcd818219 | ||
|
|
26cc412855 | ||
|
|
90377568ac | ||
|
|
e969cb0047 | ||
|
|
91075420d7 | ||
|
|
978c6be82c | ||
|
|
3fe8a46a3b | ||
|
|
774eb62910 | ||
|
|
b92545269c | ||
|
|
10c98dcfe8 | ||
|
|
2ff3559baf | ||
|
|
42877ad754 | ||
|
|
f3bc0cdda8 | ||
|
|
00ce521972 | ||
|
|
7bc3b0ec28 | ||
|
|
5a0136a1c0 | ||
|
|
563e648079 | ||
|
|
357e9a04bc | ||
|
|
8ac96096ac | ||
|
|
f10f7166cf | ||
|
|
04daf0ff69 | ||
|
|
3442442017 | ||
|
|
32dd328112 | ||
|
|
61ec81e092 | ||
|
|
55f49ff6ca | ||
|
|
fa4ff8efa7 | ||
|
|
9f1b16e89b | ||
|
|
32b3763f9b | ||
|
|
0ca0d721c2 | ||
|
|
9da15a66bf | ||
|
|
a1ee5a2478 | ||
|
|
0d4dfbd20d | ||
|
|
23ca4b5c1e | ||
|
|
777f5e8309 | ||
|
|
cee247e02e | ||
|
|
5c08e5b0e9 | ||
|
|
b81f39edc3 | ||
|
|
1669e7950e | ||
|
|
13abba6213 | ||
|
|
e8694bdf98 | ||
|
|
e4ae20e1be | ||
|
|
c1729dbdac | ||
|
|
a17a0ed878 | ||
|
|
928e611b85 | ||
|
|
b97db15d8f | ||
|
|
7632d6dc3f | ||
|
|
9bdea96052 | ||
|
|
2a49b03d70 | ||
|
|
ae479e3853 | ||
|
|
9cac93eb63 | ||
|
|
c3a8040402 | ||
|
|
c54a50b834 | ||
|
|
05fd1554c5 | ||
|
|
9826831dfc | ||
|
|
345482b55e | ||
|
|
6d01f36594 | ||
|
|
ad66b76795 | ||
|
|
d8ac177e84 | ||
|
|
4b39bc5ce2 | ||
|
|
07212fa93d | ||
|
|
4b81270699 | ||
|
|
f56005ba70 | ||
|
|
cd77780f28 | ||
|
|
a7529a6dbc | ||
|
|
91debac36f | ||
|
|
ed98835903 | ||
|
|
523c95ee21 | ||
|
|
4e4d6b8fc4 | ||
|
|
438cff2028 | ||
|
|
85d8991bc2 | ||
|
|
f640cdcc12 | ||
|
|
1b4a0d0ab1 | ||
|
|
5cfac99354 | ||
|
|
6870bbb18f | ||
|
|
21112e05e9 | ||
|
|
f3cff4a4de | ||
|
|
f0fd1f4ee7 | ||
|
|
70c72ad7dc | ||
|
|
a47de0fd1e | ||
|
|
75700877a6 | ||
|
|
434db6a138 | ||
|
|
15d06e05df | ||
|
|
f619641f26 | ||
|
|
d2f4eb9cb6 | ||
|
|
ef8e78d9bc | ||
|
|
b2c6a23f55 | ||
|
|
e0a8ae40de | ||
|
|
dde97cadc8 | ||
|
|
63ae6492eb | ||
|
|
9162840a25 | ||
|
|
6d40654523 | ||
|
|
970407eab9 | ||
|
|
0535413490 | ||
|
|
e62f2c97d6 | ||
|
|
8ee75a9e6d | ||
|
|
a0950d418c | ||
|
|
8d8caca23c | ||
|
|
a5b2d4d32e | ||
|
|
8f363f2e95 | ||
|
|
ddb19c73c6 | ||
|
|
8fc3a26b78 | ||
|
|
b20c664f81 | ||
|
|
5e80ab63b0 | ||
|
|
e3d4aa7006 | ||
|
|
1913cafacc | ||
|
|
f8e7dc75ad | ||
|
|
4c346aabd9 | ||
|
|
173b4d78f3 | ||
|
|
b84ad7aae6 | ||
|
|
0eb238551c | ||
|
|
68bb87936a | ||
|
|
c82a2b96ab | ||
|
|
77624f63c7 | ||
|
|
a8d06a46e1 | ||
|
|
efcdb11fc1 | ||
|
|
9d113e9376 | ||
|
|
1593871b51 | ||
|
|
c4ba03dd47 | ||
|
|
826f4d3fd8 | ||
|
|
883e566cd2 | ||
|
|
0ccd5114f0 | ||
|
|
777f6607ea | ||
|
|
00c20fc389 | ||
|
|
47e87b269e | ||
|
|
36c26570ac | ||
|
|
6aae1d54bc | ||
|
|
c2bd990c9d | ||
|
|
1218ff377d | ||
|
|
42fe051bad | ||
|
|
6a92615bb1 | ||
|
|
c7db94c63a | ||
|
|
215ec526a1 | ||
|
|
d597b0416d | ||
|
|
6d41d04cbd | ||
|
|
b15abee11b | ||
|
|
664db48914 | ||
|
|
c494433576 | ||
|
|
2a49b303cc | ||
|
|
7fa0ac699d | ||
|
|
501449f98a | ||
|
|
9e5c550474 | ||
|
|
82e0999a9f | ||
|
|
998e3765d2 | ||
|
|
fc5f1b11e8 | ||
|
|
2837f0ab32 | ||
|
|
8abcf97f1e | ||
|
|
5d1ba51a71 | ||
|
|
4ced38eee1 | ||
|
|
d93c433fdf | ||
|
|
e9af465e1c | ||
|
|
bec0bb880a | ||
|
|
e4ca90db04 | ||
|
|
833db3c168 | ||
|
|
bff781f1db | ||
|
|
39573ec1ce | ||
|
|
9a645294ee | ||
|
|
97d397c2b1 | ||
|
|
5ea6b82d8d | ||
|
|
9ddee3a3f8 | ||
|
|
8450e6717b | ||
|
|
e66a88def3 | ||
|
|
cc965c66fb | ||
|
|
5560354ffd | ||
|
|
f27ab683d6 | ||
|
|
9ef2138f0c | ||
|
|
a887d5b997 | ||
|
|
14e7655df9 | ||
|
|
b20559057d | ||
|
|
d7c79bf6ba | ||
|
|
134c3c8119 | ||
|
|
300a5b4f64 | ||
|
|
61fdd5307b | ||
|
|
c2ac8cc7d4 | ||
|
|
cc95a1f36e | ||
|
|
945d566e43 | ||
|
|
186746041b | ||
|
|
16d5e00fc3 | ||
|
|
936b6f4f34 | ||
|
|
d6e65c36c3 | ||
|
|
559053b169 | ||
|
|
25796587fb | ||
|
|
82450bf9c7 | ||
|
|
7bada617b7 | ||
|
|
67f6e1d9db | ||
|
|
d9e2b26e98 | ||
|
|
8c2d2d762f | ||
|
|
704f1d69fa | ||
|
|
1c5e2b68f4 | ||
|
|
af856335af | ||
|
|
3da75053aa | ||
|
|
2f11880055 | ||
|
|
f4ac7fad14 | ||
|
|
5835257d1e | ||
|
|
11597254ea | ||
|
|
bf17265ac0 | ||
|
|
f2bb032e17 | ||
|
|
59435e4bc3 | ||
|
|
b7c1510a5d | ||
|
|
5ba393a09b | ||
|
|
3b90597478 | ||
|
|
408911bddd | ||
|
|
742722be71 | ||
|
|
87d4e6f516 | ||
|
|
42a2b935cb | ||
|
|
1db4bda0bc | ||
|
|
00c05e673e | ||
|
|
f55d9d8a7a | ||
|
|
fe264a58ce | ||
|
|
4aa51ec00d | ||
|
|
ac25f962de | ||
|
|
f95a7e1450 | ||
|
|
dc0ad2647f | ||
|
|
524df27792 | ||
|
|
47e3961b3e | ||
|
|
86fcfb4c67 | ||
|
|
3d0682b004 | ||
|
|
ee90ba2b45 | ||
|
|
bf931fedf6 | ||
|
|
957e62c5f9 | ||
|
|
d5add5486c | ||
|
|
cb010fb5c6 | ||
|
|
7df98bde28 | ||
|
|
e9c2e773f4 | ||
|
|
15fd95bb19 | ||
|
|
9ff3b57f4e | ||
|
|
8790d7ea37 | ||
|
|
c7881176c1 | ||
|
|
516365b2af | ||
|
|
b5d7b2d2f8 | ||
|
|
a8e4b71efa | ||
|
|
5e5207f508 | ||
|
|
8597332738 | ||
|
|
927f3016c9 | ||
|
|
1edb6c878e | ||
|
|
ac29807afd | ||
|
|
6c2a8abf93 | ||
|
|
f827356158 | ||
|
|
3b569e509a | ||
|
|
7cdb4ffaf3 | ||
|
|
f7496db953 | ||
|
|
fc5b97caf8 | ||
|
|
b8873cd4f3 | ||
|
|
505722047c | ||
|
|
06a336742c | ||
|
|
041d2f0b38 | ||
|
|
be09981ef5 | ||
|
|
7c851c26d7 | ||
|
|
b89d904d72 | ||
|
|
0b464f3628 | ||
|
|
33035603ad | ||
|
|
7924ac4162 | ||
|
|
4b963a8dc3 | ||
|
|
f5704eea8a | ||
|
|
5bf5aa5600 | ||
|
|
523490d7e5 | ||
|
|
ae1ed6e3ff | ||
|
|
4425d456d6 | ||
|
|
eac46b3393 | ||
|
|
c35e556cf9 | ||
|
|
83e5f8f3bc | ||
|
|
7459dfd074 | ||
|
|
a492ebf4e1 | ||
|
|
8db9598060 | ||
|
|
ced2bba300 | ||
|
|
d7a5953f7f | ||
|
|
8b7c3b2bc8 | ||
|
|
67d2f4b443 | ||
|
|
57c4f80eb0 | ||
|
|
9badedfbdb | ||
|
|
eb68e0181a | ||
|
|
a2480f2d21 | ||
|
|
328a82914f | ||
|
|
9a4d6ccf38 | ||
|
|
d6c739b1c5 | ||
|
|
0ee6fd05ba | ||
|
|
edb2f91006 | ||
|
|
99cb765424 | ||
|
|
1088eeaf43 | ||
|
|
ad97c8a9f1 | ||
|
|
1bf1960cde | ||
|
|
c8fbd3bcdc | ||
|
|
727be74343 | ||
|
|
2a373a243f | ||
|
|
594262930d | ||
|
|
ea52a6e0a6 | ||
|
|
64bb598d0e | ||
|
|
2ceedd593c | ||
|
|
ce336a3f8d | ||
|
|
2bd4127135 | ||
|
|
325163e5fa | ||
|
|
cf2d083905 | ||
|
|
edc3f86ad8 | ||
|
|
eea1faef81 | ||
|
|
dcaffe7aee | ||
|
|
ed273f5750 | ||
|
|
b298a69c5f | ||
|
|
d4c9d647d8 | ||
|
|
18a0a47136 | ||
|
|
65f9165b58 | ||
|
|
525822b3d3 | ||
|
|
15891ff890 | ||
|
|
488261dbd4 | ||
|
|
c2fcf04369 | ||
|
|
8a70df1ffa | ||
|
|
a4239311bb | ||
|
|
850bcf8d7f | ||
|
|
60b46413c7 | ||
|
|
c8fab584f0 | ||
|
|
64a35b2798 | ||
|
|
dda0883461 | ||
|
|
82e36eee7a | ||
|
|
87514fed5f | ||
|
|
f25d7d754d | ||
|
|
392322a432 | ||
|
|
79a03df2fb | ||
|
|
3612143d68 | ||
|
|
9d04974902 | ||
|
|
0443fd2ea2 | ||
|
|
5c3bfb1182 | ||
|
|
99ce5971dc | ||
|
|
82fc956181 | ||
|
|
440321ee21 | ||
|
|
0df88066cc | ||
|
|
0e73d7c7f4 | ||
|
|
b1f0658cc5 | ||
|
|
587f97e3b5 | ||
|
|
5ae366665b | ||
|
|
2ad273a8bb | ||
|
|
fa7f16360e | ||
|
|
e38b6bc952 | ||
|
|
e3f8d25328 | ||
|
|
f9ac2761d2 | ||
|
|
553669f460 | ||
|
|
63eb662290 | ||
|
|
533cae9c2e | ||
|
|
3d23408823 | ||
|
|
e1836ec8b4 | ||
|
|
d4f5200d3c | ||
|
|
0ee33ae86f | ||
|
|
6d22b0d6b7 | ||
|
|
be9e77f685 | ||
|
|
78693c3be9 | ||
|
|
a64163a332 | ||
|
|
fff993929f | ||
|
|
20a63bb614 | ||
|
|
71d0d1b9a5 | ||
|
|
2571590dfb | ||
|
|
5d84c6af81 | ||
|
|
f0dc0e1046 | ||
|
|
5370d814fb | ||
|
|
218282a2a0 | ||
|
|
b04916fdbf | ||
|
|
ec01ed4345 | ||
|
|
8d2295d74f | ||
|
|
eda995e011 | ||
|
|
010b5e2597 | ||
|
|
12c27519b7 | ||
|
|
ac0b03fd5f | ||
|
|
3e4814add9 | ||
|
|
1090e64fa3 | ||
|
|
7dfe5c2397 | ||
|
|
b5dcf93c1f | ||
|
|
e5a11328ee | ||
|
|
751cd0acfb | ||
|
|
a520501258 | ||
|
|
d750a4be81 | ||
|
|
7c1bd26491 | ||
|
|
7931dab53e | ||
|
|
94e5e301c4 | ||
|
|
dc6e1bdb1c | ||
|
|
ee29bbcb11 | ||
|
|
d22287dd0e | ||
|
|
3821164970 | ||
|
|
29e89ef824 | ||
|
|
41f7aa7a20 | ||
|
|
06385eb3bf | ||
|
|
caa339d786 | ||
|
|
a29ca106b1 | ||
|
|
dd3b682af3 | ||
|
|
44bfdd4a8f | ||
|
|
79f0438079 | ||
|
|
e043fd613d | ||
|
|
cf40373829 | ||
|
|
183e848937 | ||
|
|
6675fb7d47 | ||
|
|
b6c2554f86 | ||
|
|
42b2166824 | ||
|
|
976b15d484 | ||
|
|
1f19b961db | ||
|
|
bf6bb3559d | ||
|
|
6fc2f223ad | ||
|
|
29e9ba2b1c | ||
|
|
e5f83eeccb | ||
|
|
b49237b25f | ||
|
|
8757d26487 | ||
|
|
760c8d9196 | ||
|
|
e914250f5d | ||
|
|
2949307bb3 | ||
|
|
a995068978 | ||
|
|
71de99b11b | ||
|
|
a0dc92a115 | ||
|
|
447830f4a2 | ||
|
|
5d2f74c8de | ||
|
|
d2f815d256 | ||
|
|
b1f5d42a25 | ||
|
|
b40417943a | ||
|
|
a88c860989 | ||
|
|
4d6352e089 | ||
|
|
9379d2b8c2 | ||
|
|
4b1ed89dde | ||
|
|
5e60605b58 | ||
|
|
f68ddda386 | ||
|
|
45a57d9f27 | ||
|
|
05101d8d8e | ||
|
|
c1ea907ba7 | ||
|
|
734dcfd45b | ||
|
|
862e9995cc | ||
|
|
44033decc6 | ||
|
|
40566f6059 | ||
|
|
2e977822b1 | ||
|
|
e351fe271f | ||
|
|
e6893d1db5 | ||
|
|
ee8403e39b | ||
|
|
888c1ae3e6 | ||
|
|
2584d6aeb0 | ||
|
|
959e75b256 | ||
|
|
f990734a87 | ||
|
|
2ec676defb | ||
|
|
d2811cc422 | ||
|
|
61dbbf4e53 | ||
|
|
fea83fbf87 | ||
|
|
5218b27402 | ||
|
|
2eb6f2c9c2 | ||
|
|
90e7e4c32e | ||
|
|
9eebd3e9dd | ||
|
|
a7f31eb918 | ||
|
|
84af4d9ebf | ||
|
|
8e5745bf0e | ||
|
|
dbd32e208f | ||
|
|
73e426ddad | ||
|
|
0b1eeafb36 | ||
|
|
4e73c75b8b | ||
|
|
e9418127ee | ||
|
|
6d9dddcb84 | ||
|
|
38bf0759c2 | ||
|
|
884de45ae7 | ||
|
|
bd9dd06f89 | ||
|
|
a12b89dab3 | ||
|
|
f7f5a5859c | ||
|
|
29601079c8 | ||
|
|
9d24120b9b | ||
|
|
bf854b4419 | ||
|
|
341334939f | ||
|
|
e30addb819 | ||
|
|
ecb9f0013f | ||
|
|
3530f125d3 | ||
|
|
d641a7e3b4 | ||
|
|
7388ebc629 | ||
|
|
82e54dc8f5 | ||
|
|
354a8b1126 | ||
|
|
2683476fe4 | ||
|
|
fcdc0c75b3 | ||
|
|
a7287c5261 | ||
|
|
a752730d9d | ||
|
|
a93925e520 | ||
|
|
ec582c45bc | ||
|
|
e59eb365bb | ||
|
|
2662571357 | ||
|
|
3e98e21b43 | ||
|
|
a4671b2ceb | ||
|
|
6b392e8a54 | ||
|
|
edf824b77d | ||
|
|
c7e5e48282 | ||
|
|
87765207c0 | ||
|
|
e32f5244f0 | ||
|
|
243fa7a870 | ||
|
|
05cd46bb01 | ||
|
|
0a8fcc2a03 | ||
|
|
782cdb6046 | ||
|
|
a687e50d5b | ||
|
|
12730be0d4 | ||
|
|
ed7a19eed3 | ||
|
|
3b4d9853aa | ||
|
|
ef07234b26 | ||
|
|
dbb03c4aee | ||
|
|
f9a9d02308 | ||
|
|
7e0a6c7197 | ||
|
|
55ff37c296 | ||
|
|
f77aa3d1c5 | ||
|
|
2b92426d9c | ||
|
|
2a6515b2af | ||
|
|
0609479caf | ||
|
|
9b1a54999a | ||
|
|
fe64297e55 | ||
|
|
ea7e27ad6f | ||
|
|
3d0db423ed | ||
|
|
5276fb8728 | ||
|
|
7280704a33 | ||
|
|
fd1fec92ac | ||
|
|
ee92708d40 | ||
|
|
335e32613a | ||
|
|
2018cbdc6f | ||
|
|
7852c26286 | ||
|
|
15712a67e1 | ||
|
|
be44746f79 | ||
|
|
cbfbb6e5f6 | ||
|
|
938852779b | ||
|
|
7db4fbf424 | ||
|
|
e06416ba82 | ||
|
|
aae8229048 | ||
|
|
b04812762d | ||
|
|
f3a146d25f | ||
|
|
986172f616 | ||
|
|
e4f11d5341 | ||
|
|
db348b3f51 | ||
|
|
2f4aa33cfe | ||
|
|
e7a44b7760 | ||
|
|
091a8a3c6d | ||
|
|
8d79c9255d | ||
|
|
061e513601 | ||
|
|
9b9dc4d645 | ||
|
|
c5a83c2889 | ||
|
|
726c012b2f | ||
|
|
6f67aa8382 | ||
|
|
274d8e24fa | ||
|
|
481b8fb2d8 | ||
|
|
f58dcd7e33 | ||
|
|
cdd5cebfc5 | ||
|
|
6968489d8b | ||
|
|
4125d54016 | ||
|
|
663a847351 | ||
|
|
9c1baaf306 | ||
|
|
7b3aa8da85 | ||
|
|
c18e1a776d | ||
|
|
652610bb5d | ||
|
|
73134a4f45 | ||
|
|
1758d8704c | ||
|
|
d76c79b9ab | ||
|
|
303c8a9920 | ||
|
|
bdf54265ce | ||
|
|
c24381f820 | ||
|
|
176a2a8d08 | ||
|
|
47acdceaad | ||
|
|
a9cf324199 | ||
|
|
f3a7460985 | ||
|
|
44332a13de | ||
|
|
c01c9bbca6 | ||
|
|
b81ac5fcf7 | ||
|
|
6af7fe09eb | ||
|
|
020e01237a | ||
|
|
e9ea832281 | ||
|
|
6f8d223142 | ||
|
|
591053ef40 | ||
|
|
7f0bb521d4 | ||
|
|
cff738248b | ||
|
|
4e92ff1740 | ||
|
|
65549d136c | ||
|
|
511adfd6d8 | ||
|
|
03a6e458cb | ||
|
|
bac140cf92 | ||
|
|
4623ef28a3 | ||
|
|
979b95dab9 | ||
|
|
373f0307d8 | ||
|
|
8e17897597 | ||
|
|
f5d6154be4 | ||
|
|
4e0ac054ec | ||
|
|
c1951921c0 | ||
|
|
501b447ca1 | ||
|
|
0d7db51cf8 | ||
|
|
ecc7b7d7b6 | ||
|
|
debd68e950 | ||
|
|
748ffca1e4 | ||
|
|
474a9238ec | ||
|
|
0ff2809f0d | ||
|
|
585bb001ba | ||
|
|
66e3e205ef | ||
|
|
178b33545f | ||
|
|
433a779d95 | ||
|
|
a517b99294 | ||
|
|
1fcb7095dd |
No files matched your search
+13
-8
@@ -1,15 +1,20 @@
|
||||
Data-Storage
|
||||
Log-Files
|
||||
My-Workspaces
|
||||
**/Data-Storage
|
||||
**/My-Data-Storage
|
||||
**/Log-Files
|
||||
**/My-Log-Files
|
||||
**/My-Workspaces
|
||||
debug.log
|
||||
|
||||
*.db
|
||||
|
||||
.git*
|
||||
.vscode
|
||||
README.md
|
||||
LICENSE
|
||||
CONTRIBUITING.md
|
||||
CONTRIBUTING.md
|
||||
CODE_OF_CONDUCT.md
|
||||
./**/.vscode
|
||||
Dockerfile
|
||||
.git*
|
||||
.docker*
|
||||
**/.vscode
|
||||
**/Dockerfile*
|
||||
**/docker-compose.yml
|
||||
**/node_modules
|
||||
**/.env*
|
||||
@@ -0,0 +1,30 @@
|
||||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
||||
|
||||
# These owners will be the default owners for everything in
|
||||
# the repo. Unless a later match takes precedence, these will be requested for
|
||||
# review when someone opens a pull request.
|
||||
|
||||
* @Superalgos/foundations-project
|
||||
|
||||
# Project Teams
|
||||
/Projects/Algorithmic-Trading/ @Superalgos/algorithmic-trading-project
|
||||
/Projects/Community-Plugins/ @Superalgos/community-plugins-project
|
||||
/Projects/Data-Mining/ @Superalgos/data-mining-project
|
||||
/Projects/Ethereum/ @Superalgos/ethereum-project
|
||||
/Projects/Foundations/ @Superalgos/foundations-project
|
||||
/Projects/Governance/ @Superalgos/governance-project
|
||||
/Projects/Machine-Learning/ @Superalgos/machine-learning-project
|
||||
/Projects/Network/ @Superalgos/network-project
|
||||
/Projects/Social-Bots/ @Superalgos/social-bots-project
|
||||
/Projects/Social-Trading/ @Superalgos/social-trading-project
|
||||
/Projects/TensorFlow/ @Superalgos/tensorflow-project
|
||||
/Projects/Visual-Scripting/ @Superalgos/visual-scripting-project
|
||||
|
||||
/Projects/Education/ @Superalgos/education-project
|
||||
Docs*/ @Superalgos/education-project
|
||||
|
||||
/.github/ @Superalgos/sysadmins-team
|
||||
/Docker/ @Superalgos/sysadmins-team
|
||||
.git* @Superalgos/sysadmins-team
|
||||
.docker* @Superalgos/sysadmins-team
|
||||
package*.json @Superalgos/sysadmins-team
|
||||
@@ -0,0 +1,69 @@
|
||||
name: Build/release Binaries
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
#release:
|
||||
# types: [published, created]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download a file
|
||||
run: curl "https://raw.githubusercontent.com/${{ github.repository }}/master/package.json" -o package.json
|
||||
|
||||
- name: get-version
|
||||
id: version
|
||||
uses: nyaa8/package-version@v1
|
||||
with:
|
||||
path: './package.json'
|
||||
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: viperproject/create-nightly-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.PACKAGE_VERSION }}
|
||||
release_name: Superalgos-v${{ env.PACKAGE_VERSION }}
|
||||
|
||||
build-release:
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: create-release
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: develop
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14
|
||||
|
||||
- name: get-version
|
||||
id: version
|
||||
uses: nyaa8/package-version@v1
|
||||
with:
|
||||
path: './package.json'
|
||||
|
||||
- name: Build/release Electron app
|
||||
uses: samuelmeuli/action-electron-builder@v1
|
||||
with:
|
||||
# GitHub token, automatically provided to the action
|
||||
# (No need to define this secret in the repo settings)
|
||||
github_token: ${{ secrets.github_token }}
|
||||
args: "-c.extraMetadata.version=${{ env.PACKAGE_VERSION }} -c build/electron-builder.json -p always"
|
||||
|
||||
# If the commit is tagged with a version (e.g. "v1.0.0"),
|
||||
# release the app after building
|
||||
# release: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
release: true
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
name: Nightly develop Binaries
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '20 3 * * *'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download a file
|
||||
run: curl "https://raw.githubusercontent.com/${{ github.repository }}/develop/package.json" -o package.json
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y%m%d')"
|
||||
|
||||
- name: get-version
|
||||
id: version
|
||||
uses: nyaa8/package-version@v1
|
||||
with:
|
||||
path: './package.json'
|
||||
|
||||
- name: Create nightly release
|
||||
id: create_release
|
||||
uses: viperproject/create-nightly-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.PACKAGE_VERSION }}.${{ steps.date.outputs.date }}
|
||||
release_name: Superalgos ${{ env.PACKAGE_VERSION }} Snapshot ${{ steps.date.outputs.date }}
|
||||
keep_num: 5
|
||||
keep_tags: false
|
||||
|
||||
build-release:
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: create-release
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y%m%d')"
|
||||
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: develop
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14
|
||||
|
||||
- name: get-version
|
||||
id: version
|
||||
uses: nyaa8/package-version@v1
|
||||
with:
|
||||
path: './package.json'
|
||||
|
||||
- name: Build/release Electron app
|
||||
uses: samuelmeuli/action-electron-builder@v1
|
||||
with:
|
||||
# GitHub token, automatically provided to the action
|
||||
# (No need to define this secret in the repo settings)
|
||||
github_token: ${{ secrets.github_token }}
|
||||
args: "-c.extraMetadata.main=electron-wrapper.js -c.extraMetadata.version=${{ env.PACKAGE_VERSION }}.${{ steps.date.outputs.date }} -c build/electron-builder.json -p onTagOrDraft"
|
||||
|
||||
# If the commit is tagged with a version (e.g. "v1.0.0"),
|
||||
# release the app after building
|
||||
# release: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
release: true
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
Data-Storage
|
||||
Log-Files
|
||||
My-Workspaces
|
||||
My-Social-Trading-Data
|
||||
My-Network-Nodes-Data
|
||||
My-Secrets
|
||||
My-Data-Storage
|
||||
My-Log-Files
|
||||
debug.log
|
||||
.DS_Store
|
||||
*.db
|
||||
@@ -12,4 +17,6 @@ Projects/Foundations/Icons/Thumbs.db
|
||||
*.exe
|
||||
node_modules
|
||||
launch.json
|
||||
package-lock.json
|
||||
.idea
|
||||
dist
|
||||
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
|
||||
}
|
||||
}
|
||||
Vendored
+12
-4
@@ -1,17 +1,25 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/Data-Storage": true,
|
||||
"**/Documentation": true,
|
||||
"**/Log-Files": true,
|
||||
"**/node_modules": true,
|
||||
"**/Deprecated-Code": true
|
||||
"**/My-Social-Trading-Data": true,
|
||||
"**/My-Network-Nodes-Data": true,
|
||||
"**/My-Workspaces": true,
|
||||
"**/My-Secrets": true,
|
||||
"**/My-Data-Storage": true,
|
||||
"**/My-Log-Files": true,
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/Data-Storage": true,
|
||||
"**/Documentation": true,
|
||||
"**/Log-Files": true,
|
||||
"**/node_modules": true,
|
||||
"**/Deprecated-Code": true
|
||||
"**/My-Social-Trading-Data": true,
|
||||
"**/My-Network-Nodes-Data": true,
|
||||
"**/My-Workspaces": true,
|
||||
"**/My-Secrets": true,
|
||||
"**/My-Data-Storage": true,
|
||||
"**/My-Log-Files": true,
|
||||
},
|
||||
"search.maintainFileSearchCache": true
|
||||
}
|
||||
+22
-21
@@ -8,33 +8,34 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
|
||||
async function run() {
|
||||
/*
|
||||
let socialGraphService = NT.projects.network.modules.socialGraph.newSocialGraph()
|
||||
await socialGraphService.initialize()
|
||||
Here we will store our running objects:
|
||||
*/
|
||||
|
||||
DK.running = {}
|
||||
/*
|
||||
This is the Personal Social Graph for the user running this App.
|
||||
*/
|
||||
DK.running.socialGraph = DK.projects.socialTrading.modules.socialGraph.newSocialTradingModulesSocialGraph()
|
||||
await DK.running.socialGraph.initialize()
|
||||
/*
|
||||
This is the Web Sockets client that interacts with the Superalgos Network.
|
||||
*/
|
||||
//DK.webSocketsClient = SA.projects.network.modules.webSocketsClient.newNetworkModulesWebSocketsClient()
|
||||
//await DK.webSocketsClient.initialize()
|
||||
DK.running.webSocketsClient = SA.projects.network.modules.webSocketsAppClient.newNetworkModulesWebSocketsAppClient()
|
||||
await DK.running.webSocketsClient.initialize()
|
||||
console.log('Desktop Client Connected to Network Node via Web Sockets ................... Connected to port ' + global.env.NETWORK_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
/* These are the Network Interfaces by which the UI interacts with the Desktop App.*/
|
||||
//let WEB_SOCKETS_INTERFACE = require('./webSocketsInterface.js')
|
||||
let HTTP_INTERFACE = require('./httpInterface.js')
|
||||
/* These are the Network Interfaces by which the Web App interacts with this Desktop Client.*/
|
||||
|
||||
/*
|
||||
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)
|
||||
*/
|
||||
DK.running.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface()
|
||||
DK.running.webSocketsInterface.initialize()
|
||||
console.log('Desktop Client Web Sockets Interface ....................................... Listening at port ' + global.env.DESKTOP_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
HTTP_INTERFACE = HTTP_INTERFACE.newHttpInterface()
|
||||
HTTP_INTERFACE.initialize()
|
||||
console.log('Http Interface .............................................. Listening at port ' + global.env.DESKTOP_HTTP_INTERFACE_PORT)
|
||||
|
||||
DK.running.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface()
|
||||
DK.running.httpInterface.initialize()
|
||||
console.log('Desktop Client Http Interface .............................................. Listening at port ' + global.env.DESKTOP_HTTP_INTERFACE_PORT)
|
||||
|
||||
return
|
||||
|
||||
|
||||
let queryMessage
|
||||
let query
|
||||
/*
|
||||
@@ -42,7 +43,7 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
*/
|
||||
queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.USER_PROFILES,
|
||||
emitterUserProfileId: DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID,
|
||||
emitterUserProfileId: SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileId,
|
||||
initialIndex: 'Last',
|
||||
amountRequested: 10,
|
||||
direction: 'Past'
|
||||
@@ -71,7 +72,7 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
let eventMessage = {
|
||||
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
|
||||
eventType: SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE,
|
||||
emitterUserProfileId: DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID,
|
||||
emitterUserProfileId: SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileId,
|
||||
targetUserProfileId: profile.userProfileId
|
||||
}
|
||||
|
||||
@@ -96,8 +97,8 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
*/
|
||||
queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.USER_PROFILE_STATS,
|
||||
emitterUserProfileId: DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID,
|
||||
targetUserProfileId: DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID
|
||||
emitterUserProfileId: SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileId,
|
||||
targetUserProfileId: SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileId
|
||||
}
|
||||
|
||||
query = {
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
let postLoader
|
||||
|
||||
function newAppLoader() {
|
||||
const MODULE_NAME = 'App Loader'
|
||||
const INFO_LOG = false
|
||||
const ERROR_LOG = true
|
||||
const logger = newWebDebugLog()
|
||||
|
||||
|
||||
let thisObject = {
|
||||
loadModules: loadModules
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
async function loadModules() {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> Entering function.') }
|
||||
|
||||
let plotters
|
||||
let modulesArray = []
|
||||
|
||||
plotters = defaultPlotters()
|
||||
|
||||
modulesArray = modulesArray.concat([
|
||||
|
||||
'Globals.js',
|
||||
'Workspace.js',
|
||||
|
||||
'Files/SingleFile.js',
|
||||
'Files/FileCloud.js',
|
||||
'Files/MarketFiles.js',
|
||||
'Files/DailyFiles.js',
|
||||
'Files/FileCursor.js',
|
||||
'Files/FileSequence.js',
|
||||
'Files/FileStorage.js',
|
||||
|
||||
'EventsServerClient.js',
|
||||
|
||||
'LegacyPlotter.js',
|
||||
'PlotterPanel.js',
|
||||
|
||||
'VideoRecorder.js',
|
||||
'ProductStorage.js',
|
||||
'Canvas.js',
|
||||
'EventHandler.js',
|
||||
'Frame.js',
|
||||
'Animation.js',
|
||||
'Container.js',
|
||||
'Utilities.js',
|
||||
'AppPostLoader.js'
|
||||
])
|
||||
|
||||
modulesArray = modulesArray.concat(plotters)
|
||||
|
||||
functionLibraries()
|
||||
|
||||
function functionLibraries() {
|
||||
let url = 'ListFunctionLibraries'
|
||||
httpRequest(undefined, url, onResponse)
|
||||
|
||||
function onResponse(err, fileList) {
|
||||
let urlArray = []
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let item = fileArray[i]
|
||||
|
||||
project = item[0]
|
||||
fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
utilities()
|
||||
}
|
||||
}
|
||||
|
||||
function utilities() {
|
||||
let url = 'ListUtilitiesFiles'
|
||||
httpRequest(undefined, url, onResponse)
|
||||
|
||||
function onResponse(err, fileList) {
|
||||
let urlArray = []
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let item = fileArray[i]
|
||||
|
||||
project = item[0]
|
||||
fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Utilities' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
globals()
|
||||
}
|
||||
}
|
||||
|
||||
function globals() {
|
||||
let url = 'ListGlobalFiles'
|
||||
httpRequest(undefined, url, onResponse)
|
||||
|
||||
function onResponse(err, fileList) {
|
||||
let urlArray = []
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let item = fileArray[i]
|
||||
|
||||
project = item[0]
|
||||
fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
spaces()
|
||||
}
|
||||
}
|
||||
|
||||
function spaces() {
|
||||
let url = 'ListSpaceFiles'
|
||||
httpRequest(undefined, url, onResponse)
|
||||
|
||||
function onResponse(err, fileList) {
|
||||
let urlArray = []
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let path = fileArray[i]
|
||||
urlArray.push('Projects' + '/' + path)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
downloadIncludedFiles()
|
||||
}
|
||||
}
|
||||
|
||||
function downloadIncludedFiles() {
|
||||
|
||||
let downloadedCounter = 0
|
||||
|
||||
for (let i = 0; i < modulesArray.length; i++) {
|
||||
let path = modulesArray[i]
|
||||
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> Module Requested.') }
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> path = ' + path) }
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> total requested = ' + (i + 1)) }
|
||||
|
||||
function onRequired(pModule) {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> onRequired -> Entering function.') }
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> onRequired -> Module Downloaded.') }
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> onRequired -> path = ' + path) }
|
||||
|
||||
downloadedCounter++
|
||||
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> onRequired -> downloadedCounter = ' + downloadedCounter) }
|
||||
|
||||
if (downloadedCounter === modulesArray.length) {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> onRequired -> Starting Advanced Algos Platform.') }
|
||||
setTimeout(() => {
|
||||
postLoader = newAppPostLoader()
|
||||
postLoader.start()
|
||||
}, 500)
|
||||
|
||||
}
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] loadModules -> onRequired -> err = ' + err.stack) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] loadModules -> err = ' + err.stack) }
|
||||
}
|
||||
}
|
||||
|
||||
function defaultPlotters() {
|
||||
return [
|
||||
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/Candles.js',
|
||||
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/CandlePanel.js',
|
||||
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/Volumes.js',
|
||||
'Plotters/Foundations/Candles/Plotters-Candles-Volumes/VolumePanel.js',
|
||||
'Plotters/Foundations/Bollinger/Plotters-Bollinger-Bands/BollingerBands.js',
|
||||
'Plotters/Foundations/Bollinger/Plotters-Bollinger-Bands/BollingerBandsPanel.js',
|
||||
'Plotters/Foundations/Bollinger/Plotters-Bollinger-Bands/PercentageBandwidth.js'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
/* Root objects*/
|
||||
let UI = {
|
||||
projects: {},
|
||||
schemas: { projectSchema: undefined },
|
||||
environment: undefined,
|
||||
running: {}
|
||||
}
|
||||
|
||||
let SA = { projects: {} }
|
||||
/*
|
||||
We will use this to load functions originally intended for Nodejs
|
||||
*/
|
||||
let exports = {}
|
||||
|
||||
@@ -0,0 +1,412 @@
|
||||
function newWebApp() {
|
||||
/*
|
||||
In it's current state of development, the Web App only has one module.
|
||||
|
||||
Everything is being coded here until some structure emerges.
|
||||
*/
|
||||
let thisObject = {
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
|
||||
}
|
||||
|
||||
async function initialize() {
|
||||
try {
|
||||
setupRootObject(UI, 'UI')
|
||||
setupRootObject(SA, 'SA')
|
||||
await UI.projects.socialTrading.modules.webSocketsWebClient.initialize()
|
||||
loadWUserProfileTimeline()
|
||||
loadWhoToFollow()
|
||||
setupEventHandlers()
|
||||
} catch (err) {
|
||||
console.log('[ERROR] initialize -> err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
function setupRootObject(rootObject, rootObjectName) {
|
||||
/*
|
||||
Here we will setup the UI object, with all the
|
||||
projects and spaces.
|
||||
*/
|
||||
for (let i = 0; i < UI.schemas.projectSchema.length; i++) {
|
||||
let projectDefinition = UI.schemas.projectSchema[i]
|
||||
rootObject.projects[projectDefinition.propertyName] = {}
|
||||
let projectInstance = rootObject.projects[projectDefinition.propertyName]
|
||||
|
||||
projectInstance.utilities = {}
|
||||
projectInstance.globals = {}
|
||||
projectInstance.functionLibraries = {}
|
||||
projectInstance.modules = {}
|
||||
|
||||
if (projectDefinition[rootObjectName] === undefined) { continue }
|
||||
|
||||
/* Set up Globals of this Project */
|
||||
if (projectDefinition[rootObjectName].globals !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].globals.length; j++) {
|
||||
let globalDefinition = projectDefinition[rootObjectName].globals[j]
|
||||
|
||||
if (exports[globalDefinition.functionName] === undefined) {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval(globalDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval('exports.' + globalDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up Utilities of this Project */
|
||||
if (projectDefinition[rootObjectName].utilities !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].utilities.length; j++) {
|
||||
let utilityDefinition = projectDefinition[rootObjectName].utilities[j]
|
||||
|
||||
if (exports[utilityDefinition.functionName] === undefined) {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval(utilityDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval('exports.' + utilityDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up Function Libraries of this Project */
|
||||
if (projectDefinition[rootObjectName].functionLibraries !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].functionLibraries.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].functionLibraries[j]
|
||||
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up Modules of this Project */
|
||||
if (projectDefinition[rootObjectName].modules !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].modules.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].modules[j]
|
||||
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadWUserProfileTimeline() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.EVENTS,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST,
|
||||
amountRequested: 100,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST
|
||||
}
|
||||
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(addToContentDiv)
|
||||
.catch(onError)
|
||||
|
||||
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.webSocketsWebClient.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() {
|
||||
/*
|
||||
Add events to process button clicks , and mouseWheel.
|
||||
*/
|
||||
document.addEventListener("click", onClick)
|
||||
document.addEventListener('mousewheel', onMouseWheel, false)
|
||||
|
||||
async function onClick(event) {
|
||||
|
||||
if (event.target && event.target.nodeName === "BUTTON") {
|
||||
switch (event.target.name) {
|
||||
case 'New Post': {
|
||||
let textArea = document.getElementById("new-post-text-area")
|
||||
await sendNewPostEvent(
|
||||
textArea.value
|
||||
)
|
||||
.then(updateTextArea)
|
||||
.catch(onError)
|
||||
|
||||
function updateTextArea() {
|
||||
textArea.value = ""
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Follow Profile': {
|
||||
await sendTargetUserProfileEvent(
|
||||
event.target.userProfileId,
|
||||
SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE
|
||||
)
|
||||
.then(updateButton)
|
||||
.catch(onError)
|
||||
|
||||
function updateButton() {
|
||||
let span = document.getElementById('profile-to-follow-span-' + event.target.userProfileId)
|
||||
let button = document.getElementById('profile-to-follow-button-' + event.target.userProfileId)
|
||||
span.setAttribute("class", "profile-to-unfollow-span")
|
||||
button.setAttribute("class", "profile-to-unfollow-button")
|
||||
button.name = 'Unfollow Profile'
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Unfollow Profile': {
|
||||
await sendTargetUserProfileEvent(
|
||||
event.target.userProfileId,
|
||||
SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE
|
||||
)
|
||||
.then(updateButton)
|
||||
.catch(onError)
|
||||
|
||||
function updateButton() {
|
||||
let span = document.getElementById('profile-to-follow-span-' + event.target.userProfileId)
|
||||
let button = document.getElementById('profile-to-follow-button-' + event.target.userProfileId)
|
||||
span.setAttribute("class", "profile-to-follow-span")
|
||||
button.setAttribute("class", "profile-to-follow-button")
|
||||
button.name = 'Follow Profile'
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Error Handling
|
||||
*/
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Click event failed. ' + errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseWheel(event) {
|
||||
let scrollDiv = document.getElementById("scroll-div")
|
||||
scrollDiv.scrollTop = scrollDiv.scrollTop + event.deltaY
|
||||
}
|
||||
}
|
||||
|
||||
async function sendTargetUserProfileEvent(
|
||||
userProfileId,
|
||||
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()).valueOf()
|
||||
}
|
||||
|
||||
event = {
|
||||
requestType: 'Event',
|
||||
eventMessage: JSON.stringify(eventMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebClient.sendMessage(
|
||||
JSON.stringify(event)
|
||||
)
|
||||
.then(resolve)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Event not executed. ' + errorMessage)
|
||||
console.log('[ERROR] event = ' + JSON.stringify(event))
|
||||
reject(errorMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function sendNewPostEvent(
|
||||
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(),
|
||||
postText: postText,
|
||||
timestamp: (new Date()).valueOf()
|
||||
}
|
||||
|
||||
event = {
|
||||
requestType: 'Event',
|
||||
eventMessage: JSON.stringify(eventMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebClient.sendMessage(
|
||||
JSON.stringify(event)
|
||||
)
|
||||
.then(resolve)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Event not executed. ' + errorMessage)
|
||||
console.log('[ERROR] event = ' + JSON.stringify(event))
|
||||
reject(errorMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
|
||||
function newWebAppLoader() {
|
||||
|
||||
let thisObject = {
|
||||
loadModules: loadModules
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
async function loadModules() {
|
||||
try {
|
||||
let modulesArray = [
|
||||
'WebDebugLog.js',
|
||||
'WebApp.js'
|
||||
]
|
||||
|
||||
for (let i = 0; i < UI.schemas.projectSchema.length; i++) {
|
||||
let project = UI.schemas.projectSchema[i]
|
||||
|
||||
if (project.UI !== undefined) {
|
||||
if (project.UI.functionLibraries !== undefined) {
|
||||
for (let j = 0; j < project.UI.functionLibraries.length; j++) {
|
||||
let fileName = project.UI.functionLibraries[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.functionLibraries[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.UI.utilities !== undefined) {
|
||||
for (let j = 0; j < project.UI.utilities.length; j++) {
|
||||
let fileName = project.UI.utilities[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.utilities[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Utilities' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.UI.globals !== undefined) {
|
||||
for (let j = 0; j < project.UI.globals.length; j++) {
|
||||
let fileName = project.UI.globals[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.globals[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.UI.modules !== undefined) {
|
||||
for (let j = 0; j < project.UI.modules.length; j++) {
|
||||
let fileName = project.UI.modules[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.modules[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Modules' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (project.SA !== undefined) {
|
||||
if (project.SA.functionLibraries !== undefined) {
|
||||
for (let j = 0; j < project.SA.functionLibraries.length; j++) {
|
||||
let fileName = project.SA.functionLibraries[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.functionLibraries[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Function-Libraries' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.SA.utilities !== undefined) {
|
||||
for (let j = 0; j < project.SA.utilities.length; j++) {
|
||||
let fileName = project.SA.utilities[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.utilities[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Utilities' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.SA.globals !== undefined) {
|
||||
for (let j = 0; j < project.SA.globals.length; j++) {
|
||||
let fileName = project.SA.globals[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.globals[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.SA.modules !== undefined) {
|
||||
for (let j = 0; j < project.SA.modules.length; j++) {
|
||||
let fileName = project.SA.modules[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.modules[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Modules' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
downloadIncludedFiles()
|
||||
|
||||
function downloadIncludedFiles() {
|
||||
|
||||
let downloadedCounter = 0
|
||||
|
||||
for (let i = 0; i < modulesArray.length; i++) {
|
||||
let path = modulesArray[i]
|
||||
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
function onRequired(pModule) {
|
||||
try {
|
||||
|
||||
downloadedCounter++
|
||||
|
||||
if (downloadedCounter === modulesArray.length) {
|
||||
setTimeout(() => {
|
||||
UI.running.webApp = newWebApp()
|
||||
UI.running.webApp.initialize()
|
||||
}, 500)
|
||||
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] loadModules -> onRequired -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] loadModules -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
function loadSuperalgos() {
|
||||
|
||||
let browser = checkBrowserVersion()
|
||||
if ((browser.name !== "Chrome" && browser.name !== "Safari") || (browser.name === "Chrome" && parseInt(browser.version) < 85) || (browser.name === "Safari" && parseInt(browser.version) < 13)) {
|
||||
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionaility issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version)
|
||||
}
|
||||
|
||||
loadGlobals()
|
||||
|
||||
function loadGlobals() {
|
||||
let path = "Globals.js"
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
function onRequired(pModule) {
|
||||
setupEnvironment()
|
||||
}
|
||||
}
|
||||
|
||||
function setupEnvironment() {
|
||||
httpRequest(undefined, 'Environment', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.environment = JSON.parse(file)
|
||||
setupProjectsSchema()
|
||||
}
|
||||
}
|
||||
|
||||
function setupProjectsSchema() {
|
||||
httpRequest(undefined, 'ProjectsSchema', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.schemas.projectSchema = JSON.parse(file)
|
||||
loadModules()
|
||||
}
|
||||
}
|
||||
|
||||
function loadModules() {
|
||||
let path = "WebAppLoader.js"
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
function onRequired(pModule) {
|
||||
let APP_LOADER_MODULE = newWebAppLoader()
|
||||
APP_LOADER_MODULE.loadModules()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function httpRequest(pContentToSend, pPath, callBackFunction) {
|
||||
let xmlHttpRequest = new XMLHttpRequest()
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
try {
|
||||
callBackFunction(undefined, xmlHttpRequest.responseText)
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pContentToSend = ' + pContentToSend)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pPath = ' + pPath)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> xmlHttpRequest.responseText = ' + xmlHttpRequest.responseText)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> callBackFunction = ' + callBackFunction)
|
||||
|
||||
}
|
||||
return
|
||||
} else if (this.readyState === 4 && this.status === 404) {
|
||||
callBackFunction({ result: "Fail", message: xmlHttpRequest.responseText.trim(), code: xmlHttpRequest.responseText.trim() })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (pContentToSend === undefined) {
|
||||
xmlHttpRequest.open("GET", pPath, true)
|
||||
xmlHttpRequest.send()
|
||||
} else {
|
||||
try {
|
||||
let blob = new Blob([pContentToSend], { type: 'text/plain' })
|
||||
xmlHttpRequest.open("POST", pPath, true)
|
||||
xmlHttpRequest.send(blob)
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { console.log("[ERROR] callServer -> err.message = " + err.message) }
|
||||
callBackFunction({ result: "Fail", message: err.message })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkBrowserVersion() {
|
||||
|
||||
let ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []
|
||||
if (/trident/i.test(M[1])) {
|
||||
tem = /\brv[ :]+(\d+)/g.exec(ua) || []
|
||||
return { name: 'IE', version: (tem[1] || '') }
|
||||
}
|
||||
if (M[1] === 'Chrome') {
|
||||
tem = ua.match(/\bOPR|Edge\/(\d+)/)
|
||||
if (tem != null) { return { name: 'Opera', version: tem[1] } }
|
||||
}
|
||||
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']
|
||||
if ((tem = ua.match(/version\/(\d+)/i)) != null) { M.splice(1, 1, tem[1]) }
|
||||
return {
|
||||
name: M[0],
|
||||
version: M[1]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
function newWebDebugLog() {
|
||||
try {
|
||||
let thisObject = {
|
||||
write: write,
|
||||
fileName: 'undefined'
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function write(pText) {
|
||||
console.log(spacePad(thisObject.fileName, 50) + ' : ' + pText)
|
||||
|
||||
function spacePad(str, max) {
|
||||
str = str.toString()
|
||||
return str.length < max ? spacePad(' ' + str, max) : str
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(spacePad(MODULE_NAME, 50) + ' : ' + '[ERROR] WebDebugLog --> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -22,13 +22,288 @@
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
kbd {
|
||||
padding: 2px 8px;
|
||||
font-size: 125%;
|
||||
font-weight: 500;
|
||||
.body{
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.scroll-div {
|
||||
position:absolute;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
top:0px;
|
||||
left:0px;
|
||||
vertical-align: top;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
background-color: #bcd643;
|
||||
border-radius: 5px;
|
||||
border-style: outset;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.static-div {
|
||||
position: fixed;
|
||||
top:0px;
|
||||
left:18%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
background:transparent;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.content-div {
|
||||
position:relative;
|
||||
vertical-align: top;
|
||||
height: 100%;
|
||||
width: 30%;
|
||||
left: 31.2%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color:transparent;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
.post-placeholder {
|
||||
vertical-align: top;
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.post-div {
|
||||
vertical-align: top;
|
||||
height: 300px;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.new-post-div {
|
||||
vertical-align: top;
|
||||
height: 300px;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.page-table {
|
||||
top:0px;
|
||||
left:18%;
|
||||
width: 64%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
background:transparent;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.left-column {
|
||||
position:relative;
|
||||
top:0px;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.middle-column {
|
||||
position:relative;
|
||||
top:0px;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.right-column {
|
||||
position:relative;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.left-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.logo-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.menu-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.profile-cell {
|
||||
vertical-align: bottom;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.middle-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.content-title-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.content-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.right-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.search-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.context-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
background:transparent;
|
||||
}
|
||||
|
||||
.menu-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 65%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.menu-item-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.who-to-follow-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 30%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.profile-to-follow-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 30%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.profile-to-follow-span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.profile-to-follow-button {
|
||||
float: right;
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.profile-to-unfollow-span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.profile-to-unfollow-button {
|
||||
float: right;
|
||||
background-color: red;
|
||||
}
|
||||
+129
-17
@@ -6,8 +6,8 @@
|
||||
<meta name="description" content="Free and Open Source Crypto Social Trading">
|
||||
<link rel="stylesheet" href="main.css" type="text/css" charset="utf-8" />
|
||||
<link rel="shortcut icon" type="image/png/ico" href="Images/favicon.ico" />
|
||||
<script type="text/javascript" src="WebServer/require.js"></script>
|
||||
<script type="text/javascript" src="AppPreLoader.js"></script>
|
||||
<script type="text/javascript" src="Require.js"></script>
|
||||
<script type="text/javascript" src="WebAppPreLoader.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function loadApp() {
|
||||
@@ -28,25 +28,137 @@
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
try {
|
||||
if (page === undefined) { return }
|
||||
if (page.eventHandler === undefined) { return }
|
||||
if (DISABLE_BROWSER_RESIZE_EVENT === true) { return }
|
||||
page.eventHandler.raiseEvent('Browser Resized')
|
||||
} catch (err) {
|
||||
console.log('Error Resizing. ' + err.stack)
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="body" onload="loadApp()"
|
||||
onresize="onResize()">
|
||||
Hello World!
|
||||
<div id="masterApp"></div>
|
||||
<div id="canvasApp"></div>
|
||||
|
||||
<body id="body" onload="loadApp()" onresize="onResize()" class="body">
|
||||
|
||||
<div id="scroll-div" class="scroll-div">
|
||||
<div id="static-div" class="static-div">
|
||||
<table id="page-table" class="page-table">
|
||||
<tr>
|
||||
<td class="left-column">
|
||||
<table class="left-table">
|
||||
<tr>
|
||||
<td class="logo-cell">LOGO</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-cell">
|
||||
<table class="menu-table">
|
||||
<tr>
|
||||
<td class="menu-item-cell">Home</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Explore</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Notifications</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Messages</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Bookmarks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Lists</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Profile</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">More</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Post</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="profile-cell">PROFILE</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="middle-column">
|
||||
<table class="middle-table">
|
||||
<tr>
|
||||
<td class="content-title-cell">CONTENT TITLE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-cell">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="right-column">
|
||||
<table class="right-table">
|
||||
<tr>
|
||||
<td class="search-cell">SEARCH</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="context-cell">
|
||||
<table class="context-table">
|
||||
<tr>
|
||||
<td>Who to follow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="who-to-follow-cell">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Show more</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>>
|
||||
<div id="content-div" class="content-div">
|
||||
<div id="post-placeholder" class="post-placeholder">
|
||||
Placeholder
|
||||
</div>
|
||||
<div id="new-post-div" class="new-post-div">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Profile Pic</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<textarea id="new-post-text-area">Type your post here...</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Permissions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tool Bar <button name="New Post">POST</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 2
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 3
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 4
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 5
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,68 +0,0 @@
|
||||
exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
/*
|
||||
This module represent the HTTP API of the
|
||||
Desktop App. All HTTP request are processed
|
||||
by this module.
|
||||
*/
|
||||
let thisObject = {
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
/*
|
||||
We will create an HTTP Server and leave it running forever.
|
||||
*/
|
||||
SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.DESKTOP_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.DESKTOP_HTTP_INTERFACE_PORT)
|
||||
}
|
||||
}
|
||||
|
||||
function onHttpRequest(httpRequest, httpResponse) {
|
||||
try {
|
||||
let requestPathAndParameters = httpRequest.url.split('?') // Remove version information
|
||||
let requestPath = requestPathAndParameters[0].split('/')
|
||||
let endpointOrFile = requestPath[1]
|
||||
|
||||
switch (endpointOrFile) {
|
||||
case 'Images': // This means the Images folder.
|
||||
{
|
||||
let path = global.env.PATH_TO_CLIENT + '/WebServer/Images/' + requestPath[2]
|
||||
|
||||
if (requestPath[3] !== undefined) {
|
||||
path = path + '/' + requestPath[3]
|
||||
}
|
||||
|
||||
if (requestPath[4] !== undefined) {
|
||||
path = path + '/' + requestPath[4]
|
||||
}
|
||||
|
||||
if (requestPath[5] !== undefined) {
|
||||
path = path + '/' + requestPath[5]
|
||||
}
|
||||
|
||||
path = unescape(path)
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
|
||||
}
|
||||
break
|
||||
default:
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_DESKTOP)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
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 accessible everywhere at the Superalgos Desktop App.
|
||||
It provides access to all modules built for this App.
|
||||
*/
|
||||
global.DK = {}
|
||||
/*
|
||||
The SA object is accessible 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(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')
|
||||
}
|
||||
/*
|
||||
Setting up Secrets.
|
||||
*/
|
||||
SA.secrets = {
|
||||
array: require('./My-Secrets/Secrets.json').secrets,
|
||||
map: new Map()
|
||||
}
|
||||
for (let i = 0; i < SA.secrets.array.length; i++) {
|
||||
let secret = SA.secrets.array[i]
|
||||
SA.secrets.map.set (secret.signingAccountChildCodeName, secret)
|
||||
}
|
||||
|
||||
run()
|
||||
|
||||
async function run() {
|
||||
DK.app = require('./Desktop/DesktopApp.js').newDesktopApp()
|
||||
await DK.app.run()
|
||||
console.log('Superalgos Desktop App is Running!')
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-20
@@ -1,25 +1,16 @@
|
||||
FROM python:3-slim
|
||||
ENV NODE_VERSION=node_16.x
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y curl gnupg lsb-release build-essential \
|
||||
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
|
||||
&& DISTRO="$(lsb_release -s -c)" \
|
||||
&& echo "deb https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list \
|
||||
&& echo "deb-src https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y nodejs \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
FROM node:16-alpine
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN mkdir -p Data-Storage Log-Files My-Workspaces \
|
||||
&& groupadd superalgos \
|
||||
&& useradd --no-log-init -m -g superalgos superalgos \
|
||||
&& chown -R superalgos:superalgos /app
|
||||
RUN apk add --no-cache --virtual .build-deps make g++ \
|
||||
&& apk add --no-cache python3 \
|
||||
&& if [ "$(uname -m)" = "x86_64" ]; then node setup noShortcuts tensorflow; else node setup noShortcuts; fi \
|
||||
&& mkdir -p ./Platform/My-Data-Storage ./Platform/My-Log-Files ./Platform/My-Workspaces \
|
||||
&& addgroup superalgos \
|
||||
&& adduser --disabled-password --no-create-home --ingroup superalgos superalgos \
|
||||
&& chown -R superalgos:superalgos /app \
|
||||
&& apk del .build-deps
|
||||
USER superalgos
|
||||
RUN node setup noShortcuts
|
||||
EXPOSE 34248
|
||||
EXPOSE 18041
|
||||
VOLUME ["/app/Data-Storage", "/app/Log-Files", "/app/My-Workspaces"]
|
||||
ENTRYPOINT ["node", "run", "noBrowser"]
|
||||
VOLUME ["/app/Platform/My-Data-Storage", "/app/Platform/My-Log-Files", "/app/Platform/My-Workspaces"]
|
||||
ENTRYPOINT ["node", "platform", "noBrowser"]
|
||||
@@ -0,0 +1,273 @@
|
||||
# Superalgos Docker Guide
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Introduction](#introduction)
|
||||
- [Installation](#installation)
|
||||
- [Mac OS](#mac-os)
|
||||
- [Windows](#windows)
|
||||
- [Linux and BSD](#linux-and-bsd)
|
||||
- [Running Superalgos](#running-superalgos)
|
||||
- [Using Docker-Compose](#using-docker-compose)
|
||||
- [Docker Best Practices](#docker-best-practices)
|
||||
- [Docker Development Best Practices](#docker-development-best-practices)
|
||||
- [Dockerfile Best Practices](#dockerfile-best-practices)
|
||||
- [Twelve Factor App](#twelve-factor-app)
|
||||
|
||||
## Introduction
|
||||
|
||||
This walkthrough is broken up into to parts: a quick-start guide to running [Superalgos](https://github.com/Superalgos/Superalgos) with Docker and a deeper, more theoretical dive into containers with the hopes of explaining some of the design decisions.
|
||||
|
||||
[Superalgos](https://github.com/Superalgos/Superalgos), at its core, is a web application which also means it can be deployed inside a container like many other web applications. One of the leading platforms for operating containers is Docker. Docker can run on many different operatng systems and compute platforms. The containers provide an easy, fast, repeatable, and secure way to deploy and distribute applications. While it doesn't take much experience to run containers or Docker, there are some basics that any user should learn in order to use the technology effectively.
|
||||
|
||||
Before getting started, be aware that Docker is not the originally intended method of running the [Superalgos](https://github.com/Superalgos/Superalgos) application and as such there are some drawbacks to doing so. Namely, you won't be able contribute back to the project or configure your Governance profile. We'll discuss this more later. Therefore, you should only consider using the Docker container for production deployments.
|
||||
|
||||
It is also worth noting that [Superalgos](https://github.com/Superalgos/Superalgos) is very resource intense so it is best to get acquainted with the software by running it on a fast computer with a good amount of RAM as opposed to a tiny, slow Raspberry Pi. But, once you are ready to run a production deployment, then a more economical server is preferred.
|
||||
|
||||
Docker container images are hosted on `ghcr`. You can browse the containers in the [Packages section of the code repository](https://github.com/users/Superalgos/packages/container/package/superalgos).
|
||||
|
||||
> **Note:** The container and the application are still under heavy development and testing. Please join the [Superalgos SysAdmins Group](https://t.me/superalgossysadmins) to discuss any issues you may run into.
|
||||
|
||||
## Installation
|
||||
|
||||
First, Docker Desktop needs to be installed on a Mac or Windows computer in order to run the containers. Linux and BSD users will need Docker Engine. Docker-compose is also recommended and it should be included with Docker Desktop, but it may need to be installed separately.
|
||||
|
||||
### Mac OS
|
||||
|
||||
Docker can be downloaded from the Docker Store following the [directions in the official Docker Docs](https://docs.docker.com/desktop/mac/install/). It can also be installed from the command line using Homebrew.
|
||||
|
||||
```shell
|
||||
brew cask install docker
|
||||
brew install docker-compose
|
||||
```
|
||||
|
||||
Then, make sure Docker Desktop is running. An easy way to check is to push `Cmd + space` then type `docker.app` in the search bar. You should also see the little whale icon in the top menu bar near the clock.
|
||||
|
||||
### Windows
|
||||
|
||||
Windows requires a few more steps than Mac OS, but it can also be downloaded from the Docker Store following the [directions in the official Docker Docs](https://docs.docker.com/desktop/windows/install/). It can also be installed from the command line using Chocolatey.
|
||||
|
||||
```shell
|
||||
choco install docker-desktop
|
||||
```
|
||||
|
||||
Docker should automatically start after installation. If you don't see the whale icon in the tray by the clock, then find `Docker` in the start menu.
|
||||
|
||||
### Linux and BSD
|
||||
|
||||
On Linux and BSD systems, Docker can be installed using the prefered package manager. [Step by step instructions for many different distributions](https://docs.docker.com/engine/install/debian/) of Linux can be found in the official Docker Docs. Since [Superalgos](https://github.com/Superalgos/Superalgos) runs well on Raspberry Pi 4 single-board computers, I'm going to illustrate the commands necessary to run [Superalgos](https://github.com/Superalgos/Superalgos) on the Raspbian Linux distribution.
|
||||
|
||||
```shell
|
||||
# install the requirements
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release
|
||||
|
||||
# add the gpg keys to verify the packages
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
|
||||
# confgure the official repository
|
||||
echo \
|
||||
"deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
# install docker engine
|
||||
sudo apt-get update
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose
|
||||
```
|
||||
|
||||
Docker should automatically start when it is done installing. You can check its status with `systemctl status docker`. To make things easier, ensure your user is added to the `docker` group. Type `id` at the command prompt and you should see something like `groups=...999(docker)`. If you don't see it listed, you can add yourself with `sudo usermod -a -G docker <username>`.
|
||||
|
||||
## Running Superalgos
|
||||
|
||||
Now that we have Docker installed and running, we can run the container. The option `--rm` will remove the isntance of the container when it is exited.
|
||||
|
||||
```shell
|
||||
docker run --rm ghcr.io/superalgos/superalgos:latest
|
||||
```
|
||||
|
||||
You'll see some messages showing the container being downloaded and then some messages from the application itself showing that it is starting up and ready to accept connections. We'll stop the container now and add in a few more options so make it more useful, so press `ctrl + c` to exit.
|
||||
|
||||
We'll need to expose some ports so we can actually connect to it from our browser. Also, we'll want to create a few directories on our host file system so we can save, or persist, data between container reboots.
|
||||
|
||||
- `-d` to run the container daemonized, in the background
|
||||
- `-p` to map ports to the host system to allow connections
|
||||
- `-v` to mount local directories inside the container to persist data
|
||||
- `--name` to assign a name to the container for easier reference
|
||||
|
||||
```shell
|
||||
# create the data directories
|
||||
mkdir -p Data-Storage Log-Files My-Workspaces
|
||||
|
||||
# run the container with the extra options
|
||||
docker run \
|
||||
-d \
|
||||
--rm \
|
||||
--name superalgos \
|
||||
--user $(id -u):$(id -g) \
|
||||
-p 18041:18041 \
|
||||
-p 34248:34248 \
|
||||
-v $(pwd)/Data-Storage:/app/Platform/Data-Storage \
|
||||
-v $(pwd)/Log-Files:/app/Platform/Log-Files \
|
||||
-v $(pwd)/My-Workspaces:/app/Platform/My-Workspaces \
|
||||
ghcr.io/superalgos/superalgos:latest
|
||||
```
|
||||
|
||||
You can check the status of the container with `docker ps -a` and view the logs with `docker logs superalgos`.
|
||||
|
||||
Note that you will see one error in the log output informing you that `git` is not installed. This is intentional and is not required for the bot to function properly.
|
||||
|
||||
Now you can open your browser and load the application front end. Try loading `http://localhost:34248` if you are on the same computer that is running the container, otherwise use the host ip, for example `http://192.168.1.10:34248`.
|
||||
|
||||
If you want to stop the container, you can run `docker stop superalgos`. When you want to upgrade the container, use:
|
||||
|
||||
```shell
|
||||
docker pull ghcr.io/superalgos/superalgos:latest
|
||||
docker stop superalgos
|
||||
docker run \
|
||||
-d \
|
||||
--rm \
|
||||
--name superalgos \
|
||||
--user $(id -u):$(id -g) \
|
||||
-p 18041:18041 \
|
||||
-p 34248:34248 \
|
||||
-v $(pwd)/Data-Storage:/app/Platform/Data-Storage \
|
||||
-v $(pwd)/Log-Files:/app/Platform/Log-Files \
|
||||
-v $(pwd)/My-Workspaces:/app/Platform/My-Workspaces \
|
||||
ghcr.io/superalgos/superalgos:latest
|
||||
```
|
||||
|
||||
Let's stop the container for now (`docker stop superalgos`) and we'll run it again using `docker-compose`.
|
||||
|
||||
Continue reading the [Docker Command Line documentation](https://docs.docker.com/engine/reference/commandline/cli/) for more details.
|
||||
|
||||
### Using Docker-Compose
|
||||
|
||||
Docker-compose is a wrapper for the Docker API which makes it a little easier to maintain a declaritive configuration for an application instead of using the direct command line commands. There is a sample docker-compose configuration included in the [Superalgos](https://github.com/Superalgos/Superalgos) which you can as the basis for your own configuration.
|
||||
|
||||
Let's download the sample and edit it. If you don't use `vim`, change that command for your preferred editor.
|
||||
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/Superalgos/Superalgos/master/Docker/docker-compose.yml
|
||||
vim docker-compose.yml
|
||||
```
|
||||
|
||||
Now, let's change some of the settings:
|
||||
|
||||
```yaml
|
||||
version: "3"
|
||||
services:
|
||||
superalgos:
|
||||
image: ghcr.io/superalgos/superalgos:latest
|
||||
command: ["minMemo"]
|
||||
user: "$UID:$GID"
|
||||
ports:
|
||||
- '34248:34248'
|
||||
- '18041:18041'
|
||||
volumes:
|
||||
- ./Data-Storage:/app/Platform/Data-Storage
|
||||
- ./Log-Files:/app/Platform/Log-Files
|
||||
- ./My-Workspaces:/app/Platform/My-Workspaces
|
||||
restart: on-failure
|
||||
```
|
||||
|
||||
You can see we have the same ports and volumes mapped. We also get a few extra settings like `command`, `environment`, and `restart`.
|
||||
|
||||
- `command` adds an extra setting to the main startup, so the application ends up running with the full command `node platform noBrowser minMemo`. The base of that command is defined as the `ENTRYPOINT` in the `Dockerfile` that builds the container.
|
||||
- `user` defines the UID and GID the container should run as so that the data can be persisted with the correct permissions in the Data-Storage, Log-Files, and My-Workspaces directories that we created on the host. If you leave this out, the container will use the built in `superalgos` user which has `uid: 1001` and `gid: 1001`. Instead of using variables, you could also hard-code these UID and GID numbers into the configuration.
|
||||
- `restart` tells Docker to restart the container if an error occurs.
|
||||
|
||||
Save the file and exit the editor. If you are using `vim`, hit escape and then type `:wq!` or press `shift + Z + Z` (two capital Z's).
|
||||
|
||||
Now, start the container with `docker-compose up`. This will start the container in the foreground and you'll connect to the log output. Hit `ctrl + c` to exit. Going forward, you'll want to add the `-d` option to start the container and keep it running in the background.
|
||||
|
||||
```shell
|
||||
# some preliminary configuration to set up the persistent data directories
|
||||
mkdir -p Data-Storage Log-Files My-Workspaces
|
||||
export UID=$(id -u)
|
||||
export GID=$(id -g)
|
||||
|
||||
# run the container in the background
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
Now you have several `docker-compose` commands at your disposal to interact with the container:
|
||||
|
||||
- `docker-compose ps` to see details of the container
|
||||
- `docker-compose logs` to see the logs
|
||||
- `docker-compose down` to stop and remove the instance of the container
|
||||
- `docker-compose pull` to pull the container, or a new version of the `latest` tag
|
||||
|
||||
Putting some of those concepts together, you can keep the running container up to date with this one-liner:
|
||||
|
||||
```shell
|
||||
docker-compose pull && docker-compose down && docker-compose up -d
|
||||
```
|
||||
|
||||
Explore the full [Docker Compose documentation](https://docs.docker.com/compose/) for more information.
|
||||
|
||||
## Docker Best Practices
|
||||
|
||||
As with any technology, there are lots of ways of doing things. A lot of them will give the same end result, but some may have fewer steps, or be more secure, or be more maintainable. That is where "best practices" come in. They aren't there to necessarily tell you what to do and what not to do, but they are there to help guide you in the right direction. A lot of times, they help you avoid making architectural mistakes that could come back and bite you further down the road.
|
||||
|
||||
One general best practice when running a production deployment is to avoid breaking changes by pinning to specific container tags. The `shasum hash` and the `release` tags are the best to use. These will generally ensure you are always running the same code and it will only upgrade when configured to do so. The other tags will change which code they are pointing to more frequently and without notice.
|
||||
|
||||
- `latest` : the absolute latest build
|
||||
- `master` : the latest master branch build
|
||||
- `develop` : the latest develop branch build
|
||||
- `<shasum hash>` : a specific git commit hash
|
||||
- `<release>` : corresponds with a Github Release (git tag), i.e. `beta-10`
|
||||
|
||||
## Docker Development Best Practices
|
||||
|
||||
Docker has many advantages which can aid in every step from development through production deployment. There are some useful tips located directly in the [Docker documentation](https://docs.docker.com/develop/dev-best-practices/). Concisely, they are to keep the build images small, a few tips on when and how to persist data, and to use CI/CD for testing and deployment. All of these tips are used in one way or another as a part of the [Superalgos](https://github.com/Superalgos/Superalgos) project.
|
||||
|
||||
- Use a minimal base image and multi-stage build. Superalgos is currently using an [alpine](https://www.alpinelinux.org/) base image but [distroless](https://github.com/GoogleContainerTools/distroless) is becoming more common and some times using a base image like [python-slim](https://hub.docker.com/_/python) is the bast that can be achieved.
|
||||
- The images are quite large (around 2 GB in size), unfortunately, because the codebase itself is large. We've recently put in a lot of effort to make these images as small as possible.
|
||||
- The images are built automatically using Github Actions when pull requests are merged.
|
||||
- With the correct configuration, data, like data mine and trading bot information, is persisted to the host using volume mounts
|
||||
|
||||
### Dockerfile Best Practices
|
||||
|
||||
Docker maintains a list of [Dockerfile best practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) in their main documentation. These tips dictate many of the decisions around the Superalgos Dockerfile. Some of the tips that are used by [Superalgos](https://github.com/Superalgos/Superalgos) are listed below.
|
||||
|
||||
- Use `.dockerignore` to prevent unwanted data from entering the container. This keeps the container small but also enhances security to prevent secrets from leaking into a container by accident.
|
||||
- Don't install unneccesary packages. In lieu of multi-stage builds, build caches and build dependencies are removed before finalizing the container. Only packages that are necessary for the execution of the application are installed. This is why `git` is not present.
|
||||
- Minimize the number of layers. Many `RUN` commands are combined into one using `&&` in order to reduce the number of layers.
|
||||
- Sort multiline arguments. This mostly enhances readability and maintainability.
|
||||
- Leverage build cache. When testing locally, several of the tips above help levarage the build cache and speed up build times.
|
||||
|
||||
### Twelve Factor App
|
||||
|
||||
[Superalgos](https://github.com/Superalgos/Superalgos) is a web app but it was originally designed to be run on a local workstation or server on a trusted network. However, I don't think it would be prudent to talk about Docker best practices without mentioning the [Twelve Factor App](https://12factor.net/) manifesto. Over time, [Superalgos](https://github.com/Superalgos/Superalgos) itself may iterate and implement more and more of these principles as more people get involved and more people deploy production environments.
|
||||
|
||||
The Twelve Factors:
|
||||
|
||||
- Codebase: One codebase tracked in revision control, many deploys
|
||||
- Superalgos utilizes one GitHub repository
|
||||
- Dependencies: Explicitly declare and isolate dependencies
|
||||
- Superalgos is a node.js app and uses npm to track and install dependencies
|
||||
- Config: Store config in the environment
|
||||
- Superalgos does not use environment variables the moment for configuration. Options are passed on the command line at run time. Other configuration is hard coded into the Workspaces.
|
||||
- Backing services: Treat backing services as attached resources
|
||||
- Superalgos connects to external services via API calls over HTTP (TCP)
|
||||
- Build, release, run: Strictly separate build and run stages
|
||||
- Superalgos is deployed by end users in their own local environments
|
||||
- Processes: Execute the app as one or more stateless processes
|
||||
- Superalgos is one application
|
||||
- Port binding: Export services via port binding
|
||||
- Superalgos exposes an HTTP frontend port and a Websockets backend port (TCP)
|
||||
- Concurrency: Scale out via the process model
|
||||
- Superalgos can be clustered but the front end and backend do not necessarily scale out independently from each other
|
||||
- Disposability: Maximize robustness with fast startup and graceful shutdown
|
||||
- Superalgos is not stateless in that the data files must be persisted to disk. Also, Superalgos cannot run behind a load balancer and have requests randomly distributed to different backend servers.
|
||||
- Dev/prod parity: Keep development, staging, and production as similar as possible
|
||||
- Superalgos doesn't have its own production environment but the container makes it easy to ensure development environments are the same as what a user will see when they deploy it for themselves in their own production environment.
|
||||
- Logs: Treat logs as event streams
|
||||
- Superalgos sends its own application logs to standard out. The trading mine logs are sent to flat files (persisted through volume mounts)
|
||||
- Admin processes: Run admin/management tasks as one-off processes
|
||||
- Superalgos does not have any admin or management tasks outside of what is used to create the container at build time.
|
||||
@@ -6,14 +6,12 @@ services:
|
||||
dockerfile: ./Docker/Dockerfile
|
||||
image: ghcr.io/superalgos/superalgos:latest
|
||||
command: ["minMemo"]
|
||||
user: "$UID:$GID"
|
||||
ports:
|
||||
- '34248:34248'
|
||||
- '18041:18041'
|
||||
volumes:
|
||||
- ../Data-Storage:/app/Data-Storage
|
||||
- ../Log-Files:/app/Log-Files
|
||||
- ../My-Workspaces:/app/My-Workspaces
|
||||
environment:
|
||||
PUID: '1000'
|
||||
PGID: '1000'
|
||||
- ../Platform/My-Data-Storage:/app/Platform/My-Data-Storage
|
||||
- ../Platform/My-Log-Files:/app/Platform/My-Log-Files
|
||||
- ../Platform/My-Workspaces:/app/Platform/My-Workspaces
|
||||
restart: on-failure
|
||||
+36
-12
@@ -1,19 +1,43 @@
|
||||
const path = require("path")
|
||||
|
||||
if (process.env.PACKAGED_PATH) {
|
||||
basePath = process.env.PACKAGED_PATH
|
||||
} else {
|
||||
basePath = __dirname
|
||||
}
|
||||
exports.newEnvironment = function () {
|
||||
|
||||
let thisObject = {
|
||||
DEMO_MODE: false,
|
||||
BASE_PATH: basePath,
|
||||
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_CLIENT: './Platform',
|
||||
PATH_TO_DEFAULT_WORKSPACE: './Projects/Foundations/Plugins/Workspaces',
|
||||
PATH_TO_MY_WORKSPACES: './My-Workspaces',
|
||||
PATH_TO_FONTS: './Platform/WebServer/Fonts'
|
||||
PLATFORM_WEB_SOCKETS_INTERFACE_PORT: 18041,
|
||||
NETWORK_WEB_SOCKETS_INTERFACE_PORT: 18042,
|
||||
DESKTOP_WEB_SOCKETS_INTERFACE_PORT: 18043,
|
||||
DESKTOP_WEB_SOCKETS_INTERFACE_HOST: 'localhost',
|
||||
PLATFORM_HTTP_INTERFACE_PORT: 34248,
|
||||
DESKTOP_HTTP_INTERFACE_PORT: 34249,
|
||||
PATH_TO_DATA_STORAGE: path.join(basePath, './Platform/My-Data-Storage'),
|
||||
PATH_TO_PROJECTS: path.join(basePath, './Projects'),
|
||||
PATH_TO_LOG_FILES: path.join(basePath, './Platform/My-Log-Files'),
|
||||
PATH_TO_PROJECTS_REQUIRED: path.join(basePath, './Projects'),
|
||||
PATH_TO_PROJECT_SCHEMA: path.join(basePath, './Projects/ProjectsSchema.json'),
|
||||
PATH_TO_PLATFORM: path.join(basePath, './Platform'),
|
||||
PATH_TO_DESKTOP: './Desktop',
|
||||
PATH_TO_DEFAULT_WORKSPACE: path.join(basePath, './Projects/Foundations/Plugins/Workspaces'),
|
||||
PATH_TO_MY_WORKSPACES: path.join(basePath, './Platform/My-Workspaces'),
|
||||
PATH_TO_FONTS: path.join(basePath, './Platform/WebServer/Fonts'),
|
||||
DESKTOP_APP_SIGNING_ACCOUNT: 'Social-Trading-Desktop-App-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',
|
||||
P2P_NETWORK_NODE_SIGNING_ACCOUNT: 'P2P-Network-Node-1',
|
||||
}
|
||||
|
||||
if (process.env.DATA_PATH) {
|
||||
thisObject.PATH_TO_DATA_STORAGE = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Data-Storage')
|
||||
thisObject.PATH_TO_LOG_FILES = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Log-Files')
|
||||
thisObject.PATH_TO_MY_WORKSPACES = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Workspaces')
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
exports.newEnvironment = function () {
|
||||
|
||||
let thisObject = {
|
||||
WEB_SERVER_URL: 'localhost',
|
||||
CLIENT_WEB_SOCKETS_INTERFACE_PORT: 18041,
|
||||
NETWORK_WEB_SOCKETS_INTERFACE_PORT: 18042,
|
||||
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',
|
||||
PATH_TO_PROJECTS_REQUIRED: './Projects',
|
||||
PATH_TO_PROJECT_SCHEMA: './Projects/ProjectsSchema.json',
|
||||
PATH_TO_CLIENT: './Platform',
|
||||
PATH_TO_DESKTOP: './Desktop',
|
||||
PATH_TO_DEFAULT_WORKSPACE: './Projects/Foundations/Plugins/Workspaces',
|
||||
PATH_TO_MY_WORKSPACES: './My-Workspaces',
|
||||
PATH_TO_FONTS: './Platform/WebServer/Fonts'
|
||||
}
|
||||
|
||||
return thisObject
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
cd ..
|
||||
node run
|
||||
node platform
|
||||
"$SHELL"
|
||||
@@ -1,3 +1,3 @@
|
||||
cd /d %~dp0
|
||||
cd ..
|
||||
cmd /k "node run"
|
||||
cmd /k "node platform"
|
||||
+1
-1
@@ -65,7 +65,7 @@ exports.newMultiProject = function () {
|
||||
}
|
||||
|
||||
/*
|
||||
From here we will require and get the modules, but without instantiation thisObject.
|
||||
From here we will require and get the modules, but without instantiating thisObject.
|
||||
*/
|
||||
|
||||
/* Set up Modules for this Project */
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "C:\\Superalgos\\Network"
|
||||
},
|
||||
{
|
||||
"path": "C:\\Superalgos\\Projects\\Network"
|
||||
},
|
||||
{
|
||||
"path": "C:\\Superalgos\\Projects\\Social-Trading"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/Data-Storage": true,
|
||||
"**/Documentation": true,
|
||||
"**/Log-Files": true,
|
||||
"**/node_modules": true,
|
||||
"**/Deprecated-Code": true
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/Data-Storage": true,
|
||||
"**/Documentation": true,
|
||||
"**/Log-Files": true,
|
||||
"**/node_modules": true,
|
||||
"**/Deprecated-Code": true
|
||||
},
|
||||
"search.maintainFileSearchCache": true
|
||||
}
|
||||
+14
-10
@@ -1,24 +1,28 @@
|
||||
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
|
||||
Other Network Nodes and Client Apps will communicate with this Network Node via it's Websocket Interface.
|
||||
*/
|
||||
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()
|
||||
}
|
||||
|
||||
/*
|
||||
The Social Graph Service is the first and for now, the only service this Network Node provides.
|
||||
*/
|
||||
thisObject.socialGraphService = NT.projects.socialTrading.modules.socialGraph.newNetworkModulesSocialGraph()
|
||||
await thisObject.socialGraphService.initialize()
|
||||
/*
|
||||
The Sotrage deals with persisting the Social Graph.
|
||||
*/
|
||||
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 accessible everywhere at the Superalgos Network.
|
||||
It provides access to all modules built for this Network.
|
||||
*/
|
||||
global.NT = {}
|
||||
/*
|
||||
The SA object is accessible everywhere at the Superalgos Network.
|
||||
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(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')
|
||||
}
|
||||
/*
|
||||
Setting up Secrets.
|
||||
*/
|
||||
SA.secrets = {
|
||||
array: require('./My-Secrets/Secrets.json').secrets,
|
||||
map: new Map()
|
||||
}
|
||||
for (let i = 0; i < SA.secrets.array.length; i++) {
|
||||
let secret = SA.secrets.array[i]
|
||||
SA.secrets.map.set(secret.signingAccountChildCodeName, secret)
|
||||
}
|
||||
|
||||
NT.app = require('./Network/NetwokNode.js').newNetworkNode()
|
||||
NT.app.run()
|
||||
|
||||
console.log('Superalgos Network is Running.')
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
exports.newEventServer = function newEventServer() {
|
||||
|
||||
const MODULE = "Events Server"
|
||||
const LOG_INFO = false
|
||||
|
||||
let thisObject = {
|
||||
initialize: initialize,
|
||||
finalize: finalize,
|
||||
@@ -37,7 +34,7 @@
|
||||
if (eventHandler === undefined) {
|
||||
/*
|
||||
We will only create event handlers which were not created before. Remember that someone trying to listen events
|
||||
at an event handler that does not exist, will create that eventhandler, so it is possible that the emitter
|
||||
at an event handler that does not exist, will create that event handler, so it is possible that the emitter
|
||||
when trying to create the event handler in fact was late and the event handler is already there if the listener
|
||||
arrived here first. An event handler created with this method is not destroyed if there are no listeners or they
|
||||
all leave.
|
||||
@@ -53,8 +50,8 @@
|
||||
let eventHandler = eventHandlers.get(command.eventHandlerName)
|
||||
if (eventHandler !== undefined) {
|
||||
/*
|
||||
We will only delete event handlers which have noone listening, allowing a listener to continue listening even
|
||||
when the event emitter is gone, asuming that it could come back at some point in time and resume emitting.
|
||||
We will only delete event handlers which have no one listening, allowing a listener to continue listening even
|
||||
when the event emitter is gone, assuming that it could come back at some point in time and resume emitting.
|
||||
*/
|
||||
if (eventHandler.listeners.length === 0) {
|
||||
eventHandlers.delete(command.eventHandlerName)
|
||||
@@ -71,8 +68,8 @@
|
||||
if (eventHandler === undefined) {
|
||||
/*
|
||||
We will create event handlers which were not created before if a listener tries to listen to a handler that does not
|
||||
exist before the emitter comes and create it. This is to aviod syncronization problems and also problems with emitters life
|
||||
cycles with higher frecuency that the ones of listeners. Created in this way, event handlers are marked for deletion if
|
||||
exist before the emitter comes and create it. This is to avoid synchronization problems and also problems with emitters life
|
||||
cycles with higher frequency that the ones of listeners. Created in this way, event handlers are marked for deletion if
|
||||
all listeners stop listening at one point in time.
|
||||
*/
|
||||
eventHandler = newEventHandler()
|
||||
@@ -107,7 +104,7 @@
|
||||
|
||||
if (eventHandler === undefined) {
|
||||
|
||||
/* If the event handler does not exist anymore, then there is no need to perform further actiions. */
|
||||
/* If the event handler does not exist anymore, then there is no need to perform further actions. */
|
||||
sendResponse(global.DEFAULT_OK_RESPONSE)
|
||||
return
|
||||
}
|
||||
@@ -115,7 +112,7 @@
|
||||
eventHandler.stopListening(command.eventHandlerName, command.eventType, command.callerId, command.eventSubscriptionId)
|
||||
|
||||
/*
|
||||
We check here if there are no more listeners and the event handler original emmiter is also gone, then we need to delete
|
||||
We check here if there are no more listeners and the event handler original emitter is also gone, then we need to delete
|
||||
this event handlers since chances are that is not needed anymore.
|
||||
*/
|
||||
if (eventHandler.listeners.length === 0 && eventHandler.deleteWhenAllListenersAreGone === true) {
|
||||
@@ -133,7 +130,7 @@
|
||||
eventHandler = newEventHandler()
|
||||
eventHandlers.set(command.eventHandlerName, eventHandler)
|
||||
|
||||
/* No matter if it is the listener or the emiter the one that acts first, if an event handler does not exist we just create it acan keep it there. */
|
||||
/* No matter if it is the listener or the emitter the one that acts first, if an event handler does not exist we just create it and keep it there. */
|
||||
|
||||
}
|
||||
//console.log("[INFO] Client -> Events Server -> Raising Event " + command.eventHandlerName + " " + command.eventType)
|
||||
@@ -166,7 +163,7 @@
|
||||
let thisObject = {
|
||||
name: undefined, // This is for debugging purposes only.
|
||||
deleteWhenAllListenersAreGone: false,
|
||||
listeners: [], // Here we store all the functions we will call when an event is raiseed.
|
||||
listeners: [], // Here we store all the functions we will call when an event is raised.
|
||||
listenToEvent: listenToEvent,
|
||||
stopListening: stopListening,
|
||||
raiseEvent: raiseEvent,
|
||||
@@ -184,7 +181,7 @@
|
||||
|
||||
/*
|
||||
We can not allow to have the exact same listener more than once. In case that we find a listener trying to listen again, the first record will
|
||||
be deleted and we are just going to consider the last one comming in.
|
||||
be deleted and we are just going to consider the last one coming in.
|
||||
*/
|
||||
for (let i = 0; i < thisObject.listeners.length; i++) {
|
||||
if (eventHandlerName === thisObject.listeners[i][0] && eventType === thisObject.listeners[i][1] && callerId === thisObject.listeners[i][2]) {
|
||||
|
||||
+154
-46
@@ -75,11 +75,11 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
async function doGithub() {
|
||||
|
||||
const { Octokit } = require("@octokit/rest")
|
||||
const { Octokit } = SA.nodeModules.octokit
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: token,
|
||||
userAgent: 'Superalgos Beta 11'
|
||||
userAgent: 'Superalgos Beta 12'
|
||||
})
|
||||
await getList()
|
||||
|
||||
@@ -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,10 +204,10 @@ 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'
|
||||
userAgent: 'Superalgos Beta 12'
|
||||
})
|
||||
await getPrList()
|
||||
await mergePrs()
|
||||
@@ -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,
|
||||
@@ -295,26 +295,28 @@ exports.newGithubServer = function newGithubServer() {
|
||||
let fileContent // File content of the only file at the PR
|
||||
let userProfile // User Profile Object
|
||||
let githubUsername // The Github user name of who is submitting the Pull Request
|
||||
let mergeResponse // The response received from the call to Gihub to merge the Pull Request
|
||||
let mergeResponse // The response received from the call to Github to merge the Pull Request
|
||||
|
||||
if (await validatePrHasMoreThanOneFile() === false) { continue }
|
||||
if (await validateFileNameEqualsGithubUsername() === false) { continue }
|
||||
if (await validateFileChangedIsUserProfile() === false) { continue }
|
||||
if (await validateMessageSignedIsGithubUsername() === false) { continue }
|
||||
if (await validateMessageSignedHashIsSignatureHash() === false) { continue }
|
||||
if (await validateUserProfileNodeNameEqualsGithubUsername() === false) { continue }
|
||||
if (await validateUserProfileIdDoesNotBelongtoAnotherUserProfile() === false) { continue }
|
||||
if (await validateUserProfileBlockchainAccountDoesNotBelongtoAnotherUserProfile() === false) { continue }
|
||||
if (await validateUserProfileSigningAccountsDoesNotBelongtoAnotherUserProfile() === false) { continue }
|
||||
|
||||
if (await mergePullRequest() === false) {
|
||||
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)
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Merge Succeed -> Pull Request "' + pullRequest.title + '" successfully merged. -> mergeResponse.message = ' + mergeResponse.data.message)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: pullRequest.number,
|
||||
body: 'This Pull Request was automatically merged by the Superalgos Governance System because it was detected that the Github User " ' + githubUsername + '" who submitted it, modified its own User Profile Plugin File and nothning else but that file. All validations were successfull.'
|
||||
body: 'This Pull Request was automatically merged by the Superalgos Governance System because it was detected that the Github User " ' + githubUsername + '" who submitted it, modified its own User Profile Plugin File and nothing else but that file. All validations were successful.'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -333,15 +335,15 @@ 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,
|
||||
issue_number: pullRequest.number,
|
||||
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.'
|
||||
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. \n\n If you intentionally submitted the extra files, the way to get your work merged is by first removing your User Profile file from the Plugins folder at your local installation and executing an app.contribute again. Then wait until the PR is merged (manually reviewed) and after that you put your User Profile file again and create a new PR only with that file with an app.contribute. That last PR should be merged automatically.'
|
||||
});
|
||||
|
||||
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,
|
||||
@@ -376,10 +378,10 @@ exports.newGithubServer = function newGithubServer() {
|
||||
fileName = splittedFileName[0]
|
||||
githubUsername = pullRequest.user.login
|
||||
|
||||
if (githubUsername !== fileName) {
|
||||
if (githubUsername.toLowerCase() !== fileName.toLowerCase()) {
|
||||
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 +389,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 +404,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') {
|
||||
@@ -418,10 +420,10 @@ exports.newGithubServer = function newGithubServer() {
|
||||
*/
|
||||
let config = JSON.parse(userProfile.config)
|
||||
let messageSigned = config.signature.message
|
||||
if (messageSigned !== githubUsername) {
|
||||
if (messageSigned.toLowerCase() !== githubUsername.toLowerCase()) {
|
||||
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 +431,41 @@ 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,
|
||||
pull_number: pullRequest.number,
|
||||
state: 'closed'
|
||||
});
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function validateMessageSignedHashIsSignatureHash() {
|
||||
/*
|
||||
Validation #5: The message signed has is equal to the signature messageHash.
|
||||
*/
|
||||
let config = JSON.parse(userProfile.config)
|
||||
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.hashData(
|
||||
config.signature.message
|
||||
)
|
||||
let messageSignedHash = serverResponse.hash
|
||||
let signatureHash = config.signature.messageHash
|
||||
|
||||
if (messageSignedHash !== signatureHash) {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #5 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Message Signed Hash is not equal to the the Signature Hash. -> messageSignedHash = ' + messageSignedHash + '-> signatureHash = ' + signatureHash)
|
||||
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: pullRequest.number,
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because the Message Signed Hash is not equal to the the Signature Hash.\n\n messageSignedHash = "' + messageSignedHash + '"\n\n signatureHash = "' + signatureHash + '"'
|
||||
});
|
||||
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@@ -442,12 +478,12 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
async function validateUserProfileNodeNameEqualsGithubUsername() {
|
||||
/*
|
||||
Validation #5: The name of the User Profile node is not the Github Username.
|
||||
Validation #6: The name of the User Profile node is not the Github Username.
|
||||
*/
|
||||
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)
|
||||
if (userProfile.name.toLowerCase() !== githubUsername.toLowerCase()) {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #6 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 +491,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,
|
||||
@@ -468,18 +504,18 @@ exports.newGithubServer = function newGithubServer() {
|
||||
|
||||
async function validateUserProfileIdDoesNotBelongtoAnotherUserProfile() {
|
||||
/*
|
||||
Validation #6: The id of the User Profile can not be the id of an already existing User Profile
|
||||
Validation #7: The id of the User Profile can not be the id of an already existing User Profile
|
||||
unless the existing one belongs to the same Github username.
|
||||
*/
|
||||
let userProfileIdMap = new Map()
|
||||
let pluginFileNames = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
let pluginFileNames = await SA.projects.communityPlugins.utilities.plugins.getPluginFileNames(
|
||||
'Governance',
|
||||
'User-Profiles'
|
||||
)
|
||||
for (let i = 0; i < pluginFileNames.length; i++) {
|
||||
let pluginFileName = pluginFileNames[i]
|
||||
|
||||
let pluginFileContent = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
let pluginFileContent = await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent(
|
||||
'Governance',
|
||||
'User-Profiles',
|
||||
pluginFileName
|
||||
@@ -493,9 +529,9 @@ exports.newGithubServer = function newGithubServer() {
|
||||
if (testUserProfile === undefined) { return true }
|
||||
if (testUserProfile !== userProfile.name) {
|
||||
|
||||
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)
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #7 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 +539,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,
|
||||
@@ -517,18 +553,18 @@ exports.newGithubServer = function newGithubServer() {
|
||||
async function validateUserProfileBlockchainAccountDoesNotBelongtoAnotherUserProfile() {
|
||||
try {
|
||||
/*
|
||||
Validation #7 The blockchain account of the User Profile can not be the
|
||||
Validation #8 The blockchain account of the User Profile can not be the
|
||||
blockchain account of an already existing User Profile
|
||||
unless the existing one belongs to the same Github username.
|
||||
*/
|
||||
let userProfileIdMap = new Map()
|
||||
let pluginFileNames = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
let pluginFileNames = await SA.projects.communityPlugins.utilities.plugins.getPluginFileNames(
|
||||
'Governance',
|
||||
'User-Profiles'
|
||||
)
|
||||
for (let i = 0; i < pluginFileNames.length; i++) {
|
||||
let pluginFileName = pluginFileNames[i]
|
||||
let pluginFileContent = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
let pluginFileContent = await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent(
|
||||
'Governance',
|
||||
'User-Profiles',
|
||||
pluginFileName
|
||||
@@ -538,7 +574,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 +582,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
|
||||
)
|
||||
|
||||
@@ -554,9 +590,9 @@ exports.newGithubServer = function newGithubServer() {
|
||||
if (testUserProfile === undefined) { return true }
|
||||
if (testUserProfile !== userProfile.name) {
|
||||
|
||||
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)
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #8 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 +600,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,
|
||||
@@ -578,11 +614,82 @@ exports.newGithubServer = function newGithubServer() {
|
||||
}
|
||||
}
|
||||
|
||||
async function validateUserProfileSigningAccountsDoesNotBelongtoAnotherUserProfile() {
|
||||
try {
|
||||
|
||||
if (userProfile.signingAccounts === undefined) { return true }
|
||||
|
||||
for (let i = 0; i < userProfile.signingAccounts.signingAccounts.length; i++) {
|
||||
let signingAccount = userProfile.signingAccounts.signingAccounts[i]
|
||||
let config = JSON.parse(signingAccount.config)
|
||||
/*
|
||||
Validation #9 Signing accounts of the User Profile
|
||||
must have a signature of the same Github username of the User Profile.
|
||||
*/
|
||||
let messageSigned = config.signature.message
|
||||
|
||||
if (messageSigned.toLowerCase() !== githubUsername.toLowerCase()) {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #9 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Signing Account ' + signingAccount.name + ' has not signed the current Github User Account, but something else. -> messageSigned = ' + messageSigned + '-> githubUsername = ' + githubUsername)
|
||||
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: pullRequest.number,
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because the Signing Account "' + signingAccount.name + '" has not signed the current Github User Account, but something else. \n\n messageSigned = "' + messageSigned + '" \n\n githubUsername = "' + githubUsername + '"'
|
||||
});
|
||||
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
pull_number: pullRequest.number,
|
||||
state: 'closed'
|
||||
});
|
||||
return false
|
||||
}
|
||||
/*
|
||||
Validation #10: The message signed has is equal to the signature messageHash.
|
||||
*/
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.hashData(
|
||||
config.signature.message
|
||||
)
|
||||
let messageSignedHash = serverResponse.hash
|
||||
let signatureHash = config.signature.messageHash
|
||||
|
||||
if (messageSignedHash !== signatureHash) {
|
||||
console.log('[INFO] Github Server -> mergeGithubPullRequests -> Validation #10 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Message Signed Hash is not equal to the the Signature Hash. -> messageSignedHash = ' + messageSignedHash + '-> signatureHash = ' + signatureHash)
|
||||
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: pullRequest.number,
|
||||
body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because the Message Signed Hash is not equal to the the Signature Hash.\n\n messageSignedHash = "' + messageSignedHash + '"\n\n signatureHash = "' + signatureHash + '"'
|
||||
});
|
||||
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
await octokit.rest.pulls.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
pull_number: pullRequest.number,
|
||||
state: 'closed'
|
||||
});
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
} catch (err) {
|
||||
console.log(err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
async function mergePullRequest() {
|
||||
/*
|
||||
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 +710,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,15 +738,15 @@ 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,
|
||||
issue_number: pullRequest.number,
|
||||
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.'
|
||||
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. Unfortunately we are not merging pull requests directly into the master branch. Consider resubmitting to the develop branch instead. For your convenience, you can switch 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,
|
||||
@@ -668,6 +775,7 @@ exports.newGithubServer = function newGithubServer() {
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
if (err === undefined) { return }
|
||||
console.log('[ERROR] Github Server -> mergeGithubPullRequests -> doGithub -> err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,17 +20,21 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
webhook = undefined
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
function initialize(initialWorkspace) {
|
||||
/*
|
||||
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.PLATFORM_HTTP_INTERFACE_PORT)
|
||||
/* Starting the browser now is optional */
|
||||
if (process.argv.includes("noBrowser")) {
|
||||
//Running Client only with no UI.
|
||||
} else {
|
||||
let queryString = ''
|
||||
if (initialWorkspace.name !== undefined) {
|
||||
queryString = '/?initialWorkspaceName=' + initialWorkspace.name + '&initialWorkspaceProject=' + initialWorkspace.project + '&initialWorkspaceType=' + initialWorkspace.type
|
||||
}
|
||||
SA.nodeModules.open('http://localhost:' + global.env.PLATFORM_HTTP_INTERFACE_PORT + queryString)
|
||||
}
|
||||
}
|
||||
|
||||
function onHttpRequest(httpRequest, httpResponse) {
|
||||
@@ -40,19 +44,24 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
let endpointOrFile = requestPath[1]
|
||||
|
||||
switch (endpointOrFile) {
|
||||
|
||||
case 'Environment':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.env), httpResponse)
|
||||
}
|
||||
break
|
||||
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 +72,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 +81,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 +93,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
|
||||
)
|
||||
@@ -92,9 +101,18 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(serverResponse), httpResponse)
|
||||
return
|
||||
}
|
||||
case 'hashData': {
|
||||
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.hashData(
|
||||
params.data
|
||||
)
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(serverResponse), httpResponse)
|
||||
return
|
||||
}
|
||||
case 'recoverAddress': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.recoverAddress(
|
||||
let serverResponse = await PL.servers.WEB3_SERVER.recoverAddress(
|
||||
params.signature
|
||||
)
|
||||
|
||||
@@ -103,7 +121,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 +149,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) {
|
||||
@@ -233,7 +252,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
console.log('[INFO] httpInterface -> Webhook -> Fetch-Messages -> Exchange-Market = ' + exchange + '-' + market)
|
||||
console.log('[INFO] httpInterface -> Webhook -> Fetch-Messages -> Messeges Fetched by Webhooks Sensor Bot = ' + webhookMessages.length)
|
||||
console.log('[INFO] httpInterface -> Webhook -> Fetch-Messages -> Messages Fetched by Webhooks Sensor Bot = ' + webhookMessages.length)
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(webhookMessages), httpResponse)
|
||||
webhookMessages = []
|
||||
@@ -242,9 +261,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]
|
||||
@@ -279,7 +300,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
console.log('[INFO] httpInterface -> Webhook -> New-Message -> Exchange-Market = ' + exchange + '-' + market)
|
||||
console.log('[INFO] httpInterface -> Webhook -> New-Message -> messageReceived = ' + messageReceived)
|
||||
console.log('[INFO] httpInterface -> Webhook -> New-Message -> Messeges waiting to be Fetched by Webhooks Sensor Bot = ' + webhookMessages.length)
|
||||
console.log('[INFO] httpInterface -> Webhook -> New-Message -> Messages waiting to be Fetched by Webhooks Sensor Bot = ' + webhookMessages.length)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
}
|
||||
break
|
||||
@@ -291,10 +312,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 +345,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 +378,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 +411,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 +444,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 +477,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'
|
||||
@@ -569,7 +602,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
function createNewDir(path) {
|
||||
try {
|
||||
fs.mkdirSync(path)
|
||||
fs.mkdirSync(path, {recursive: true})
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('file already exists') < 0) {
|
||||
throw (err)
|
||||
@@ -606,7 +639,13 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'App':
|
||||
{
|
||||
// If running the electron app do not try to get git tool. I don't allow it.
|
||||
if (process.env.SA_MODE === 'gitDisable') {
|
||||
console.log('[WARN] No contributions on binary distributions. Do manual installation')
|
||||
break
|
||||
}
|
||||
switch (requestPath[2]) { // switch by command
|
||||
|
||||
case 'Contribute': {
|
||||
try {
|
||||
let commitMessage = unescape(requestPath[3])
|
||||
@@ -616,7 +655,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
const contributionsBranch = unescape(requestPath[7])
|
||||
let error
|
||||
|
||||
/* Unsavping # */
|
||||
/* Unsaving # */
|
||||
for (let i = 0; i < 10; i++) {
|
||||
commitMessage = commitMessage.replace('_SLASH_', '/')
|
||||
commitMessage = commitMessage.replace('_HASHTAG_', '#')
|
||||
@@ -625,8 +664,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 +704,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',
|
||||
@@ -684,7 +723,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> contributionsBranch = ' + contributionsBranch)
|
||||
console.log('')
|
||||
console.log('Torubleshooting Tips:')
|
||||
console.log('Troubleshooting Tips:')
|
||||
console.log('')
|
||||
console.log('1. Make sure that you have set up your Github Username and Token at the APIs -> Github API node at the workspace.')
|
||||
console.log('2. Make sure you are running the latest version of Git available for your OS.')
|
||||
@@ -696,11 +735,11 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
async function doGithub() {
|
||||
|
||||
const { Octokit } = require("@octokit/rest")
|
||||
const { Octokit } = SA.nodeModules.octokit
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: token,
|
||||
userAgent: 'Superalgos Beta 11'
|
||||
userAgent: 'Superalgos Beta 12'
|
||||
})
|
||||
|
||||
const repo = 'Superalgos'
|
||||
@@ -760,7 +799,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 +829,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 +870,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.')
|
||||
@@ -839,6 +878,9 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
await doGit()
|
||||
|
||||
if (error === undefined) {
|
||||
// Run node setup to prepare instance for branch change
|
||||
await runNodeSetup()
|
||||
// Return to UI that Branch is successfully changed
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
} else {
|
||||
let docs = {
|
||||
@@ -855,7 +897,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',
|
||||
@@ -864,6 +906,27 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
const git = simpleGit(options)
|
||||
try {
|
||||
await git.checkout(currentBranch)
|
||||
|
||||
// Check to see it main repo has been set as upstream
|
||||
let remotes = await git.getRemotes();
|
||||
let isUpstreamSet
|
||||
for (let remote in remotes) {
|
||||
if (remotes[remote].name === 'upstream') {
|
||||
isUpstreamSet = true
|
||||
} else {
|
||||
isUpstreamSet = false
|
||||
}
|
||||
}
|
||||
// If upstream has not been set. Set it now
|
||||
if (isUpstreamSet === false) {
|
||||
await git.addRemote('upstream', 'https://github.com/Superalgos/Superalgos');
|
||||
}
|
||||
// Pull branch from main repo
|
||||
await git.pull('upstream', currentBranch);
|
||||
// Reset branch to match main repo
|
||||
let upstreamLocation = `upstream/${currentBranch}`
|
||||
await git.reset('hard', [upstreamLocation])
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Error changing current branch to ' + currentBranch)
|
||||
console.log(err.stack)
|
||||
@@ -871,6 +934,21 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
}
|
||||
|
||||
async function runNodeSetup() {
|
||||
console.log("Running Node setup to adjust for new Branch")
|
||||
const process = SA.nodeModules.process
|
||||
const childProcess = SA.nodeModules.childProcess
|
||||
|
||||
let dir = process.cwd()
|
||||
let command = "node setup noShortcuts";
|
||||
let stdout = childProcess.execSync(command,
|
||||
{
|
||||
cwd: dir
|
||||
}).toString();
|
||||
|
||||
console.log("Node Setup has completed with the following result:", stdout)
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> err.stack = ' + err.stack)
|
||||
@@ -890,7 +968,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 +996,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',
|
||||
@@ -946,6 +1024,148 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
case 'FixAppSchema': {
|
||||
/*
|
||||
We will use this process when we have moved APP SCHEMA files from one project to another, and we need to fix the
|
||||
actions where this node was referenced, so that it points to the new project where the node has moved to.
|
||||
*/
|
||||
let customResponse = {
|
||||
result: global.CUSTOM_OK_RESPONSE.result,
|
||||
message: ''
|
||||
}
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(customResponse), httpResponse)
|
||||
|
||||
console.log('Fixing App Schemas...')
|
||||
|
||||
let projects = SA.projects.foundations.utilities.filesAndDirectories.getDirectories(global.env.PATH_TO_PROJECTS)
|
||||
let PROJECTS_MAP = new Map()
|
||||
let directoryCount = 0
|
||||
let allAppSchemas = []
|
||||
let allAppSchemasFilePaths = []
|
||||
let allAppSchemasFileProjects = []
|
||||
|
||||
for (let i = 0; i < projects.length; i++) {
|
||||
let project = projects[i]
|
||||
|
||||
|
||||
|
||||
const fs = SA.nodeModules.fs
|
||||
let folder = 'App-Schema'
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/'
|
||||
SA.projects.foundations.utilities.filesAndDirectories.getAllFilesInDirectoryAndSubdirectories(filePath + folder, onFilesReady)
|
||||
|
||||
function onFilesReady(files) {
|
||||
try {
|
||||
let SCHEMA_MAP = new Map()
|
||||
|
||||
console.log('files.length... ' + files.length)
|
||||
|
||||
for (let k = 0; k < files.length; k++) {
|
||||
let name = files[k]
|
||||
let nameSplitted = name.split(folder)
|
||||
let fileName = nameSplitted[1]
|
||||
for (let i = 0; i < 10; i++) {
|
||||
fileName = fileName.replace('\\', '/')
|
||||
}
|
||||
let fileToRead = filePath + folder + fileName
|
||||
|
||||
console.log('Reading file... ' + fileToRead)
|
||||
|
||||
let fileContent = fs.readFileSync(fileToRead)
|
||||
let schemaDocument
|
||||
try {
|
||||
schemaDocument = JSON.parse(fileContent)
|
||||
SCHEMA_MAP.set(schemaDocument.type, schemaDocument)
|
||||
allAppSchemas.push(schemaDocument)
|
||||
allAppSchemasFilePaths.push(fileToRead)
|
||||
allAppSchemasFileProjects.push(project)
|
||||
} catch (err) {
|
||||
console.log('[ERROR] sendSchema -> Error Parsing JSON File: ' + fileToRead + ' .Error = ' + err.stack)
|
||||
return
|
||||
}
|
||||
}
|
||||
PROJECTS_MAP.set(project, SCHEMA_MAP)
|
||||
directoryCount++
|
||||
|
||||
console.log('directoryCount = ' + directoryCount, 'projects.length = ' + projects.length)
|
||||
//console.log(Array.from(PROJECTS_MAP.get(project).keys()))
|
||||
if (directoryCount === projects.length) {
|
||||
fixSchemas()
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fixSchemas() {
|
||||
try {
|
||||
console.log('fixSchemas...' + allAppSchemas.length)
|
||||
let projects = SA.projects.foundations.utilities.filesAndDirectories.getDirectories(global.env.PATH_TO_PROJECTS)
|
||||
const fs = SA.nodeModules.fs
|
||||
let needFixing = 0
|
||||
for (let i = 0; i < allAppSchemas.length; i++) {
|
||||
let schemaDocument = allAppSchemas[i]
|
||||
let wasUpdated = false
|
||||
for (let j = 0; j < schemaDocument.menuItems.length; j++) {
|
||||
let menuItem = schemaDocument.menuItems[j]
|
||||
if (menuItem.relatedUiObject !== undefined && menuItem.relatedUiObjectProject === undefined) {
|
||||
needFixing++
|
||||
|
||||
let hits = 0
|
||||
let foundProject
|
||||
let multiProject = ''
|
||||
for (let k = 0; k < projects.length; k++) {
|
||||
let project = projects[k]
|
||||
|
||||
let testDocument = PROJECTS_MAP.get(project).get(menuItem.relatedUiObject)
|
||||
if (testDocument !== undefined) {
|
||||
hits++
|
||||
foundProject = project
|
||||
multiProject = multiProject + ' -> ' + project
|
||||
|
||||
let fileProject = allAppSchemasFileProjects[i]
|
||||
//console.log(fileProject, project)
|
||||
if (fileProject === project) {
|
||||
/* If the project of the file is the same as the project found, then we consider this a match*/
|
||||
hits = 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hits === 0) {
|
||||
console.log('Problem With No Solution #' + needFixing, ' Type: ' + schemaDocument.type, ' Action: ' + menuItem.action, ' Related UI Object: ' + menuItem.relatedUiObject)
|
||||
console.log('This Node Type was NOT FOUND at any project. ' + menuItem.relatedUiObject)
|
||||
continue
|
||||
}
|
||||
if (hits === 1) {
|
||||
console.log('Problem With One Solution #' + needFixing, ' Type: ' + schemaDocument.type, ' Action: ' + menuItem.action, ' Related UI Object: ' + menuItem.relatedUiObject, ' Found Project:' + foundProject)
|
||||
|
||||
menuItem.relatedUiObjectProject = foundProject
|
||||
wasUpdated = true
|
||||
continue
|
||||
}
|
||||
console.log('Problem With MULTIPLE Solutions #' + needFixing, ' Type: ' + schemaDocument.type, ' Action: ' + menuItem.action, ' Related UI Object: ' + menuItem.relatedUiObject, ' Found at these Projects:' + multiProject)
|
||||
}
|
||||
}
|
||||
|
||||
if (wasUpdated === true) {
|
||||
let fileContent = JSON.stringify(schemaDocument, undefined, 4)
|
||||
let filePath = allAppSchemasFilePaths[i]
|
||||
//console.log('Saving File at ' + filePath)
|
||||
//console.log(fileContent)
|
||||
//fs.writeFileSync(filePath, fileContent)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
function respondWithDocsObject(docs, error) {
|
||||
@@ -991,16 +1211,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 +1233,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 +1244,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,25 +1255,233 @@ 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
|
||||
)
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(serverResponse), httpResponse)
|
||||
|
||||
setInterval(
|
||||
PL.servers.GITHUB_SERVER.mergePullRequests,
|
||||
60000,
|
||||
params.commitMessage,
|
||||
params.username,
|
||||
params.token
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
case 'payContributors': {
|
||||
|
||||
let serverResponse = await CL.servers.WEB3_SERVER.payContributors(
|
||||
case 'UserProfile': {
|
||||
try {
|
||||
|
||||
let mess = unescape(params.commitMessage)
|
||||
const username = unescape(params.username)
|
||||
const token = unescape(params.token)
|
||||
const currentBranch = unescape(params.currentBranch)
|
||||
const contributionsBranch = unescape(params.contributionsBranch)
|
||||
|
||||
let error
|
||||
|
||||
await updateUser()
|
||||
|
||||
async function updateUser() {
|
||||
|
||||
await doGithubUser()
|
||||
if (error !== undefined) {
|
||||
|
||||
let docs = {
|
||||
project: 'Governance',
|
||||
category: 'Topic',
|
||||
type: 'Gov Error - Contribution Not Sent',
|
||||
anchor: undefined,
|
||||
placeholder: {}
|
||||
}
|
||||
console.log('respond with docs ')
|
||||
|
||||
respondWithDocsObject(docs, error)
|
||||
return
|
||||
}
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
|
||||
}
|
||||
|
||||
async function doGithubUser() {
|
||||
|
||||
const { Octokit } = SA.nodeModules.octokit
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: token,
|
||||
userAgent: 'Superalgos Beta 12'
|
||||
})
|
||||
|
||||
const repo = 'Superalgos'
|
||||
const owner = 'Superalgos'
|
||||
const head = username + ':' + contributionsBranch
|
||||
const base = currentBranch
|
||||
const title = 'Contribution: ' + mess
|
||||
const path = 'Projects/Governance/Plugins/User-Profiles/' + username + '.json' ;
|
||||
|
||||
const sha = await getSHA(path);
|
||||
|
||||
if (sha === undefined){
|
||||
console.log('***** Abort GOV.USERPROFILE *****')
|
||||
return
|
||||
}
|
||||
|
||||
let file = await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent(
|
||||
'Governance',
|
||||
'User-Profiles',
|
||||
username + '.json'
|
||||
)
|
||||
|
||||
let buff = new Buffer.from(file, 'utf-8');
|
||||
let encodedFile = buff.toString('base64');
|
||||
|
||||
try {
|
||||
await octokit.repos.createOrUpdateFileContents({
|
||||
owner: username,
|
||||
repo: "Superalgos",
|
||||
path,
|
||||
message: title,
|
||||
content: encodedFile,
|
||||
sha,
|
||||
branch: base
|
||||
});
|
||||
} catch (err) {
|
||||
if (err.stack.indexOf('Error User Commit') >= 0) {
|
||||
return
|
||||
} else {
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> commitMessage = ' + mess)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token starts with = ' + token.substring(0, 10) + '...')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10))
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> contributionsBranch = ' + contributionsBranch)
|
||||
error = err
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await octokit.pulls.create({
|
||||
owner,
|
||||
repo,
|
||||
title,
|
||||
head,
|
||||
base,
|
||||
});
|
||||
} catch (err) {
|
||||
if (err.stack.indexOf('A pull request already exists') >= 0) {
|
||||
return
|
||||
} else {
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> commitMessage = ' + mess)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token starts with = ' + token.substring(0, 10) + '...')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10))
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> contributionsBranch = ' + contributionsBranch)
|
||||
error = err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async function getSHA(path) {
|
||||
let sha = ''
|
||||
const { graphql } = SA.nodeModules.graphql
|
||||
|
||||
try{
|
||||
|
||||
const { repository } = await graphql(
|
||||
'{ ' +
|
||||
' repository(name: "SuperAlgos", owner: "' + username + '") {' +
|
||||
' object(expression: "develop:' + path +'") {' +
|
||||
' ... on Blob {' +
|
||||
' oid' +
|
||||
' }' +
|
||||
' }' +
|
||||
' name' +
|
||||
' }' +
|
||||
'}',
|
||||
{
|
||||
headers: {
|
||||
authorization: 'token ' + token
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if (repository.name === undefined){
|
||||
console.log('***** Token permission needed : User:READ *****')
|
||||
sha = undefined
|
||||
error = '***** Token permission needed : User:READ *****'
|
||||
return sha
|
||||
}
|
||||
|
||||
if(repository.object === null ){
|
||||
console.log("[User Not Found] -> Creating new user")
|
||||
return sha
|
||||
}
|
||||
sha = repository.object.oid
|
||||
return sha
|
||||
|
||||
} catch (err) {
|
||||
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> commitMessage = ' + mess)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token starts with = ' + token.substring(0, 10) + '...')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10))
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> contributionsBranch = ' + contributionsBranch)
|
||||
return sha
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> commitMessage = ' + mess)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> token starts with = ' + token.substring(0, 10) + '...')
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> token ends with = ' + '...' + token.substring(token.length - 10))
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> contributionsBranch = ' + contributionsBranch)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: err.message,
|
||||
stack: err.stack
|
||||
}
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
case 'payContributors': {
|
||||
console.log('----------------------------------------------------------------------------------------------')
|
||||
console.log('DISTRIBUTION PROCESS STARTED')
|
||||
console.log('----------------------------------------------------------------------------------------------')
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
|
||||
|
||||
await PL.servers.WEB3_SERVER.payContributors(
|
||||
params.contractAddress,
|
||||
params.contractAbi,
|
||||
params.paymentsArray,
|
||||
params.mnemonic
|
||||
)
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(serverResponse), httpResponse)
|
||||
return
|
||||
}
|
||||
default: {
|
||||
@@ -1068,24 +1498,28 @@ 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.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'LegacyPlotter.js':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/LegacyPlotter.js', httpResponse)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/LegacyPlotter.js', httpResponse)
|
||||
}
|
||||
break
|
||||
case 'PlotterPanel.js':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/PlotterPanel.js', httpResponse)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/PlotterPanel.js', httpResponse)
|
||||
}
|
||||
break
|
||||
case 'Images': // This means the Images folder.
|
||||
{
|
||||
let path = global.env.PATH_TO_CLIENT + '/WebServer/Images/' + requestPath[2]
|
||||
let path = global.env.PATH_TO_PLATFORM + '/WebServer/Images/' + requestPath[2]
|
||||
|
||||
if (requestPath[3] !== undefined) {
|
||||
path = path + '/' + requestPath[3]
|
||||
@@ -1167,12 +1601,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'WebServer': // This means the WebServer folder.
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/' + requestPath[2], httpResponse)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/' + requestPath[2], httpResponse)
|
||||
}
|
||||
break
|
||||
case 'externalScripts': // This means the WebServer folder.
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/externalScripts/' + requestPath[2], httpResponse)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + requestPath[2], httpResponse)
|
||||
}
|
||||
break
|
||||
case 'Plotters': // This means the plotter folder, not to be confused with the Plotters script!
|
||||
@@ -1187,12 +1621,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'ChartLayers':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/UI/' + endpointOrFile + '/' + requestPath[2], httpResponse)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/UI/' + endpointOrFile + '/' + requestPath[2], httpResponse)
|
||||
}
|
||||
break
|
||||
case 'Files':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/UI/Data-Files/' + requestPath[2], httpResponse)
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/UI/Data-Files/' + requestPath[2], httpResponse)
|
||||
}
|
||||
break
|
||||
case 'Fonts':
|
||||
@@ -1343,10 +1777,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
let project = unescape(requestPath[2])
|
||||
let folder = unescape(requestPath[3])
|
||||
|
||||
let response = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
let response = await SA.projects.communityPlugins.utilities.plugins.getPluginFileNames(
|
||||
project,
|
||||
folder
|
||||
)
|
||||
).catch(err => {
|
||||
console.log('[ERROR] httpInterface -> PluginFileNames -> err.stack = ' + err.stack)
|
||||
})
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(response), httpResponse)
|
||||
|
||||
@@ -1375,20 +1811,28 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
let folder = unescape(requestPath[3])
|
||||
let fileName = unescape(requestPath[4])
|
||||
|
||||
let response = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
/*Beta 12 Refactoring Code: Remove this before releasing beta 12.*/
|
||||
if (fileName === 'Superalgos-CL.json') {
|
||||
fileName = 'Superalgos-PL.json'
|
||||
}
|
||||
|
||||
await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent(
|
||||
project,
|
||||
folder,
|
||||
fileName
|
||||
).catch(err => {
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: err
|
||||
)
|
||||
.then(response => {
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(response, httpResponse)
|
||||
}
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse)
|
||||
return
|
||||
})
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(response, httpResponse)
|
||||
)
|
||||
.catch(err => {
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: err
|
||||
}
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse)
|
||||
return
|
||||
})
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> LoadPlugin -> Method call produced an error.')
|
||||
@@ -1407,10 +1851,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 +1987,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'
|
||||
@@ -1555,7 +2003,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
/* Create Dir if it does not exist */
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir);
|
||||
fs.mkdirSync(dir, {recursive: true});
|
||||
}
|
||||
|
||||
fs.writeFile(filePath, fileContent, onFileWritten)
|
||||
@@ -1693,11 +2141,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_PLATFORM)
|
||||
}
|
||||
}
|
||||
} 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 = global.env.BASE_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)
|
||||
|
||||
@@ -7,6 +7,7 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
createWalletAccount: createWalletAccount,
|
||||
getWalletBalances: getWalletBalances,
|
||||
signData: signData,
|
||||
hashData: hashData,
|
||||
recoverAddress: recoverAddress,
|
||||
mnemonicToPrivateKey: mnemonicToPrivateKey,
|
||||
payContributors: payContributors,
|
||||
@@ -15,7 +16,7 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
run: run
|
||||
}
|
||||
|
||||
const Web3 = require('web3');
|
||||
const Web3 = SA.nodeModules.web3
|
||||
let web3Map = new Map()
|
||||
|
||||
return thisObject
|
||||
@@ -223,6 +224,22 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
}
|
||||
}
|
||||
|
||||
async function hashData(data) {
|
||||
try {
|
||||
|
||||
let web3 = new Web3()
|
||||
let hash = web3.eth.accounts.hashMessage(data)
|
||||
|
||||
return {
|
||||
hash: hash,
|
||||
result: 'Ok'
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
return { error: 'Could not hash the data. ' + err.stack }
|
||||
}
|
||||
}
|
||||
|
||||
async function recoverAddress(signature) {
|
||||
try {
|
||||
let signatureObject = JSON.parse(signature)
|
||||
@@ -241,7 +258,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) {
|
||||
@@ -268,10 +285,14 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
let response = await mnemonicToPrivateKey(mnemonic)
|
||||
let privateKey = response.privateKey
|
||||
|
||||
console.log('----------------------------------------------------------------------------------------------')
|
||||
console.log('PAYING CONTRIBUTORS')
|
||||
console.log('----------------------------------------------------------------------------------------------')
|
||||
|
||||
for (let i = 0; i < paymentsArray.length; i++) {
|
||||
await CL.projects.foundations.utilities.asyncFunctions.sleep(10000)
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(15000)
|
||||
let payment = paymentsArray[i]
|
||||
sendTokens(
|
||||
await sendTokens(
|
||||
i + 1,
|
||||
payment.userProfile,
|
||||
payment.from,
|
||||
@@ -282,20 +303,36 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
|
||||
async function sendTokens(number, userProfile, fromAddress, toAddress, tokenAmount) {
|
||||
try {
|
||||
|
||||
tokenAmount = Math.trunc(tokenAmount / 1000000000000000000)
|
||||
|
||||
console.log('')
|
||||
console.log('---------------------------------------------------------------------------------------------------------------------------------------------------')
|
||||
console.log(' Payment # ' + number + ' - User Profile: ' + userProfile + ' - SA Tokens Amount: ' + tokenAmount / 1000000000000000000 + ' - Address: ' + toAddress)
|
||||
console.log(' Payment # ' + number + ' - User Profile: ' + userProfile + ' - SA Tokens Amount: ' + parseFloat(tokenAmount).toLocaleString('en') + ' - Address: ' + toAddress)
|
||||
console.log('---------------------------------------------------------------------------------------------------------------------------------------------------')
|
||||
console.log('')
|
||||
|
||||
const Tx = require('ethereumjs-tx').Transaction;
|
||||
if (tokenAmount === 0) {
|
||||
console.log('No need to send a transaction in this case.')
|
||||
return
|
||||
}
|
||||
|
||||
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)
|
||||
/*
|
||||
Token Amount
|
||||
*/
|
||||
|
||||
tokenAmount = web3.utils.toWei(tokenAmount.toString(), 'ether')
|
||||
var amountBigNumber = web3.utils.toBN(tokenAmount)
|
||||
|
||||
//const amount = web3.utils.toHex(tokenAmount)
|
||||
if (privateKey === undefined) { privateKey = 'No Privete Key - Just Testing' }
|
||||
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',
|
||||
{
|
||||
@@ -308,13 +345,14 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
);
|
||||
|
||||
const nonce = await web3.eth.getTransactionCount(fromAddress);
|
||||
console.log('Nonce:', nonce)
|
||||
|
||||
const rawTransaction = {
|
||||
"from": fromAddress,
|
||||
"gasPrice": web3.utils.toHex(5000000000),
|
||||
"gasLimit": web3.utils.toHex(210000),
|
||||
"to": contractAddress, "value": "0x0",
|
||||
"data": contract.methods.transfer(toAddress, amount).encodeABI(),
|
||||
"data": contract.methods.transfer(toAddress, amountBigNumber).encodeABI(),
|
||||
"nonce": web3.utils.toHex(nonce)
|
||||
};
|
||||
|
||||
@@ -322,7 +360,13 @@ exports.newWeb3Server = function newWeb3Server() {
|
||||
transaction.sign(privateKeyBuffer)
|
||||
|
||||
console.log('Transaction:', rawTransaction)
|
||||
const result = await web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
|
||||
let result
|
||||
|
||||
result = await web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
|
||||
.catch(err => {
|
||||
console.log('[ERROR] sendSignedTransaction -> err =' + JSON.stringify(err))
|
||||
})
|
||||
|
||||
console.log('Result:', result)
|
||||
return result
|
||||
} catch (err) {
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
const WEB_SOCKET = require('ws')
|
||||
const WEB_SOCKET = SA.nodeModules.ws
|
||||
let socketServer
|
||||
let port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT
|
||||
let port = global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -36,13 +36,42 @@
|
||||
|
||||
socket.on('message', onMenssage)
|
||||
|
||||
function onMenssage(message){
|
||||
function onMenssage(message) {
|
||||
|
||||
try {
|
||||
if (LOG_INFO === true) {
|
||||
console.log('Message Received: ' + message.substring(0, 1000))
|
||||
if (global.env.DEMO_MODE === true) {
|
||||
/*
|
||||
In DEMO MODE we will accept Task / Sessioins Running or Stopping if you are requesting this from localhost only.
|
||||
*/
|
||||
if (socket._socket.remoteAddress !== "::1") {
|
||||
if (
|
||||
message.toString().indexOf('"eventType":"Run Task"') >= 0
|
||||
||
|
||||
message.toString().indexOf('"eventType":"Stop Task"') >= 0
|
||||
||
|
||||
message.toString().indexOf('"eventType":"Run Trading Session"') >= 0
|
||||
||
|
||||
message.toString().indexOf('"eventType":"Stop Trading Session"') >= 0
|
||||
||
|
||||
message.toString().indexOf('"eventType":"Resume Trading Session"') >= 0
|
||||
||
|
||||
message.toString().indexOf('"eventType":"Run Learning Session"') >= 0
|
||||
||
|
||||
message.toString().indexOf('"eventType":"Stop Learning Session"') >= 0
|
||||
||
|
||||
message.toString().indexOf('"eventType":"Resume Learning Session"') >= 0
|
||||
) {
|
||||
console.log('Trying to execute a Task while in DEMO MODE. Some hacking has taken place!')
|
||||
console.log('Hacker IP Address is: ' + socket._socket.remoteAddress)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (LOG_INFO === true) {
|
||||
console.log('Message Received: ' + message.toString().substring(0, 10000))
|
||||
}
|
||||
|
||||
let messageArray = message.toString().split('|*|')
|
||||
|
||||
let origin = messageArray[0]
|
||||
@@ -86,7 +115,7 @@
|
||||
}
|
||||
|
||||
|
||||
CL.servers.EVENT_SERVER.onMessage(messageToEventServer, onResponse)
|
||||
PL.servers.EVENT_SERVER.onMessage(messageToEventServer, onResponse)
|
||||
|
||||
function onResponse(message) {
|
||||
socket.send(message)
|
||||
@@ -97,7 +126,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
+161
-190
@@ -1,194 +1,165 @@
|
||||
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(initialWorkspace) {
|
||||
|
||||
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.PLATFORM_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
HTTP_INTERFACE = HTTP_INTERFACE.newHttpInterface()
|
||||
HTTP_INTERFACE.initialize(initialWorkspace)
|
||||
console.log('Http Interface .............................................. Listening at port ' + global.env.PLATFORM_HTTP_INTERFACE_PORT)
|
||||
|
||||
console.log('')
|
||||
console.log("You are running Superalgos Beta 12")
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -149,12 +149,12 @@ function newAnimation() {
|
||||
}
|
||||
}
|
||||
|
||||
/* We request the next frame to be drawn, and stablishing a loop */
|
||||
/* We request the next frame to be drawn, and establish a loop */
|
||||
|
||||
/* Use this code for full animation speed. */
|
||||
animationLoopHandle = window.requestAnimationFrame(animationLoop)
|
||||
|
||||
/* Use this code for max 10 frames per second animation speed, if the app is consumming too much of your CPU. */
|
||||
/* Use this code for max 10 frames per second animation speed, if the app is consuming too much of your CPU. */
|
||||
/*
|
||||
setTimeout(nextLoop, 100)
|
||||
function nextLoop () {
|
||||
|
||||
+17
-18
@@ -1,11 +1,10 @@
|
||||
let postLoader
|
||||
|
||||
function newAppLoader() {
|
||||
const MODULE_NAME = 'App Loader'
|
||||
const INFO_LOG = false
|
||||
const ERROR_LOG = true
|
||||
const logger = newWebDebugLog()
|
||||
|
||||
|
||||
|
||||
let thisObject = {
|
||||
loadModules: loadModules
|
||||
@@ -64,16 +63,16 @@ function newAppLoader() {
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let item = fileArray[i]
|
||||
|
||||
project = item[0]
|
||||
fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName)
|
||||
|
||||
let project = item[0]
|
||||
let fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
utilities()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function utilities() {
|
||||
let url = 'ListUtilitiesFiles'
|
||||
@@ -84,16 +83,16 @@ function newAppLoader() {
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let item = fileArray[i]
|
||||
|
||||
project = item[0]
|
||||
fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Utilities' + '/' + fileName)
|
||||
|
||||
let project = item[0]
|
||||
let fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Utilities' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
globals()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function globals() {
|
||||
let url = 'ListGlobalFiles'
|
||||
@@ -104,16 +103,16 @@ function newAppLoader() {
|
||||
let fileArray = JSON.parse(fileList)
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
let item = fileArray[i]
|
||||
|
||||
project = item[0]
|
||||
fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Globals' + '/' + fileName)
|
||||
|
||||
let project = item[0]
|
||||
let fileName = item[1]
|
||||
urlArray.push('Projects' + '/' + project + '/' + 'UI' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
|
||||
modulesArray = modulesArray.concat(urlArray)
|
||||
spaces()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function spaces() {
|
||||
let url = 'ListSpaceFiles'
|
||||
@@ -138,7 +137,7 @@ function newAppLoader() {
|
||||
|
||||
for (let i = 0; i < modulesArray.length; i++) {
|
||||
let path = modulesArray[i]
|
||||
|
||||
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
if (INFO_LOG === true) { logger.write('[INFO] loadModules -> Module Requested.') }
|
||||
|
||||
@@ -4,7 +4,7 @@ function newAppPostLoader() {
|
||||
const MODULE_NAME = 'Post Loader'
|
||||
const ERROR_LOG = true
|
||||
const logger = newWebDebugLog()
|
||||
|
||||
|
||||
|
||||
let thisObject = {
|
||||
start: start
|
||||
@@ -14,9 +14,18 @@ function newAppPostLoader() {
|
||||
|
||||
function start() {
|
||||
try {
|
||||
|
||||
|
||||
// autoSaveWhenClosingTheBrowser()
|
||||
setupProjectsSchema()
|
||||
setupEnvironment()
|
||||
|
||||
function setupEnvironment() {
|
||||
httpRequest(undefined, 'Environment', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.environment = JSON.parse(file)
|
||||
setupProjectsSchema()
|
||||
}
|
||||
}
|
||||
|
||||
function setupProjectsSchema() {
|
||||
httpRequest(undefined, 'ProjectsSchema', onResponse)
|
||||
|
||||
@@ -47,7 +47,7 @@ function loadSuperalgos() {
|
||||
loadDebugModule()
|
||||
|
||||
if ((browser.name !== "Chrome" && browser.name!=="Safari") || (browser.name === "Chrome" && parseInt(browser.version) < 85) || (browser.name === "Safari" && parseInt(browser.version) < 13)) {
|
||||
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionaility issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version)
|
||||
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionality issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version)
|
||||
}
|
||||
|
||||
function checkBrowserVersion () {
|
||||
@@ -131,7 +131,7 @@ function loadSuperalgos() {
|
||||
}
|
||||
}
|
||||
|
||||
/* And Finally, we start loading all the scripts we will inmediatelly need. */
|
||||
/* And Finally, we start loading all the scripts we will immediately need. */
|
||||
function loadModules() {
|
||||
let path = "AppLoader.js"
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
+51
-12
@@ -172,7 +172,7 @@ function newCanvas() {
|
||||
spaceDefinitionDrawMap.set(spaceDefinition.animationDrawIndex, spaceDefinition)
|
||||
}
|
||||
|
||||
/* Build the maps that defines the secuence of execution of different events. */
|
||||
/* Build the maps that defines the sequence of execution of different events. */
|
||||
if (spaceDefinition.onMouseWheelIndex !== undefined) {
|
||||
projectInstance.events.onMouseWheelMap.set(spaceDefinition.onMouseWheelIndex, spaceInstance)
|
||||
}
|
||||
@@ -373,7 +373,7 @@ function newCanvas() {
|
||||
|
||||
if (EDITOR_ON_FOCUS === true) {
|
||||
/*
|
||||
We will fordward the event to whoever is
|
||||
We will forward the event to whoever is
|
||||
controlling the editor.
|
||||
*/
|
||||
if (window.editorController !== undefined) {
|
||||
@@ -459,6 +459,45 @@ 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
|
||||
}
|
||||
|
||||
if (
|
||||
event.shiftKey === true &&
|
||||
(event.ctrlKey === true || event.metaKey === true) &&
|
||||
(event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.rescueFloatingObjectToMouse || event.key === UI.projects.foundations.spaces.floatingSpace.settings.shortcuts.rescueFloatingObjectToMouse.toLowerCase())
|
||||
|
||||
) {
|
||||
UI.projects.foundations.spaces.floatingSpace.rescueFloatingObjectToMouse(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) {
|
||||
@@ -611,7 +650,7 @@ function newCanvas() {
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true) {
|
||||
/* Shortcuts to nodes */
|
||||
if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90)) {
|
||||
/* From here we prevent the default behaviour. Putting it earlier prevents imput box and text area to receive keystrokes */
|
||||
/* From here we prevent the default behaviour. Putting it earlier prevents input box and text area to receive keystrokes */
|
||||
event.preventDefault()
|
||||
let nodeUsingThisKey = await UI.projects.foundations.spaces.designSpace.workspace.getNodeByShortcutKey(event.key)
|
||||
|
||||
@@ -732,11 +771,11 @@ function newCanvas() {
|
||||
/*
|
||||
We will go through all the spaces defined at the project schema for each project
|
||||
and we are going to query each space to see if they have the container that is at
|
||||
the mouse position. We will order firt the spaces by the sequence order defined
|
||||
the mouse position. We will order first the spaces by the sequence order defined
|
||||
at the project schema specifically for this mouse event.
|
||||
|
||||
The order of the projects for events evaluations has intentionally been inverted,
|
||||
because the latest project is drwan the last, on top of the others, that means that
|
||||
because the latest project is drawn the last, on top of the others, that means that
|
||||
events should belong to the last first.
|
||||
*/
|
||||
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
|
||||
@@ -842,11 +881,11 @@ function newCanvas() {
|
||||
/*
|
||||
We will go through all the spaces defined at the project schema for each project
|
||||
and we are going to query each space to see if they have the container that is at
|
||||
the mouse position. We will order firt the spaces by the sequence order defined
|
||||
the mouse position. We will order first the spaces by the sequence order defined
|
||||
at the project schema specifically for this mouse event.
|
||||
|
||||
The order of the projects for events evaluations has intentionally been inverted,
|
||||
because the latest project is drwan the last, on top of the others, that means that
|
||||
because the latest project is drawn the last, on top of the others, that means that
|
||||
events should belong to the last first.
|
||||
*/
|
||||
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
|
||||
@@ -953,18 +992,18 @@ function newCanvas() {
|
||||
return
|
||||
}
|
||||
|
||||
/* Then we check who is the current object underneeth the mounse. */
|
||||
/* Then we check who is the current object underneath the mouse. */
|
||||
|
||||
let container
|
||||
|
||||
/*
|
||||
We will go through all the spaces defined at the project schema for each project
|
||||
and we are going to query each space to see if they have the container that is at
|
||||
the mouse position. We will order firt the spaces by the sequence order defined
|
||||
the mouse position. We will order first the spaces by the sequence order defined
|
||||
at the project schema specifically for this mouse event.
|
||||
|
||||
The order of the projects for events evaluations has intentionally been inverted,
|
||||
because the latest project is drwan the last, on top of the others, that means that
|
||||
because the latest project is drawn the last, on top of the others, that means that
|
||||
events should belong to the last first.
|
||||
*/
|
||||
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
|
||||
@@ -1024,11 +1063,11 @@ function newCanvas() {
|
||||
/*
|
||||
We will go through all the spaces defined at the project schema for each project
|
||||
and we are going to query each space to see if they have the container that is at
|
||||
the mouse position. We will order firt the spaces by the sequence order defined
|
||||
the mouse position. We will order first the spaces by the sequence order defined
|
||||
at the project schema specifically for this mouse event.
|
||||
|
||||
The order of the projects for events evaluations has intentionally been inverted,
|
||||
because the latest project is drwan the last, on top of the others, that means that
|
||||
because the latest project is drawn the last, on top of the others, that means that
|
||||
events should belong to the last first.
|
||||
*/
|
||||
for (let i = PROJECTS_SCHEMA.length - 1; i >= 0; i--) {
|
||||
|
||||
@@ -45,7 +45,7 @@ function newDailyFiles() {
|
||||
}
|
||||
}
|
||||
|
||||
function initialize(pMine, pBot, pSession, pProduct, pDataset, pExchange, pMarket, pDatetime, pTimeFrame, pHost, pPort, pEventsServerClient, callBackFunction) {
|
||||
function initialize(pMine, pBot, pSession, pProduct, pDataset, pExchange, pMarket, pDatetime, pTimeFrame, pHost, pPort, pEventsServerClient, callBackFunction, scheme='http') {
|
||||
try {
|
||||
callBackWhenFileReceived = callBackFunction
|
||||
|
||||
@@ -55,7 +55,7 @@ function newDailyFiles() {
|
||||
let timeFrames
|
||||
|
||||
fileCloud = newFileCloud()
|
||||
fileCloud.initialize(pBot, pHost, pPort)
|
||||
fileCloud.initialize(pBot, pHost, pPort, scheme)
|
||||
|
||||
/* Config Validations */
|
||||
if (pDataset.config.validTimeFrames === undefined) {
|
||||
|
||||
@@ -17,8 +17,8 @@ function newFileCloud () {
|
||||
let fileStorage
|
||||
return thisObject
|
||||
|
||||
function initialize (pBot, pHost, pPort) {
|
||||
fileStorage = newFileStorage(pHost, pPort)
|
||||
function initialize (pBot, pHost, pPort, scheme='http') {
|
||||
fileStorage = newFileStorage(pHost, pPort, scheme)
|
||||
}
|
||||
|
||||
function getFile (pMine, pBot, pSession, pProduct, pDataset, pExchange, pMarket, ptimeFrameLabel, pDatetime, pSequence, pDataRange, pTimeFrames, callBackFunction) {
|
||||
@@ -77,7 +77,7 @@ function newFileCloud () {
|
||||
}
|
||||
|
||||
if (fileName === undefined) {
|
||||
logger.write('[ERROR] getFile -> getFileRecursively -> Inconsistant data. Check the following: ')
|
||||
logger.write('[ERROR] getFile -> getFileRecursively -> Inconsistent data. Check the following: ')
|
||||
logger.write('[ERROR] getFile -> getFileRecursively -> pMine = ' + JSON.stringify(pMine))
|
||||
logger.write('[ERROR] getFile -> getFileRecursively -> pBot = ' + JSON.stringify(pBot))
|
||||
logger.write('[ERROR] getFile -> getFileRecursively -> pDataset = ' + JSON.stringify(pDataset))
|
||||
@@ -85,7 +85,7 @@ function newFileCloud () {
|
||||
logger.write('[ERROR] getFile -> getFileRecursively -> pMarket = ' + JSON.stringify(pMarket))
|
||||
logger.write('[ERROR] getFile -> getFileRecursively -> ptimeFrameLabel = ' + JSON.stringify(ptimeFrameLabel))
|
||||
|
||||
throw ('Inconsistant data received.')
|
||||
throw ('Inconsistent data received.')
|
||||
}
|
||||
|
||||
if (pMarket !== undefined) {
|
||||
@@ -152,7 +152,7 @@ function newFileCloud () {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> filePath = ' + filePath) }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> fileName = ' + fileName) }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> Unexpected Error Ocurred.') }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> Unexpected Error Occurred.') }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> err = ' + err.stack) }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> text = ' + text) }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> response = ' + response) }
|
||||
|
||||
@@ -195,7 +195,7 @@ function newFileCursor() {
|
||||
/*
|
||||
|
||||
We are implementing here an algorithm designed to save bandwidth, memory and processing power at the browser.
|
||||
We say there is a saving mode where the cursor is running at a minimum size. When the end user aproaches the time period the cursor
|
||||
We say there is a saving mode where the cursor is running at a minimum size. When the end user approaches the time period the cursor
|
||||
is set, then it should exit the saving mode and go to its actual size.
|
||||
|
||||
To do this we are going to measure the distance from the Time Frame received to the one the cursors was initialized with.
|
||||
@@ -427,7 +427,7 @@ function newFileCursor() {
|
||||
let targetDate = new Date(cursorDate)
|
||||
targetDate.setUTCDate(targetDate.getUTCDate() + j)
|
||||
|
||||
/* Small algorith to allow load first the current date, then alternate between the most forwad and the most backwards ones. */
|
||||
/* Small algorithm to allow load first the current date, then alternate between the most forward and the most backwards ones. */
|
||||
if (j === 0) { j++ } else {
|
||||
if (j < 0) {
|
||||
j = -j
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function newFileStorage(host, port) {
|
||||
function newFileStorage(host, port, scheme='http') {
|
||||
const MODULE_NAME = 'File Storage'
|
||||
const INFO_LOG = false
|
||||
const logger = newWebDebugLog()
|
||||
@@ -40,12 +40,12 @@ function newFileStorage(host, port) {
|
||||
let url
|
||||
|
||||
if (host !== undefined && port !== undefined) {
|
||||
url = 'http://' + host + ':' + port + '/' + folder + filePath
|
||||
url = scheme + '://' + host + ':' + port + '/' + folder + filePath
|
||||
} else {
|
||||
url = folder + filePath
|
||||
}
|
||||
|
||||
/* Scaping # since it breaks the URL */
|
||||
/* Escaping # since it breaks the URL */
|
||||
url = url.replaceAll('#', '_HASHTAG_')
|
||||
|
||||
httpRequest(undefined, url, (response, fileContent) => {
|
||||
@@ -64,7 +64,7 @@ function newFileStorage(host, port) {
|
||||
let err = { code: 'The specified key does not exist.' }
|
||||
callBackFunction(err)
|
||||
} else {
|
||||
console.log('Error geting the file from the serever:', err)
|
||||
console.log('Error getting the file from the server:', err)
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ function newMarketFiles() {
|
||||
pHost,
|
||||
pPort,
|
||||
pEventsServerClient,
|
||||
callBackFunction) {
|
||||
callBackFunction,
|
||||
scheme='http') {
|
||||
try {
|
||||
let timeFrames
|
||||
|
||||
@@ -94,7 +95,7 @@ function newMarketFiles() {
|
||||
eventsServerClient = pEventsServerClient
|
||||
|
||||
fileCloud = newFileCloud()
|
||||
fileCloud.initialize(pBot, pHost, pPort)
|
||||
fileCloud.initialize(pBot, pHost, pPort, scheme)
|
||||
|
||||
/* Some Validations */
|
||||
if (dataset.config.validTimeFrames === undefined) {
|
||||
|
||||
@@ -8,7 +8,7 @@ function newEventHandler() {
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let eventHandlers = [] // Here we store all the functions we will call when an event is raiseed.
|
||||
let eventHandlers = [] // Here we store all the functions we will call when an event is raised.
|
||||
|
||||
return thisObject
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
function newEventsServerClient(networkNode) {
|
||||
function newEventsServerClient(lanNetworkNode) {
|
||||
/* Web Sockets Connection */
|
||||
|
||||
const MODULE_NAME = 'System Event Handler'
|
||||
@@ -192,19 +192,19 @@ function newEventsServerClient(networkNode) {
|
||||
|
||||
if (thisObject.isConnected() !== true) {
|
||||
if (lastTryToReconnectDatetime !== undefined) {
|
||||
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.')
|
||||
if (lanNetworkNode !== undefined) {
|
||||
if (lanNetworkNode.payload !== undefined) {
|
||||
if (lanNetworkNode.payload.uiObject !== undefined) {
|
||||
lanNetworkNode.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.')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (networkNode !== undefined) {
|
||||
if (networkNode.payload !== undefined) {
|
||||
if (networkNode.payload.uiObject !== undefined) {
|
||||
networkNode.payload.uiObject.setStatus('Connected to Superalgos Client via WebSockets.')
|
||||
if (lanNetworkNode !== undefined) {
|
||||
if (lanNetworkNode.payload !== undefined) {
|
||||
if (lanNetworkNode.payload.uiObject !== undefined) {
|
||||
lanNetworkNode.payload.uiObject.setStatus('Connected to Superalgos Platform Client via WebSockets.')
|
||||
retryCommandsPhysics()
|
||||
}
|
||||
}
|
||||
@@ -218,16 +218,17 @@ function newEventsServerClient(networkNode) {
|
||||
try {
|
||||
let host
|
||||
let port
|
||||
/* At this point the node does not have the payload property yet, that is why we have to do this manually */
|
||||
let extwsurl
|
||||
try {
|
||||
let config = JSON.parse(networkNode.config)
|
||||
let config = JSON.parse(lanNetworkNode.config)
|
||||
host = config.host
|
||||
port = config.webSocketsPort
|
||||
extwsurl = config.webSocketsExternalURL
|
||||
|
||||
/* Check if we really have to stablish the connection. */
|
||||
/* Check if we really have to establish the connection. */
|
||||
if (config.autoConnect === false) { return }
|
||||
} catch (err) {
|
||||
networkNode.payload.uiObject.setErrorMessage(
|
||||
lanNetworkNode.payload.uiObject.setErrorMessage(
|
||||
'Bad configuration. Invalid JSON Format.',
|
||||
undefined,
|
||||
{
|
||||
@@ -241,7 +242,7 @@ function newEventsServerClient(networkNode) {
|
||||
}
|
||||
|
||||
if (host === undefined) {
|
||||
networkNode.payload.uiObject.setErrorMessage(
|
||||
lanNetworkNode.payload.uiObject.setErrorMessage(
|
||||
'Bad configuration. Host Property Not Found.',
|
||||
undefined,
|
||||
{
|
||||
@@ -255,7 +256,7 @@ function newEventsServerClient(networkNode) {
|
||||
}
|
||||
|
||||
if (port === undefined) {
|
||||
networkNode.payload.uiObject.setErrorMessage(
|
||||
lanNetworkNode.payload.uiObject.setErrorMessage(
|
||||
'Bad configuration. WebSocketsPort Property Not Found.',
|
||||
undefined,
|
||||
{
|
||||
@@ -268,8 +269,12 @@ function newEventsServerClient(networkNode) {
|
||||
return
|
||||
}
|
||||
|
||||
const WEB_SOCKETS_URL = 'ws://' + host + ':' + port + ''
|
||||
let wsurl = 'ws://' + host + ':' + port + ''
|
||||
if (extwsurl !== undefined) {
|
||||
wsurl = extwsurl
|
||||
}
|
||||
|
||||
const WEB_SOCKETS_URL = wsurl
|
||||
WEB_SOCKETS_CONNECTION = new WebSocket(WEB_SOCKETS_URL)
|
||||
WEB_SOCKETS_CONNECTION.onerror = error => {
|
||||
console.log('WebSocket error:' + JSON.stringify(error))
|
||||
@@ -280,7 +285,7 @@ function newEventsServerClient(networkNode) {
|
||||
}
|
||||
}
|
||||
WEB_SOCKETS_CONNECTION.onmessage = e => {
|
||||
// console.log('Websoked Message Received: ' + e.data)
|
||||
// console.log('WEB_SOCKET Message Received: ' + e.data)
|
||||
|
||||
let message = JSON.parse(e.data)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ function newFrame() {
|
||||
let thisObject = {
|
||||
type: 'Rectangle',
|
||||
containerName: '', // This is for debugging purposes only.
|
||||
parentFrame: undefined, // Here we store the parent cointainer zoom object.
|
||||
parentFrame: undefined, // Here we store the parent container zoom object.
|
||||
radius: 0,
|
||||
offset: undefined,
|
||||
position: undefined,
|
||||
@@ -53,7 +53,7 @@ function newFrame() {
|
||||
}
|
||||
|
||||
function isInViewPort() {
|
||||
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.foundations.spaces.chartingSpace.viewport */
|
||||
/* This function is useful to know if the object who has this frame is currently appearing at least in part at the UI.projects.foundations.spaces.chartingSpace.viewport */
|
||||
|
||||
point1 = {
|
||||
x: 0,
|
||||
@@ -78,7 +78,7 @@ function newFrame() {
|
||||
}
|
||||
|
||||
function isCenterInViewPort() {
|
||||
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.foundations.spaces.chartingSpace.viewport */
|
||||
/* This function is useful to know if the object who has this frame is currently appearing at least in part at the UI.projects.foundations.spaces.chartingSpace.viewport */
|
||||
|
||||
point1 = {
|
||||
x: thisObject.width * 40 / 100,
|
||||
@@ -187,8 +187,8 @@ function newFrame() {
|
||||
}
|
||||
|
||||
function isThisPointHere(point, outsideViewPort, dontTransform, padding) {
|
||||
// The second parameter is usefull when you want to check a point that you already know is outside the viewport.
|
||||
// The padding is a distance to the borders of the container. Can be either negative (outside, to increase the cointainer size) or positive (inside to decrease the cointainer size)
|
||||
// The second parameter is useful when you want to check a point that you already know is outside the viewport.
|
||||
// The padding is a distance to the borders of the container. Can be either negative (outside, to increase the container size) or positive (inside to decrease the cointainer size)
|
||||
|
||||
if (padding === undefined) { padding = 0 }
|
||||
|
||||
@@ -199,7 +199,7 @@ function newFrame() {
|
||||
}
|
||||
|
||||
/* The point received is on the screen coordinates system, which already has zoom and displacement applied. We need to remove the zoom and displacement
|
||||
in order to have the point on the containers coordinate system and be able to compare it with its dimmensions. */
|
||||
in order to have the point on the containers coordinate system and be able to compare it with its dimensions. */
|
||||
if (dontTransform === false || dontTransform === undefined) {
|
||||
if (outsideViewPort === true) {
|
||||
checkPoint = thisObject.container.frame.unframeThisPoint(checkPoint)
|
||||
@@ -208,7 +208,7 @@ function newFrame() {
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we check if the resulting point is whin the current Frame. */
|
||||
/* Now we check if the resulting point is within the current Frame. */
|
||||
if (isNaN(checkPoint.x) || isNaN(checkPoint.y)) { return false }
|
||||
if (thisObject.type === 'Circle') {
|
||||
let distance = Math.sqrt(Math.pow(thisObject.position.x - checkPoint.x, 2) + Math.pow(thisObject.position.y - checkPoint.y, 2))
|
||||
@@ -244,7 +244,7 @@ function newFrame() {
|
||||
thisPoint = thisObject.parentFrame.frameThisPoint(thisPoint)
|
||||
}
|
||||
|
||||
/* Now we check if the resulting point is whin the current Frame. */
|
||||
/* Now we check if the resulting point is within the current Frame. */
|
||||
|
||||
if (thisObject.type === 'Circle') {
|
||||
let distance = Math.sqrt(Math.pow(thisPoint.x - checkPoint.x, 2) + Math.pow(thisPoint.y - checkPoint.y, 2))
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/* Global Constatns */
|
||||
/* Global Constants */
|
||||
|
||||
let canvas
|
||||
let PROJECTS_SCHEMA
|
||||
let SCHEMAS_BY_PROJECT = new Map()
|
||||
/* New Root object*/
|
||||
let UI = {
|
||||
projects: {}
|
||||
projects: {},
|
||||
environment: {}
|
||||
}
|
||||
|
||||
/* User Interface Colors */
|
||||
@@ -203,9 +204,9 @@ const _1_MINUTE_IN_MILISECONDS = 1 * 60 * 1000;
|
||||
|
||||
|
||||
|
||||
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the UI.projects.foundations.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the UI.projects.foundations.spaces.chartingSpace.viewport.initialize if the user had a previous session with this same browser.
|
||||
let INITIAL_ZOOM_LEVEL = -28.25 // This is the zoom level at the view port in which the APP starts.
|
||||
let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwritten at the UI.projects.foundations.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwritten at the UI.projects.foundations.spaces.chartingSpace.viewport.initialize if the user had a previous session with this same browser.
|
||||
let VERY_LARGE_NUMBER = 100000000000000
|
||||
|
||||
const TOP_MARGIN = 0
|
||||
@@ -245,7 +246,7 @@ const PERIOD_05_MIN = "05-min";
|
||||
const PERIOD_01_MIN = "01-min";
|
||||
|
||||
/*
|
||||
We define here the size of the chartingSpace. It has to bee enough big in order to accomodate all the charts we expect to display in this space.
|
||||
We define here the size of the chartingSpace. It has to bee enough big in order to accommodate all the charts we expect to display in this space.
|
||||
*/
|
||||
|
||||
const TIME_MACHINE_WIDTH = 8;
|
||||
|
||||
@@ -74,7 +74,7 @@ function newProductStorage(name) {
|
||||
}
|
||||
}
|
||||
|
||||
function initialize(mine, bot, session, product, exchange, market, pDatetime, pTimeFrame, host, port, eventsServerClient, callBackFunction) {
|
||||
function initialize(mine, bot, session, product, exchange, market, pDatetime, pTimeFrame, host, port, eventsServerClient, callBackFunction, scheme='http') {
|
||||
try {
|
||||
datetime = pDatetime
|
||||
timeFrame = pTimeFrame
|
||||
@@ -90,7 +90,7 @@ function newProductStorage(name) {
|
||||
dataSetsToLoad++
|
||||
|
||||
let marketFiles = newMarketFiles()
|
||||
marketFiles.initialize(mine, bot, session, product, dataset, exchange, market, host, port, eventsServerClient, onMarketFileReady)
|
||||
marketFiles.initialize(mine, bot, session, product, dataset, exchange, market, host, port, eventsServerClient, onMarketFileReady, scheme)
|
||||
thisObject.marketFiles.push(marketFiles)
|
||||
}
|
||||
break
|
||||
@@ -99,7 +99,7 @@ function newProductStorage(name) {
|
||||
dataSetsToLoad++
|
||||
|
||||
let dailyFiles = newDailyFiles()
|
||||
dailyFiles.initialize(mine, bot, session, product, dataset, exchange, market, pDatetime, pTimeFrame, host, port, eventsServerClient, onDailyFileReady)
|
||||
dailyFiles.initialize(mine, bot, session, product, dataset, exchange, market, pDatetime, pTimeFrame, host, port, eventsServerClient, onDailyFileReady, scheme)
|
||||
thisObject.dailyFiles.push(dailyFiles)
|
||||
}
|
||||
break
|
||||
@@ -108,7 +108,7 @@ function newProductStorage(name) {
|
||||
dataSetsToLoad++
|
||||
|
||||
let singleFile = newSingleFile()
|
||||
singleFile.initialize(mine, bot, session, product, dataset, exchange, market, host, port, eventsServerClient, onSingleFileReady)
|
||||
singleFile.initialize(mine, bot, session, product, dataset, exchange, market, host, port, eventsServerClient, onSingleFileReady, scheme)
|
||||
thisObject.singleFile.push(singleFile)
|
||||
}
|
||||
break
|
||||
@@ -117,7 +117,7 @@ function newProductStorage(name) {
|
||||
dataSetsToLoad++
|
||||
|
||||
let fileSequences = newFileSequence()
|
||||
fileSequences.initialize(mine, bot, session, product, dataset, exchange, market, host, port, eventsServerClient, onFileSequenceReady)
|
||||
fileSequences.initialize(mine, bot, session, product, dataset, exchange, market, host, port, eventsServerClient, onFileSequenceReady, scheme)
|
||||
thisObject.fileSequences.push(fileSequences)
|
||||
}
|
||||
break
|
||||
|
||||
+38
-13
@@ -1,4 +1,4 @@
|
||||
function getSchemaDocument (node, project) {
|
||||
function getSchemaDocument(node, project) {
|
||||
if (node === null || node === undefined) {
|
||||
console.log('[ERROR] Can not get the schema document of a null or undefined node ')
|
||||
return
|
||||
@@ -7,13 +7,35 @@ function getSchemaDocument (node, project) {
|
||||
|
||||
let APP_SCHEMA = SCHEMAS_BY_PROJECT.get(project)
|
||||
if (APP_SCHEMA !== undefined) {
|
||||
return SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(node.type)
|
||||
|
||||
let schemaDocument = SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(node.type)
|
||||
/*
|
||||
As of today, we are still splitting the codebase into multiple projects and there are Menu Actions which do not
|
||||
have a well defined relatedUIObjectProject. There are a few techniques in place to try to guess it, but
|
||||
even those can fail. For that reason, we will temporally see if we can find the schema document at any of the
|
||||
available projects.
|
||||
|
||||
TODO: We need to explictly declare the project of a relatedUIObject in order to avoid potential name collision
|
||||
between nodes belonging to more than one project.
|
||||
*/
|
||||
|
||||
if (schemaDocument === undefined) {
|
||||
for (let j = 0; j < PROJECTS_SCHEMA.length; j++) {
|
||||
let project = PROJECTS_SCHEMA[j].name
|
||||
schemaDocument = SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(node.type)
|
||||
if (schemaDocument !== undefined) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return schemaDocument
|
||||
} else {
|
||||
console.log('[ERROR] Could not get APP Scchema for project ' + node.project)
|
||||
console.log('[ERROR] Could not get APP Schema for project ' + node.project)
|
||||
}
|
||||
}
|
||||
|
||||
function dynamicDecimals (value, minDecimals) {
|
||||
function dynamicDecimals(value, minDecimals) {
|
||||
if (minDecimals === undefined) {
|
||||
minDecimals = 0
|
||||
}
|
||||
@@ -26,7 +48,7 @@ function dynamicDecimals (value, minDecimals) {
|
||||
return returnValue
|
||||
}
|
||||
|
||||
function convertTimeFrameToName (pTimeFrame) {
|
||||
function convertTimeFrameToName(pTimeFrame) {
|
||||
for (let i = 0; i < dailyTimeFramesArray.length; i++) {
|
||||
let period = dailyTimeFramesArray[i]
|
||||
if (period[0] === pTimeFrame) {
|
||||
@@ -42,7 +64,7 @@ function convertTimeFrameToName (pTimeFrame) {
|
||||
}
|
||||
}
|
||||
|
||||
function nextPorwerOf10 (number) {
|
||||
function nextPorwerOf10(number) {
|
||||
for (let i = -10; i <= 10; i++) {
|
||||
if (number < Math.pow(10, i)) {
|
||||
return Math.pow(10, i)
|
||||
@@ -50,18 +72,18 @@ function nextPorwerOf10 (number) {
|
||||
}
|
||||
}
|
||||
|
||||
function pad (str, max) {
|
||||
function pad(str, max) {
|
||||
str = str.toString()
|
||||
return str.length < max ? pad('0' + str, max) : str
|
||||
}
|
||||
|
||||
function moveToUserPosition (container, currentDate, currentRate, coordinateSystem, ignoreX, ignoreY, mousePosition, fitFunction) {
|
||||
function moveToUserPosition(container, currentDate, currentRate, coordinateSystem, ignoreX, ignoreY, mousePosition, fitFunction) {
|
||||
let targetPoint = {
|
||||
x: currentDate.valueOf(),
|
||||
y: currentRate
|
||||
}
|
||||
|
||||
/* Put this point in the coordinate system of the UI.projects.foundations.spaces.chartingSpace.viewport */
|
||||
/* Put this point in the coordinate system of the UI.projects.foundations.spaces.chartingSpace.viewport */
|
||||
targetPoint = coordinateSystem.transformThisPoint(targetPoint)
|
||||
targetPoint = UI.projects.foundations.utilities.coordinateTransformations.transformThisPoint(targetPoint, container)
|
||||
|
||||
@@ -81,7 +103,7 @@ function moveToUserPosition (container, currentDate, currentRate, coordinateSyst
|
||||
container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function removeTime (datetime) {
|
||||
function removeTime(datetime) {
|
||||
if (datetime === undefined) { return }
|
||||
|
||||
let dateOnly = new Date(Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS) * ONE_DAY_IN_MILISECONDS)
|
||||
@@ -89,15 +111,18 @@ function removeTime (datetime) {
|
||||
return dateOnly
|
||||
}
|
||||
|
||||
function newUniqueId () {
|
||||
function newUniqueId() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)
|
||||
return v.toString(16)
|
||||
})
|
||||
}
|
||||
|
||||
function splitTextIntoPhrases (text, wordsPerLine) {
|
||||
function splitTextIntoPhrases(text, wordsPerLine) {
|
||||
try {
|
||||
if (text.split === undefined) {
|
||||
return []
|
||||
}
|
||||
let splittedLabel = text.split(' ')
|
||||
let phrases = []
|
||||
let phrase = ''
|
||||
@@ -125,7 +150,7 @@ function splitTextIntoPhrases (text, wordsPerLine) {
|
||||
}
|
||||
}
|
||||
|
||||
function getTextWidth (text) {
|
||||
function getTextWidth(text) {
|
||||
var metrics = browserCanvasContext.measureText(text)
|
||||
return metrics.width
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -826,6 +826,13 @@ display: table-cell;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::placeholder, /* Chrome, Firefox, Opera, Safari 10.1+ */
|
||||
:-ms-input-placeholder, /* Internet Explorer 10-11 */
|
||||
::-ms-input-placeholder { /* Microsoft Edge */
|
||||
color: #dbdbdb;
|
||||
opacity: 1; /* Firefox */
|
||||
}
|
||||
|
||||
.docs-search-results-header-tabs-container {
|
||||
display: table;
|
||||
text-align: right;
|
||||
|
||||
@@ -888,7 +888,8 @@
|
||||
#governance-tab13:checked ~ .governance-search-result-content #content13,
|
||||
#governance-tab14:checked ~ .governance-search-result-content #content14,
|
||||
#governance-tab15:checked ~ .governance-search-result-content #content15,
|
||||
#governance-tab16:checked ~ .governance-search-result-content #content16 {
|
||||
#governance-tab16:checked ~ .governance-search-result-content #content16,
|
||||
#governance-tab17:checked ~ .governance-search-result-content #content17 {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,27 @@ content: "Summary: ";
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tutorial-content-div {
|
||||
overflow-y: auto;
|
||||
overflow-x: clip;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #888;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
.tutorial-definitionTable {
|
||||
background-color: #f3f3f3;
|
||||
border-top-color: #a6e1ec;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
"splashTextLine3Html": ''
|
||||
},
|
||||
{
|
||||
"splashTextLine1Html": '<span class="credits-red">Superalgos is a community of algo traders, sharing knowleadge, experience, and tools.</span>'
|
||||
"splashTextLine1Html": '<span class="credits-red">Superalgos is a community of algo traders, sharing knowledge, experience, and tools.</span>'
|
||||
,
|
||||
"splashTextLine2Html": 'We negotiate with exchanges and pass on benefits to all members. Become part of the Superalgos Community by making a small contribution to the open-source project!'
|
||||
,
|
||||
|
||||
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,92 @@
|
||||
|
||||
/*
|
||||
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"),
|
||||
graphql: require("@octokit/graphql"),
|
||||
simpleGit: require('simple-git'),
|
||||
lookpath: require('lookpath'),
|
||||
process: require('process'),
|
||||
childProcess: require('child_process')
|
||||
}
|
||||
/*
|
||||
Check if we are starting from a particular workspace.
|
||||
*/
|
||||
let initialWorkspace = {}
|
||||
|
||||
for (let i = 0; i < process.argv.length; i++) {
|
||||
let arg = process.argv[i]
|
||||
|
||||
if (arg === 'noBrowser') { continue }
|
||||
if (arg === 'minMemo') { continue }
|
||||
if (arg.indexOf(':') >= 0) { continue }
|
||||
if (arg.indexOf('/') >= 0) { continue }
|
||||
|
||||
if (initialWorkspace.project === undefined) {
|
||||
if (arg !== 'My-Workspaces') {
|
||||
initialWorkspace.type = 'Plugin'
|
||||
initialWorkspace.project = arg
|
||||
} else {
|
||||
initialWorkspace.type = 'My-Workspaces'
|
||||
initialWorkspace.project = ''
|
||||
}
|
||||
} else {
|
||||
initialWorkspace.name = arg
|
||||
}
|
||||
}
|
||||
|
||||
run(initialWorkspace)
|
||||
|
||||
async function run(initialWorkspace) {
|
||||
PL.app = require('./Platform/PlatformApp.js').newPlatformApp()
|
||||
await PL.app.run(initialWorkspace)
|
||||
console.log('Superalgos Platform App is Running!')
|
||||
if(process.send) {
|
||||
process.send("Running")
|
||||
}
|
||||
}
|
||||
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
File renamed without changes.
+33118
-27598
File diff suppressed because it is too large.
Load diff
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"type": "Algorithmic-Trading Project",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add Missing Children",
|
||||
"label": "Add Missing Children",
|
||||
"iconPathOn": "algorithmic-trading-project",
|
||||
"iconPathOff": "algorithmic-trading-project",
|
||||
"iconProject": "Algorithmic-Trading",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Trading Mine",
|
||||
"relatedUiObject": "Trading Mine",
|
||||
"relatedUiObjectProject": "Algorithmic-Trading",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Trading Engine",
|
||||
"relatedUiObject": "Trading Engine",
|
||||
"relatedUiObjectProject": "Algorithmic-Trading",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Trading System",
|
||||
"relatedUiObject": "Trading System",
|
||||
"relatedUiObjectProject": "Algorithmic-Trading",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"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,
|
||||
"icon": "algorithmic-trading-project",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "projectDefinition",
|
||||
"type": "node",
|
||||
"childType": "Project Definition",
|
||||
"project": "Foundations",
|
||||
"autoAdd": true
|
||||
}
|
||||
]
|
||||
}
|
||||
+18
-7
@@ -7,28 +7,36 @@
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"dontShowAtFullscreen": true,
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"actionProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Process Definition",
|
||||
"relatedUiObject": "Process Definition",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"relatedUiObjectProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Product Definition",
|
||||
"relatedUiObject": "Product Definition",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"relatedUiObjectProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Product Definition Folder",
|
||||
"relatedUiObject": "Product Definition Folder",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"relatedUiObjectProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
@@ -54,19 +62,22 @@
|
||||
"name": "processes",
|
||||
"type": "array",
|
||||
"childType": "Process Definition",
|
||||
"autoAdd": true
|
||||
"autoAdd": true,
|
||||
"project": "Foundations"
|
||||
},
|
||||
{
|
||||
"name": "products",
|
||||
"type": "array",
|
||||
"childType": "Product Definition",
|
||||
"autoAdd": true
|
||||
"autoAdd": true,
|
||||
"project": "Foundations"
|
||||
},
|
||||
{
|
||||
"name": "productDefinitionFolders",
|
||||
"type": "array",
|
||||
"childType": "Product Definition Folder",
|
||||
"autoAdd": true
|
||||
"autoAdd": true,
|
||||
"project": "Foundations"
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "tradingBots"
|
||||
+10
-4
@@ -5,10 +5,13 @@
|
||||
"action": "Add Missing Children",
|
||||
"label": "Add Missing Children",
|
||||
"relatedUiObject": "Trading Engine",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"relatedUiObjectProject": "Algorithmic-Trading"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
@@ -25,19 +28,22 @@
|
||||
"name": "tradingCurrent",
|
||||
"type": "node",
|
||||
"childType": "Trading Current",
|
||||
"autoAdd": true
|
||||
"autoAdd": false,
|
||||
"project": "Foundations"
|
||||
},
|
||||
{
|
||||
"name": "tradingLast",
|
||||
"type": "node",
|
||||
"childType": "Trading Last",
|
||||
"autoAdd": true
|
||||
"autoAdd": false,
|
||||
"project": "Foundations"
|
||||
},
|
||||
{
|
||||
"name": "exchangeOrders",
|
||||
"type": "node",
|
||||
"childType": "Exchange Orders",
|
||||
"autoAdd": true
|
||||
"autoAdd": false,
|
||||
"project": "Foundations"
|
||||
}
|
||||
]
|
||||
}
|
||||
+14
-5
@@ -6,23 +6,30 @@
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"iconProject": "Foundations",
|
||||
"dontShowAtFullscreen": true,
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"actionProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Trading Bot",
|
||||
"relatedUiObject": "Trading Bot",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"relatedUiObjectProject": "Algorithmic-Trading",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Plotter",
|
||||
"relatedUiObject": "Plotter",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"relatedUiObjectProject": "Foundations",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
@@ -45,12 +52,14 @@
|
||||
{
|
||||
"name": "tradingBots",
|
||||
"type": "array",
|
||||
"childType": "Trading Bot"
|
||||
"childType": "Trading Bot",
|
||||
"project": "Algorithmic-Trading"
|
||||
},
|
||||
{
|
||||
"name": "plotters",
|
||||
"type": "array",
|
||||
"childType": "Plotter"
|
||||
"childType": "Plotter",
|
||||
"project": "Foundations"
|
||||
}
|
||||
]
|
||||
}
|
||||
+11
-4
@@ -5,7 +5,9 @@
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Trading Strategy",
|
||||
"relatedUiObject": "Trading Strategy",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"relatedUiObjectProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
@@ -13,10 +15,13 @@
|
||||
"propertyToCheckFor": "dynamicIndicators",
|
||||
"label": "Add Dynamic Indicators",
|
||||
"relatedUiObject": "Dynamic Indicators",
|
||||
"actionFunction": "payload.executeAction"
|
||||
"actionFunction": "payload.executeAction",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"relatedUiObjectProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
@@ -33,13 +38,15 @@
|
||||
"name": "tradingStrategies",
|
||||
"type": "array",
|
||||
"childType": "Trading Strategy",
|
||||
"autoAdd": true
|
||||
"autoAdd": true,
|
||||
"project": "Foundations"
|
||||
},
|
||||
{
|
||||
"name": "dynamicIndicators",
|
||||
"type": "node",
|
||||
"childType": "Dynamic Indicators",
|
||||
"autoAdd": true
|
||||
"autoAdd": true,
|
||||
"project": "Foundations"
|
||||
}
|
||||
]
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-3
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesExchangeAPI = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesExchangeAPI = function (processIndex) {
|
||||
|
||||
let MODULE_NAME = "Exchange API";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
let options = {}
|
||||
let exchange
|
||||
|
||||
const ccxt = require('ccxt')
|
||||
const ccxt = SA.nodeModules.ccxt
|
||||
|
||||
return thisObject;
|
||||
|
||||
@@ -228,7 +228,7 @@
|
||||
logError('key.length:' + exchangeApiKey.config.codeName.length)
|
||||
logError('secret.length:' + exchangeApiKey.config.secret.length)
|
||||
logError('Double check that you copied the key at the codeName property and the secret at secret property without bringing any invisible caracter from the exchange web site, or leaving any character from the sample text. Also check that the keys are not disabled at the exchange ot that they are not restricted by IP.')
|
||||
logError('As a remainder. Binance key and secret are 64 bytes in lenght each one. ')
|
||||
logError('As a remainder. Binance key and secret are 64 bytes in length each one. ')
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
exports.newFoundationsBotModulesOrdersCalculations = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesOrdersCalculations = function (processIndex) {
|
||||
/*
|
||||
When we are live trading, we need to syncronize with the exchange.
|
||||
*/
|
||||
const MODULE_NAME = 'Orders Calculations'
|
||||
|
||||
let thisObject = {
|
||||
actualSizeCalculation: actualSizeCalculation,
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
exports.newFoundationsBotModulesOrdersSimulations = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesOrdersSimulations = function (processIndex) {
|
||||
/*
|
||||
When we are backtesting or paper trading, we need to simulate what would have happened at the exchange.
|
||||
*/
|
||||
const MODULE_NAME = 'Orders Simulations'
|
||||
|
||||
let thisObject = {
|
||||
actualSizeSimulation: actualSizeSimulation,
|
||||
+481
@@ -0,0 +1,481 @@
|
||||
exports.newAlgorithmicTradingBotModulesSnapshots = function(processIndex) {
|
||||
/*
|
||||
This module encapsulates the snapshots functionality.
|
||||
*/
|
||||
const MODULE_NAME = 'Snapshots'
|
||||
|
||||
let thisObject = {
|
||||
updateChart: updateChart,
|
||||
strategyEntry: strategyEntry,
|
||||
strategyExit: strategyExit,
|
||||
positionEntry: positionEntry,
|
||||
positionExit: positionExit,
|
||||
addCodeToSnapshot: addCodeToSnapshot,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let tradingEngine
|
||||
let tradingSystem
|
||||
let sessionParameters
|
||||
|
||||
const SNAPSHOTS_FOLDER_NAME = 'Snapshots'
|
||||
|
||||
/* Snapshots of Strategies and Positions */
|
||||
let snapshots = {
|
||||
headers: [],
|
||||
strategies: [],
|
||||
positions: []
|
||||
}
|
||||
|
||||
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 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.
|
||||
*/
|
||||
let chart
|
||||
let exchange
|
||||
let market
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
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() {
|
||||
//trigger exits added for extra save moment for datapreserve
|
||||
if (tradingEngine.tradingCurrent.strategy.begin.value > 0) {
|
||||
strategyExit()
|
||||
positionExit()
|
||||
}
|
||||
writeSnapshotFiles()
|
||||
tradingEngine = undefined
|
||||
tradingSystem = undefined
|
||||
sessionParameters = undefined
|
||||
|
||||
positionKeys = undefined
|
||||
strategyKeys = undefined
|
||||
|
||||
chart = undefined
|
||||
exchange = undefined
|
||||
market = undefined
|
||||
}
|
||||
|
||||
function updateChart(pChart, pExchange, pMarket) {
|
||||
/*
|
||||
We need these 3 data structures to be a local objects
|
||||
accessible while evaluating conditions and formulas.
|
||||
*/
|
||||
chart = pChart
|
||||
exchange = pExchange
|
||||
market = pMarket
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
strategyKeys = new Map()
|
||||
strategyValues = []
|
||||
addToStrategyValues = true
|
||||
|
||||
evalNode(tradingSystem)
|
||||
|
||||
/* Turn off this */
|
||||
createHeaders = false
|
||||
addToStrategyValues = false
|
||||
}
|
||||
|
||||
function strategyExit() {
|
||||
getResults(tradingEngine.tradingCurrent.strategy.begin.value, tradingEngine.tradingCurrent.strategy.end.value)
|
||||
let valuesArray = closeValues.concat(strategyValues)
|
||||
snapshots.strategies.push(valuesArray)
|
||||
}
|
||||
|
||||
function positionEntry() {
|
||||
|
||||
positionKeys = new Map()
|
||||
positionValues = []
|
||||
addToPositionValues = true
|
||||
|
||||
evalNode(tradingSystem)
|
||||
|
||||
/* Turn off this */
|
||||
createHeaders = false
|
||||
addToPositionValues = false
|
||||
}
|
||||
|
||||
function positionExit() {
|
||||
getResults(tradingEngine.tradingCurrent.position.begin.value, tradingEngine.tradingCurrent.position.end.value)
|
||||
let valuesArray = closeValues.concat(positionValues)
|
||||
snapshots.positions.push(valuesArray)
|
||||
}
|
||||
|
||||
function evalNode(node) {
|
||||
if (node === undefined) { return }
|
||||
|
||||
/* Here we check if there is a codition to be evaluated */
|
||||
if (node.type === 'Condition') {
|
||||
/* We will eval this condition */
|
||||
evalCondition(node)
|
||||
}
|
||||
|
||||
/* Here we check if there is a formula to be evaluated */
|
||||
if (node.type === 'Formula') {
|
||||
if (node.code !== undefined) {
|
||||
/* We will eval this formula */
|
||||
evalFormula(node)
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we go down through all this node children */
|
||||
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
|
||||
if (schemaDocument === undefined) { return }
|
||||
|
||||
if (schemaDocument.childrenNodesProperties !== undefined) {
|
||||
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
|
||||
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
|
||||
let property = schemaDocument.childrenNodesProperties[i]
|
||||
|
||||
switch (property.type) {
|
||||
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) {
|
||||
let nodePropertyArray = node[property.name]
|
||||
for (let m = 0; m < nodePropertyArray.length; m++) {
|
||||
evalNode(nodePropertyArray[m])
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
let nodeWithCode = node
|
||||
if (node.javascriptCode !== undefined) {
|
||||
if (node.javascriptCode.code !== undefined) {
|
||||
nodeWithCode = node.javascriptCode
|
||||
}
|
||||
}
|
||||
addCodeToSnapshot(nodeWithCode)
|
||||
}
|
||||
|
||||
function evalFormula(node) {
|
||||
let nodeWithCode = node
|
||||
addCodeToSnapshot(nodeWithCode)
|
||||
}
|
||||
|
||||
function addCodeToSnapshot(nodeWithCode) {
|
||||
if (nodeWithCode === undefined) { return }
|
||||
if (nodeWithCode.code === undefined) { return }
|
||||
|
||||
try {
|
||||
const code = nodeWithCode.code
|
||||
let instructionsArray = code.split(' ')
|
||||
for (let i = 0; i < instructionsArray.length; i++) {
|
||||
let instruction = instructionsArray[i]
|
||||
instruction = instruction.replace('(', '')
|
||||
instruction = instruction.replace(')', '')
|
||||
instruction = instruction.replace(/</g, '')
|
||||
instruction = instruction.replace(/>/g, '')
|
||||
instruction = instruction.replace(/<=/g, '')
|
||||
instruction = instruction.replace(/>=/g, '')
|
||||
instruction = instruction.replace(/!=/g, '')
|
||||
instruction = instruction.replace(/!==/g, '')
|
||||
instruction = instruction.replace(/==/g, '')
|
||||
instruction = instruction.replace(/===/g, '')
|
||||
instruction = instruction.replace(/{/g, '')
|
||||
instruction = instruction.replace(/}/g, '')
|
||||
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') {
|
||||
product = product + '.previous'
|
||||
checkPrevious(index + 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Example: chart.at01hs.popularSMA.sma200 - chart.at01hs.popularSMA.sma100 < 10
|
||||
if (timeFrame !== 'atAnyTimeFrame') {
|
||||
timeFrame = timeFrame.substring(2, 4) + '-' + timeFrame.substring(4, 7)
|
||||
}
|
||||
let key = timeFrame + '-' + product + '-' + property
|
||||
let existingKey
|
||||
if (addToStrategyValues === true) {
|
||||
addValues(strategyKeys, strategyValues)
|
||||
}
|
||||
|
||||
if (addToPositionValues === true) {
|
||||
addValues(positionKeys, positionValues)
|
||||
}
|
||||
|
||||
function addValues(keys, values) {
|
||||
existingKey = keys.get(key)
|
||||
|
||||
if (existingKey === undefined) { // means that at the current loop this property of this product was not used before.
|
||||
keys.set(key, key)
|
||||
if (createHeaders === true) {
|
||||
snapshots.headers.push(key)
|
||||
}
|
||||
|
||||
try {
|
||||
let value = eval(instruction)
|
||||
values.push(value)
|
||||
} catch (err) {
|
||||
const message = 'Snapshot Unexpected Error'
|
||||
let docs = {
|
||||
project: 'Foundations',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
let contextInfo = {
|
||||
instruction: instruction
|
||||
}
|
||||
TS.projects.education.utilities.docsFunctions.buildPlaceholder(docs, err, nodeWithCode.name, nodeWithCode.code, undefined, undefined, contextInfo)
|
||||
|
||||
tradingSystem.addError([nodeWithCode.id, message, docs])
|
||||
values.push(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
const message = 'Snapshot Unexpected Error'
|
||||
let docs = {
|
||||
project: 'Foundations',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
TS.projects.education.utilities.docsFunctions.buildPlaceholder(docs, err, nodeWithCode.name, nodeWithCode.code, undefined)
|
||||
|
||||
tradingSystem.addError([nodeWithCode.id, message, docs])
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] runSimulation -> addCodeToSnapshot -> nodeWithCode.code = ' + nodeWithCode.code)
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] runSimulation -> addCodeToSnapshot -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
function getResults(openDatetime, closeDatetime) {
|
||||
|
||||
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', '# Periods']
|
||||
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
|
||||
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
|
||||
tradingEngine.tradingCurrent.position.positionCounters.periods.value // periods counter
|
||||
]
|
||||
|
||||
if (createCloseHeaders === true) {
|
||||
snapshots.headers = closeHeaders.concat(JSON.parse(JSON.stringify(snapshots.headers)))
|
||||
createCloseHeaders = false
|
||||
}
|
||||
}
|
||||
|
||||
function writeSnapshotFiles() {
|
||||
|
||||
if (sessionParameters.snapshots !== undefined) {
|
||||
if (sessionParameters.snapshots.config.strategy === true) {
|
||||
writeSnapshotFile(snapshots.strategies, 'Strategies')
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionParameters.snapshots !== undefined) {
|
||||
if (sessionParameters.snapshots.config.strategy === true) {
|
||||
writeSnapshotFile(snapshots.positions, 'Positions')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeSnapshotFile(snapshotArray, pFileName) {
|
||||
try {
|
||||
let fileStorage = TS.projects.foundations.taskModules.fileStorage.newFileStorage(processIndex);
|
||||
|
||||
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;
|
||||
filePath += '/' + fileName
|
||||
|
||||
//Get contents of current file if available, otherwise start empty file
|
||||
if (snapshotAvailable) {
|
||||
getSnapShotFile(filePath)
|
||||
} else {
|
||||
writeOutput('')
|
||||
}
|
||||
|
||||
function writeOutput(fileContent) {
|
||||
let separator = '\r\n';
|
||||
let contentArray = [];
|
||||
|
||||
// if we have file content extract rows
|
||||
if (fileContent != '') {
|
||||
contentArray = fileContent.split(separator)
|
||||
}
|
||||
|
||||
parseRecord(snapshots.headers)
|
||||
for (let i = 0; i < snapshotArray.length; i++) {
|
||||
let record = snapshotArray[i];
|
||||
if (record.length > 0) {
|
||||
parseRecord(record)
|
||||
}
|
||||
}
|
||||
|
||||
function parseRecord(record) {
|
||||
// if we have undefined values, we need to extract the previous stored values for this trade and append them to the new record for completion
|
||||
if (record[record.length - 1] === undefined && contentArray.length > 0) {
|
||||
|
||||
let rowToMutateArray = contentArray[contentArray.length - 1].split(',')
|
||||
// check if are for sure on the same tradenumber and merge the data and remove previous line incl separator
|
||||
if (rowToMutateArray[0] == record[0]) {
|
||||
record.pop()
|
||||
rowToMutateArray.splice(0, record.length)
|
||||
record = record.concat(rowToMutateArray)
|
||||
fileContent = fileContent.replace(contentArray[contentArray.length - 1], '')
|
||||
fileContent = fileContent.replace(/\r\n$/, '')
|
||||
}
|
||||
}
|
||||
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
|
||||
)
|
||||
}
|
||||
//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 {
|
||||
// remove the last linebreak and seperator which is introduced extra during save
|
||||
text = text.replace(/\n$/, '')
|
||||
text = text.replace(/\r\n$/, '')
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
exports.newFoundationsBotModulesTradingEngine = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingEngine = function (processIndex) {
|
||||
/*
|
||||
We call the Trading Engine to the data structure that is needed in order to exevute the
|
||||
trading protocol with the specific rules defined at the Trading System.
|
||||
*/
|
||||
const MODULE_NAME = 'Trading Engine'
|
||||
|
||||
let thisObject = {
|
||||
mantain: mantain,
|
||||
reset: reset,
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
exports.newFoundationsBotModulesTradingEpisode = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingEpisode = function (processIndex) {
|
||||
/*
|
||||
This module packages all functions related to Episodes.
|
||||
*/
|
||||
const MODULE_NAME = 'Trading Episode'
|
||||
let thisObject = {
|
||||
mantain: mantain,
|
||||
reset: reset,
|
||||
@@ -113,7 +112,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() {
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingExecution = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingExecution = function (processIndex) {
|
||||
/*
|
||||
The Trading Execution modules manages the execution nodes and execution algoritms.
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ exports.newFoundationsBotModulesTradingExecution = function (processIndex) {
|
||||
let tradingSystem
|
||||
let sessionParameters
|
||||
|
||||
let tradingOrdersModuleObject = TS.projects.foundations.botModules.tradingOrders.newFoundationsBotModulesTradingOrders(processIndex)
|
||||
let tradingOrdersModuleObject = TS.projects.algorithmicTrading.botModules.tradingOrders.newAlgorithmicTradingBotModulesTradingOrders(processIndex)
|
||||
|
||||
return thisObject
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingOrders = function (processIndex) {
|
||||
/*
|
||||
The Trading Orders modules manages the execution of orders against the exchanges.
|
||||
*/
|
||||
@@ -16,8 +16,8 @@ exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
|
||||
let tradingSystem
|
||||
let sessionParameters
|
||||
|
||||
let exchangeAPIModuleObject = TS.projects.foundations.botModules.exchangeAPI.newFoundationsBotModulesExchangeAPI(processIndex)
|
||||
let announcementsModuleObject = TS.projects.foundations.botModules.announcements.newFoundationsBotModulesAnnouncements(processIndex)
|
||||
let exchangeAPIModuleObject = TS.projects.algorithmicTrading.botModules.exchangeAPI.newAlgorithmicTradingBotModulesExchangeAPI(processIndex)
|
||||
let announcementsModuleObject = TS.projects.socialBots.botModules.announcements.newSocialBotsBotModulesAnnouncements(processIndex)
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -843,7 +843,7 @@ exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
|
||||
let previousBaseAssetFeesPaid = tradingEngineOrder.orderBaseAsset.feesPaid.value
|
||||
let previousQuotedAssetFeesPaid = tradingEngineOrder.orderQuotedAsset.feesPaid.value
|
||||
|
||||
let ordersSimulationsModuleObject = TS.projects.foundations.botModules.ordersSimulations.newFoundationsBotModulesOrdersSimulations(processIndex)
|
||||
let ordersSimulationsModuleObject = TS.projects.algorithmicTrading.botModules.ordersSimulations.newAlgorithmicTradingBotModulesOrdersSimulations(processIndex)
|
||||
ordersSimulationsModuleObject.initialize()
|
||||
|
||||
ordersSimulationsModuleObject.actualSizeSimulation(tradingEngineStage, tradingSystemOrder, tradingEngineOrder, applyFeePercentage)
|
||||
@@ -874,7 +874,7 @@ exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
|
||||
let previousBaseAssetFeesPaid = tradingEngineOrder.orderBaseAsset.feesPaid.value
|
||||
let previousQuotedAssetFeesPaid = tradingEngineOrder.orderQuotedAsset.feesPaid.value
|
||||
|
||||
let ordersCalculationsModuleObject = TS.projects.foundations.botModules.ordersCalculations.newFoundationsBotModulesOrdersCalculations(processIndex)
|
||||
let ordersCalculationsModuleObject = TS.projects.algorithmicTrading.botModules.ordersCalculations.newAlgorithmicTradingBotModulesOrdersCalculations(processIndex)
|
||||
ordersCalculationsModuleObject.initialize()
|
||||
|
||||
await ordersCalculationsModuleObject.actualSizeCalculation(tradingEngineStage, tradingSystemOrder, tradingEngineOrder, order, applyFeePercentage)
|
||||
@@ -1262,7 +1262,7 @@ exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
|
||||
tradingSystem.highlights.push(executionAlgorithm.id)
|
||||
tradingSystem.highlights.push(executionNode.id)
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(event)
|
||||
announcementsModuleObject.makeAnnouncements(event)
|
||||
return situation.name // if the event is triggered, we return the name of the situation that passed
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingOutput = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingOutput = function (processIndex) {
|
||||
/*
|
||||
This module will load if necesary all the data outputs so that they can be appended with new
|
||||
records if needed. After running the simulation, it will save all the data outputs.
|
||||
@@ -29,9 +29,9 @@ exports.newFoundationsBotModulesTradingOutput = function (processIndex) {
|
||||
}
|
||||
|
||||
/* Preparing everything for the Simulation */
|
||||
let tradingSimulationModuleObject = TS.projects.foundations.botModules.tradingSimulation.newFoundationsBotModulesTradingSimulation(processIndex)
|
||||
let tradingSimulationModuleObject = TS.projects.algorithmicTrading.botModules.tradingSimulation.newAlgorithmicTradingBotModulesTradingSimulation(processIndex)
|
||||
|
||||
let outputDatasets = TS.projects.foundations.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasetsMap = new Map()
|
||||
|
||||
await TS.projects.foundations.functionLibraries.outputManagementFunctions.readFiles(
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingPosition = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingPosition = function (processIndex) {
|
||||
/*
|
||||
This module packages all functions related to Positions.
|
||||
*/
|
||||
@@ -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)
|
||||
}
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingProcess = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingProcess = function (processIndex) {
|
||||
/*
|
||||
This Module will load all the process data dependencies from files and send them downstream.
|
||||
After execution, will save the time range and status report of the process.
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
let dataFiles = new Map()
|
||||
let multiTimeFrameDataFiles = new Map()
|
||||
TS.projects.foundations.globals.processModuleObjects.MODULE_OBJECTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_ENGINE_MODULE_OBJECT = TS.projects.foundations.botModules.tradingEngine.newFoundationsBotModulesTradingEngine(processIndex)
|
||||
let tradingOutputModuleObject = TS.projects.foundations.botModules.tradingOutput.newFoundationsBotModulesTradingOutput(processIndex)
|
||||
TS.projects.foundations.globals.processModuleObjects.MODULE_OBJECTS_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_ENGINE_MODULE_OBJECT = TS.projects.algorithmicTrading.botModules.tradingEngine.newAlgorithmicTradingBotModulesTradingEngine(processIndex)
|
||||
let tradingOutputModuleObject = TS.projects.algorithmicTrading.botModules.tradingOutput.newAlgorithmicTradingBotModulesTradingOutput(processIndex)
|
||||
|
||||
let currentTimeFrame = {}
|
||||
|
||||
@@ -290,7 +290,7 @@
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
/* An unhandled exception occured. in this case we return Fail and log the stack. */
|
||||
/* An unhandled exception occurred. in this case we return Fail and log the stack. */
|
||||
if (err.stack) {
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).UNEXPECTED_ERROR = err
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
@@ -307,7 +307,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
/* Some other handled exception occured. We return Fail and move on. */
|
||||
/* Some other handled exception occurred. We return Fail and move on. */
|
||||
if (err.result !== TS.projects.foundations.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).UNEXPECTED_ERROR = err
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingRecords = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingRecords = function (processIndex) {
|
||||
/*
|
||||
This module facilitates the appending of records to the output of the process.
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ exports.newFoundationsBotModulesTradingRecords = function (processIndex) {
|
||||
we have a pointer to the node that have the information we need to extract.
|
||||
Later, based on the product record definition we will extract each individual value.
|
||||
*/
|
||||
let outputDatasets = TS.projects.foundations.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
|
||||
|
||||
for (let i = 0; i < outputDatasets.length; i++) {
|
||||
let outputDatasetNode = outputDatasets[i]
|
||||
+13
-12
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingSimulation = function (processIndex) {
|
||||
/*
|
||||
This Module represents the trading simulacion. Escentially a loop through a set of candles and
|
||||
the execution at each loop cycle of the Trading System Protocol.
|
||||
@@ -34,13 +34,13 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
'[INFO] runSimulation -> finalDatetime = ' + sessionParameters.timeRange.config.finalDatetime)
|
||||
|
||||
/* These are the Modules we will need to run the Simulation */
|
||||
let tradingRecordsModuleObject = TS.projects.foundations.botModules.tradingRecords.newFoundationsBotModulesTradingRecords(processIndex)
|
||||
let tradingRecordsModuleObject = TS.projects.algorithmicTrading.botModules.tradingRecords.newAlgorithmicTradingBotModulesTradingRecords(processIndex)
|
||||
tradingRecordsModuleObject.initialize(outputDatasetsMap)
|
||||
|
||||
let tradingSystemModuleObject = TS.projects.foundations.botModules.tradingSystem.newFoundationsBotModulesTradingSystem(processIndex)
|
||||
let tradingSystemModuleObject = TS.projects.algorithmicTrading.botModules.tradingSystem.newAlgorithmicTradingBotModulesTradingSystem(processIndex)
|
||||
tradingSystemModuleObject.initialize()
|
||||
|
||||
let tradingEpisodeModuleObject = TS.projects.foundations.botModules.tradingEpisode.newFoundationsBotModulesTradingEpisode(processIndex)
|
||||
let tradingEpisodeModuleObject = TS.projects.algorithmicTrading.botModules.tradingEpisode.newAlgorithmicTradingBotModulesTradingEpisode(processIndex)
|
||||
tradingEpisodeModuleObject.initialize()
|
||||
|
||||
/* Setting up the candles array: The whole simulation is based on the array of candles at the time-frame defined at the session parameters. */
|
||||
@@ -88,7 +88,8 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
This will happen when the sessionParameters.timeRange.config.initialDatetime is beyond the last candle available,
|
||||
meaning that the dataSet needs to be updated with more up-to-date data.
|
||||
*/
|
||||
TS.projects.foundations.functionLibraries.sessionFunctions.stopSession(processIndex, 'Data is not up-to-date enough. Please start the Masters Data Mining Operation.')
|
||||
console.log('DEBUGGING ..................', initialCandle, candles.length)
|
||||
TS.projects.foundations.functionLibraries.sessionFunctions.stopSession(processIndex, 'Data is not up-to-date enough. Please start the Data Mining Operation.')
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[IMPORTANT] runSimulation -> Data is not up-to-date enough. Stopping the Session now. ')
|
||||
return
|
||||
@@ -302,12 +303,12 @@ 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)
|
||||
|
||||
let currentDateString = heartBeatDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
|
||||
let currentDateString = heartBeatDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
|
||||
let currentDate = new Date(heartBeatDate)
|
||||
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
|
||||
/*
|
||||
@@ -317,7 +318,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
if (heartBeatDate.valueOf() !== previousHeartBeatDate) {
|
||||
previousHeartBeatDate = heartBeatDate.valueOf()
|
||||
|
||||
let processingDate = heartBeatDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
|
||||
let processingDate = heartBeatDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
|
||||
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[INFO] runSimulation -> loop -> Simulation ' + TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_KEY + ' Loop # ' + tradingEngine.tradingCurrent.tradingEpisode.candle.index.value + ' @ ' + processingDate)
|
||||
@@ -371,8 +372,8 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
|
||||
}
|
||||
|
||||
function positionChart(chart) {
|
||||
let dataDependencies = TS.projects.foundations.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
|
||||
dataDependencies = TS.projects.foundations.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
|
||||
let dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
|
||||
dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
|
||||
|
||||
/* Finding the Current Element on Daily Files */
|
||||
if (TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
|
||||
@@ -492,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
|
||||
@@ -506,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
|
||||
}
|
||||
|
||||
+92
-89
@@ -1,4 +1,4 @@
|
||||
exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingStages = function (processIndex) {
|
||||
/*
|
||||
This module packages all functions related to Stages.
|
||||
*/
|
||||
@@ -21,12 +21,12 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let tradingStrategyModuleObject = TS.projects.foundations.botModules.tradingStrategy.newFoundationsBotModulesTradingStrategy(processIndex)
|
||||
let tradingPositionModuleObject = TS.projects.foundations.botModules.tradingPosition.newFoundationsBotModulesTradingPosition(processIndex)
|
||||
let tradingExecutionModuleObject = TS.projects.foundations.botModules.tradingExecution.newFoundationsBotModulesTradingExecution(processIndex)
|
||||
let announcementsModuleObject = TS.projects.foundations.botModules.announcements.newFoundationsBotModulesAnnouncements(processIndex)
|
||||
let snapshotsModuleObject = TS.projects.foundations.botModules.snapshots.newFoundationsBotModulesSnapshots(processIndex)
|
||||
let tradingEpisodeModuleObject = TS.projects.foundations.botModules.tradingEpisode.newFoundationsBotModulesTradingEpisode(processIndex)
|
||||
let tradingStrategyModuleObject = TS.projects.algorithmicTrading.botModules.tradingStrategy.newAlgorithmicTradingBotModulesTradingStrategy(processIndex)
|
||||
let tradingPositionModuleObject = TS.projects.algorithmicTrading.botModules.tradingPosition.newAlgorithmicTradingBotModulesTradingPosition(processIndex)
|
||||
let tradingExecutionModuleObject = TS.projects.algorithmicTrading.botModules.tradingExecution.newAlgorithmicTradingBotModulesTradingExecution(processIndex)
|
||||
let announcementsModuleObject = TS.projects.socialBots.botModules.announcements.newSocialBotsBotModulesAnnouncements(processIndex)
|
||||
let snapshotsModuleObject = TS.projects.algorithmicTrading.botModules.snapshots.newAlgorithmicTradingBotModulesSnapshots(processIndex)
|
||||
let tradingEpisodeModuleObject = TS.projects.algorithmicTrading.botModules.tradingEpisode.newAlgorithmicTradingBotModulesTradingEpisode(processIndex)
|
||||
|
||||
let tradingEngine
|
||||
let tradingSystem
|
||||
@@ -147,8 +147,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
/* Initialize this */
|
||||
tradingEngine.tradingCurrent.tradingEpisode.distanceToTradingEvent.triggerOn.value = 1
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(triggerStage.triggerOn)
|
||||
announcementsModuleObject.makeAnnoucements(triggerStage)
|
||||
announcementsModuleObject.makeAnnouncements(triggerStage.triggerOn)
|
||||
|
||||
if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type === 'Backtesting Session') {
|
||||
if (sessionParameters.snapshots !== undefined) {
|
||||
@@ -159,6 +158,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
}
|
||||
|
||||
changeStageStatus('Trigger Stage', 'Open')
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,7 +194,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
tradingSystem.highlights.push(triggerStage.id)
|
||||
|
||||
tradingEngine.tradingCurrent.tradingEpisode.distanceToTradingEvent.triggerOff.value = 1
|
||||
announcementsModuleObject.makeAnnoucements(triggerStage.triggerOff)
|
||||
announcementsModuleObject.makeAnnouncements(triggerStage.triggerOff)
|
||||
changeStageStatus('Trigger Stage', 'Closed', 'Trigger Off Event')
|
||||
tradingStrategyModuleObject.closeStrategy('Trigger Off')
|
||||
}
|
||||
@@ -233,8 +233,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
|
||||
tradingPositionModuleObject.openPosition(situation.name)
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(triggerStage.takePosition)
|
||||
announcementsModuleObject.makeAnnoucements(strategy.openStage)
|
||||
announcementsModuleObject.makeAnnouncements(triggerStage.takePosition)
|
||||
|
||||
if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type === 'Backtesting Session') {
|
||||
if (sessionParameters.snapshots !== undefined) {
|
||||
@@ -436,7 +435,6 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
|
||||
/* Now we switch to the Open status. */
|
||||
changeStageStatus('Manage Stage', 'Open')
|
||||
announcementsModuleObject.makeAnnoucements(manageStage)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +485,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
tradingPositionModuleObject.applyStopLossFormula(tradingSystem.formulas, phase.formula.id)
|
||||
|
||||
if (tradingEngine.tradingCurrent.position.stopLoss.value !== previousValue) {
|
||||
announcementsModuleObject.makeAnnoucements(phase)
|
||||
announcementsModuleObject.makeAnnouncements(phase)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,7 +508,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
tradingPositionModuleObject.applyTakeProfitFormula(tradingSystem.formulas, phase.formula.id)
|
||||
|
||||
if (tradingEngine.tradingCurrent.position.takeProfit.value !== previousValue) {
|
||||
announcementsModuleObject.makeAnnoucements(phase)
|
||||
announcementsModuleObject.makeAnnouncements(phase)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -591,7 +589,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
|
||||
tradingPositionModuleObject.updateStopLoss(tradingEngine.tradingCurrent.position.stopLoss.stopLossPhase.value + 1)
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(nextPhaseEvent)
|
||||
announcementsModuleObject.makeAnnouncements(nextPhaseEvent)
|
||||
|
||||
/* Reset this counter */
|
||||
tradingEngine.tradingCurrent.tradingEpisode.distanceToTradingEvent.nextPhase.value = 1
|
||||
@@ -642,7 +640,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
continue
|
||||
}
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(moveToPhaseEvent)
|
||||
announcementsModuleObject.makeAnnouncements(moveToPhaseEvent)
|
||||
|
||||
/* Reset this counter */
|
||||
tradingEngine.tradingCurrent.tradingEpisode.distanceToTradingEvent.moveToPhase.value = 1
|
||||
@@ -698,7 +696,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
|
||||
tradingPositionModuleObject.updateTakeProfit(tradingEngine.tradingCurrent.position.takeProfit.takeProfitPhase.value + 1)
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(nextPhaseEvent)
|
||||
announcementsModuleObject.makeAnnouncements(nextPhaseEvent)
|
||||
|
||||
/* Reset this counter */
|
||||
tradingEngine.tradingCurrent.tradingEpisode.distanceToTradingEvent.nextPhase.value = 1
|
||||
@@ -749,7 +747,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
continue
|
||||
}
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(moveToPhaseEvent)
|
||||
announcementsModuleObject.makeAnnouncements(moveToPhaseEvent)
|
||||
|
||||
/* Reset this counter */
|
||||
tradingEngine.tradingCurrent.tradingEpisode.distanceToTradingEvent.moveToPhase.value = 1
|
||||
@@ -762,54 +760,50 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
}
|
||||
|
||||
function checkStopLossOrTakeProfitWasHit() {
|
||||
{
|
||||
let strategy = tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value]
|
||||
/*
|
||||
Checking what happened since the last execution. We need to know if the Stop Loss
|
||||
or our Take Profit were hit.
|
||||
*/
|
||||
let strategy = tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value]
|
||||
/*
|
||||
Checking what happened since the last execution. We need to know if the Stop Loss
|
||||
or our Take Profit were hit.
|
||||
*/
|
||||
|
||||
/* Stop Loss condition: Here we verify if the Stop Loss was hit or not. */
|
||||
if (
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.stopLoss.stopLossPosition.value === 'Above' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.max.value >= tradingEngine.tradingCurrent.position.stopLoss.value
|
||||
) ||
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.stopLoss.stopLossPosition.value === 'Below' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.min.value <= tradingEngine.tradingCurrent.position.stopLoss.value
|
||||
)
|
||||
) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[INFO] checkStopLossOrTakeProfitWasHit -> Stop Loss was hit.')
|
||||
/* Stop Loss condition: Here we verify if the Stop Loss was hit or not. */
|
||||
if (
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.stopLoss.stopLossPosition.value === 'Above' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.max.value >= tradingEngine.tradingCurrent.position.stopLoss.value
|
||||
) ||
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.stopLoss.stopLossPosition.value === 'Below' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.min.value <= tradingEngine.tradingCurrent.position.stopLoss.value
|
||||
)
|
||||
) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[INFO] checkStopLossOrTakeProfitWasHit -> Stop Loss was hit.')
|
||||
|
||||
tradingPositionModuleObject.closingPosition('Stop Loss')
|
||||
changeStageStatus('Close Stage', 'Opening')
|
||||
changeStageStatus('Manage Stage', 'Closed', 'Stop Loss Hit')
|
||||
announcementsModuleObject.makeAnnoucements(strategy.closeStage)
|
||||
return
|
||||
}
|
||||
|
||||
/* Take Profit condition: Here we verify if the Take Profit was hit or not. */
|
||||
if (
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.takeProfit.takeProfitPosition.value === 'Below' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.min.value <= tradingEngine.tradingCurrent.position.takeProfit.value
|
||||
) ||
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.takeProfit.takeProfitPosition.value === 'Above' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.max.value >= tradingEngine.tradingCurrent.position.takeProfit.value
|
||||
)
|
||||
) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[INFO] checkStopLossOrTakeProfitWasHit -> Take Profit was hit.')
|
||||
|
||||
tradingPositionModuleObject.closingPosition('Take Profit')
|
||||
changeStageStatus('Close Stage', 'Opening')
|
||||
changeStageStatus('Manage Stage', 'Closed', 'Take Profit Hit')
|
||||
announcementsModuleObject.makeAnnoucements(strategy.closeStage)
|
||||
return
|
||||
}
|
||||
tradingPositionModuleObject.closingPosition('Stop Loss')
|
||||
changeStageStatus('Close Stage', 'Opening')
|
||||
changeStageStatus('Manage Stage', 'Closed', 'Stop Loss Hit')
|
||||
return
|
||||
}
|
||||
|
||||
/* Take Profit condition: Here we verify if the Take Profit was hit or not. */
|
||||
if (
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.takeProfit.takeProfitPosition.value === 'Below' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.min.value <= tradingEngine.tradingCurrent.position.takeProfit.value
|
||||
) ||
|
||||
(
|
||||
tradingEngine.tradingCurrent.position.takeProfit.takeProfitPosition.value === 'Above' &&
|
||||
tradingEngine.tradingCurrent.tradingEpisode.candle.max.value >= tradingEngine.tradingCurrent.position.takeProfit.value
|
||||
)
|
||||
) {
|
||||
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[INFO] checkStopLossOrTakeProfitWasHit -> Take Profit was hit.')
|
||||
|
||||
tradingPositionModuleObject.closingPosition('Take Profit')
|
||||
changeStageStatus('Close Stage', 'Opening')
|
||||
changeStageStatus('Manage Stage', 'Closed', 'Take Profit Hit')
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1114,7 +1108,7 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
tradingSystem.highlights.push(closeStageEvent.id)
|
||||
tradingSystem.highlights.push(stage.id)
|
||||
|
||||
announcementsModuleObject.makeAnnoucements(closeStageEvent)
|
||||
announcementsModuleObject.makeAnnouncements(closeStageEvent)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -1148,10 +1142,12 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
if (stage.status.value === 'Open') {
|
||||
openStage(stage)
|
||||
checkUserDefinedCode(stageName, 'Open')
|
||||
checkAnnounce(stageName, stage.status.value)
|
||||
}
|
||||
if (stage.status.value === 'Closed') {
|
||||
checkUserDefinedCode(stageName, 'Closed')
|
||||
closeStage(stage, stageName)
|
||||
checkAnnounce(stageName, stage.status.value)
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1186,7 +1182,6 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
if (stageName === 'Close Stage') {
|
||||
if (tradingEngine.tradingCurrent.position.status.value === 'Open') {
|
||||
tradingPositionModuleObject.closingPosition('Close Stage Closed')
|
||||
/* NOTE:TODO: Announcement May need added Here */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1271,33 +1266,41 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
|
||||
/* checkUserDefinedCode(): Checks if User Defined Code exists and processes if applicable. */
|
||||
function checkUserDefinedCode(stage, status, when) {
|
||||
let tradingSystemStage = getTradingSystemStage(stage);
|
||||
let tradingSystemStage = getTradingSystemStage(stage);
|
||||
|
||||
if (tradingSystemStage !== undefined &&
|
||||
tradingSystemStage.userDefinedCode !== undefined) {
|
||||
if (status === 'Running' && when !== tradingSystemStage.userDefinedCode.config.whileAtStageWhenToRun) { return; }
|
||||
if (tradingSystemStage !== undefined &&
|
||||
tradingSystemStage.userDefinedCode !== undefined) {
|
||||
if (status === 'Running' && when !== tradingSystemStage.userDefinedCode.config.whileAtStageWhenToRun) { return; }
|
||||
|
||||
switch(status) {
|
||||
case 'Open' : {
|
||||
if (tradingSystemStage.userDefinedCode.config.runWhenEnteringStage) {
|
||||
tradingSystem.evalUserCode(tradingSystemStage, 'User Defined Code');
|
||||
switch(status) {
|
||||
case 'Open' : {
|
||||
if (tradingSystemStage.userDefinedCode.config.runWhenEnteringStage) {
|
||||
tradingSystem.evalUserCode(tradingSystemStage, 'User Defined Code');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'Running' : {
|
||||
if (tradingSystemStage.userDefinedCode.config.runWhileAtStage) {
|
||||
tradingSystem.evalUserCode(tradingSystemStage, 'User Defined Code');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'Closed' : {
|
||||
if (tradingSystemStage.userDefinedCode.config.runWhenExitingStage) {
|
||||
tradingSystem.evalUserCode(tradingSystemStage, 'User Defined Code');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'Running' : {
|
||||
if (tradingSystemStage.userDefinedCode.config.runWhileAtStage) {
|
||||
tradingSystem.evalUserCode(tradingSystemStage, 'User Defined Code');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'Closed' : {
|
||||
if (tradingSystemStage.userDefinedCode.config.runWhenExitingStage) {
|
||||
tradingSystem.evalUserCode(tradingSystemStage, 'User Defined Code');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checkAnnounce(): Check if stage announcement should be made
|
||||
function checkAnnounce(stage, status) {
|
||||
let tradingSystemStage = getTradingSystemStage(stage);
|
||||
if (status === 'Open' || status === 'Closed') {
|
||||
announcementsModuleObject.makeAnnouncements(tradingSystemStage, status)
|
||||
}
|
||||
}
|
||||
|
||||
/* getTradingSystemStage(): takes stage name returns stage object. */
|
||||
@@ -1321,4 +1324,4 @@ exports.newFoundationsBotModulesTradingStages = function (processIndex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
exports.newFoundationsBotModulesTradingStrategy = function (processIndex) {
|
||||
exports.newAlgorithmicTradingBotModulesTradingStrategy = function (processIndex) {
|
||||
/*
|
||||
This module packages all functions related to Strategies.
|
||||
*/
|
||||
const MODULE_NAME = 'Trading Strategy'
|
||||
|
||||
let thisObject = {
|
||||
mantain: mantain,
|
||||
reset: reset,
|
||||
Loaded 100 of 2030 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user