Improvement: Social Bot Command Node
This commit is contained in:
1 parent
9b76822a1c
commit
2e32d102de
8 files changed
+283
-79
No files matched your search
@@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="96 11 512 512"
|
||||
style="enable-background:new 96 11 512 512;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="social-bot-command.svg"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><metadata
|
||||
id="metadata53"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs51" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview49"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.83007813"
|
||||
inkscape:cx="182.08508"
|
||||
inkscape:cy="290.76293"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<style
|
||||
type="text/css"
|
||||
id="style2">
|
||||
.st0{display:none;fill:#020202;}
|
||||
.st1{fill:#FD6A33;}
|
||||
.st2{fill:#FF8C29;}
|
||||
.st3{fill:#CDD4D5;}
|
||||
.st4{fill:#9BAAAB;}
|
||||
.st5{fill:#4ACFD9;}
|
||||
.st6{fill:#0295AA;}
|
||||
.st7{fill:#365558;}
|
||||
.st8{fill:#FFD1A9;}
|
||||
.st9{fill:#F0353D;}
|
||||
</style>
|
||||
<rect
|
||||
x="302"
|
||||
y="-195"
|
||||
class="st0"
|
||||
width="512"
|
||||
height="512"
|
||||
id="rect4" />
|
||||
<path
|
||||
class="st1"
|
||||
d="m 180.62706,157.4 h -5.6 -5.7 c -7.3,0 -13.2,6 -13.2,13.2 v 57 c 0,7.3 6,13.2 13.2,13.2 h 5.7 5.6 c 3.3,0 6.1,-2.7 6.1,-6.1 v -71.3 c 0,-3.1 -2.7,-6 -6.1,-6 z"
|
||||
id="path6" />
|
||||
<path
|
||||
class="st2"
|
||||
d="m 409.42706,240.8 h -5.6 c -3.3,0 -6.1,-2.7 -6.1,-6.1 v -71.3 c 0,-3.3 2.7,-6.1 6.1,-6.1 h 5.6 5.7 c 7.3,0 13.2,6 13.2,13.2 v 57.1 c 0,7.3 -6,13.2 -13.2,13.2 z"
|
||||
id="path8" />
|
||||
<path
|
||||
class="st2"
|
||||
d="m 387.22706,134.6 v 115.3 c 0,16.8 -13.7,30.5 -30.5,30.5 h -64.5 v -215.3 0 c 8,0 14.6,6.6 14.6,14.6 v 16.6 c 0,4.2 3.9,8 8,8 h 41.9 c 16.7,-0.2 30.5,13.5 30.5,30.3 z m -61.4,103.1 h 16.6 c 1.7,0 3.2,-1.4 3.2,-3.2 v -5.1 c 0,-1.7 -1.4,-3.2 -3.2,-3.2 h -16.6 c -1.7,0 -3.2,1.4 -3.2,3.2 v 5.1 c 0,1.7 1.5,3.2 3.2,3.2 z m 8.3,-50.3 c 8.4,0 15.2,-6.8 15.2,-15.2 0,-8.4 -6.8,-15.2 -15.2,-15.2 -8.4,0 -15.2,6.8 -15.2,15.2 0,8.4 6.8,15.2 15.2,15.2 z m -33.4,38.8 h -8.5 v 11.4 h 8.5 c 1.6,0 3,-1.3 3,-3 v -5.5 c 0,-1.5 -1.3,-2.9 -3,-2.9 z"
|
||||
id="path10" />
|
||||
<path
|
||||
class="st1"
|
||||
d="m 292.22706,64.9 v 215.5 h -64.4 c -16.8,0 -30.5,-13.7 -30.5,-30.5 V 134.6 c 0,-16.8 13.7,-30.5 30.5,-30.5 h 40.6 c 4.5,0 9.2,-3.4 9.2,-8 V 79.5 c 0.1,-8 6.6,-14.6 14.6,-14.6 z m -33.4,161.3 h -17 c -1.6,0 -3,1.3 -3,3 v 5.5 c 0,1.6 1.3,3 3,3 h 17 c 1.6,0 3,-1.3 3,-3 v -5.5 c 0,-1.6 -1.4,-3 -3,-3 z m -8.5,-69.3 c -8.4,0 -15.2,6.8 -15.2,15.2 0,8.4 6.8,15.2 15.2,15.2 8.4,0 15.2,-6.8 15.2,-15.2 0,-8.3 -6.8,-15.2 -15.2,-15.2 z m 33.4,69.3 c -1.6,0 -3,1.3 -3,3 v 5.5 c 0,1.6 1.3,3 3,3 h 8.5 v -11.5 z"
|
||||
id="path12" />
|
||||
<path
|
||||
class="st3"
|
||||
d="m 292.32706,311.5 c -0.1,0 -0.1,0 -0.1,0 v 18.3 h 0.1 c 5.1,0 9.2,-4.1 9.2,-9.2 0,-5.1 -4.1,-9.1 -9.2,-9.1 z"
|
||||
id="path14" />
|
||||
<path
|
||||
class="st4"
|
||||
d="m 283.22706,320.8 c 0,5 4,9.1 9,9.2 v -18.4 c -5,0 -9,4.2 -9,9.2 z"
|
||||
id="path16" />
|
||||
<path
|
||||
class="st5"
|
||||
d="m 292.42706,353.6 c -0.1,0 -0.2,0 -0.2,0 v 27.2 c 0.1,0 0.2,0 0.2,0 7.5,0 13.6,-6.1 13.6,-13.6 0,-7.4 -6.1,-13.6 -13.6,-13.6 z"
|
||||
id="path18" />
|
||||
<path
|
||||
class="st6"
|
||||
d="m 278.92706,367.3 c 0,7.4 5.9,13.4 13.3,13.6 v -27.1 c -7.4,0 -13.3,6 -13.3,13.5 z"
|
||||
id="path20" />
|
||||
<path
|
||||
class="st5"
|
||||
d="m 292.42706,394 c -0.1,0 -0.2,0 -0.2,0 v 27 c 0.1,0 0.2,0 0.2,0 7.5,0 13.6,-6.1 13.6,-13.6 0,-7.4 -6.1,-13.4 -13.6,-13.4 z"
|
||||
id="path22" />
|
||||
<path
|
||||
class="st6"
|
||||
d="m 278.92706,407.5 c 0,7.4 5.9,13.4 13.3,13.6 V 394 c -7.4,0 -13.3,6.1 -13.3,13.5 z"
|
||||
id="path24" />
|
||||
<path
|
||||
class="st5"
|
||||
d="m 292.42706,434.3 c -0.1,0 -0.2,0 -0.2,0 v 27.1 c 0.1,0 0.2,0 0.2,0 7.5,0 13.6,-6.1 13.6,-13.6 0,-7.5 -6.1,-13.5 -13.6,-13.5 z"
|
||||
id="path26" />
|
||||
<path
|
||||
class="st6"
|
||||
d="m 278.92706,447.8 c 0,7.4 5.9,13.4 13.3,13.6 v -27.1 c -7.4,0 -13.3,6 -13.3,13.5 z"
|
||||
id="path28" />
|
||||
<path
|
||||
class="st7"
|
||||
d="m 239.92706,357 c -1.6,-4.9 -7,-8.9 -12.2,-8.9 h -36.2 c -5.2,0 -7.2,3.6 -4.5,8 l 10.9,18 c 2.7,4.4 2.7,11.6 0.1,16.1 l -11.1,18.8 c -2.6,4.4 -1.7,11 1.9,14.6 l 98.2,96.5 c 1.5,1.4 2.6,2.1 3.4,2.1 1.1,0 1.4,-1.6 0.5,-4.5 z"
|
||||
id="path30" />
|
||||
<path
|
||||
class="st4"
|
||||
d="m 284.92706,309 c -0.5,-0.2 -1,-0.4 -1.4,-0.5 l -26.8,-7.7 c -2.5,-0.7 -4.9,-0.4 -6.8,1 -1.8,1.4 -2.8,3.6 -2.8,6.2 v 22.5 c 0,2.6 1,4.9 2.8,6.3 1.3,1 2.8,1.5 4.4,1.5 0.8,0 1.6,-0.1 2.4,-0.3 l 26.4,-7 c -2.8,-2.5 -4.6,-6.2 -4.6,-10.3 0,-4.9 2.6,-9.2 6.4,-11.7 z"
|
||||
id="path32" />
|
||||
<path
|
||||
class="st6"
|
||||
d="m 356.82706,348 h 36.2 c 5.2,0 7.2,3.6 4.5,8 l -10.9,18 c -2.7,4.4 -2.7,11.6 -0.1,16.1 l 11.1,18.8 c 2.6,4.4 1.7,11 -1.9,14.6 l -98.2,96.5 c -1.5,1.4 -2.6,2.1 -3.4,2.1 -1.1,0 -1.4,-1.6 -0.5,-4.5 l 51,-160.8 c 1.6,-4.8 7.1,-8.8 12.2,-8.8"
|
||||
id="path34" />
|
||||
<path
|
||||
class="st3"
|
||||
d="m 306.42706,320.8 c 0,-4.9 -2.6,-9.2 -6.4,-11.7 0.5,-0.2 1,-0.4 1.4,-0.5 l 26.8,-7.7 c 2.5,-0.7 4.9,-0.4 6.8,1 1.8,1.4 2.8,3.6 2.8,6.2 v 22.5 c 0,2.6 -1,4.9 -2.8,6.3 -1.3,1 -2.8,1.5 -4.4,1.5 -0.8,0 -1.6,-0.1 -2.4,-0.3 l -26.4,-7 c 2.8,-2.7 4.6,-6.3 4.6,-10.3 z"
|
||||
id="path36" />
|
||||
<path
|
||||
class="st8"
|
||||
d="m 169.22706,207.6 c 0.6,0.9 0.9,2.1 0.5,3.2 -1.5,6.3 -0.3,12.9 3.3,18.1 1.2,1.7 0.8,4.1 -0.7,5.4 -1.7,1.3 -4,1 -5.2,-0.6 -5,-6.9 -6.6,-15.8 -4.5,-24.3 0.5,-2.1 2.5,-3.4 4.5,-2.9 1,-0.1 1.5,0.4 2.1,1.1 z"
|
||||
id="path38" />
|
||||
<path
|
||||
class="st8"
|
||||
d="m 417.82706,206.4 c 2,-0.5 4,0.9 4.5,2.9 2.2,8.5 0.5,17.4 -4.5,24.3 -1.2,1.6 -3.5,1.9 -5.2,0.6 -1.5,-1.3 -2,-3.7 -0.7,-5.4 3.6,-5.2 4.8,-11.7 3.3,-18.1 -0.4,-1.1 -0.1,-2.3 0.5,-3.2 0.5,-0.6 1.1,-1.1 2.1,-1.1 z"
|
||||
id="path40" />
|
||||
<path
|
||||
class="st9"
|
||||
d="m 297.52706,17.5 -0.4,23.8 c -0.1,3.2 -2.6,5.7 -5.9,5.8 -3.2,0 -5.7,-2.5 -5.6,-5.7 l 0.4,-23.8 c 0.1,-3.2 2.6,-5.7 5.9,-5.8 3.1,0 5.6,2.5 5.6,5.7 z"
|
||||
id="path42" />
|
||||
<path
|
||||
class="st9"
|
||||
d="m 331.82706,32.5 c 0,1.5 -0.6,3 -1.8,4.1 l -15.4,15.3 c -2.3,2.3 -5.9,2.3 -8.2,0 -2.2,-2.2 -2.1,-5.8 0.2,-8.2 l 15.4,-15.3 c 2.3,-2.3 5.9,-2.3 8.2,0 1.2,1.1 1.7,2.7 1.6,4.1 z"
|
||||
id="path44" />
|
||||
<path
|
||||
class="st9"
|
||||
d="m 277.52706,48 c 0,1.5 -0.6,3 -1.8,4.1 -2.3,2.3 -5.9,2.3 -8.2,0 l -14.9,-15 c -2.2,-2.2 -2.1,-5.8 0.2,-8.2 2.3,-2.3 5.9,-2.3 8.2,0 l 14.9,15 c 1,1.2 1.6,2.6 1.6,4.1 z"
|
||||
id="path46" />
|
||||
<path
|
||||
style="fill:#4acfd9;stroke-width:0.5"
|
||||
d="m 434.42146,325.0573 h -65 c -2.001,0 -3.6225,1.6215 -3.6225,3.6225 v 69.334 c 0,2.001 1.6215,3.6225 3.6225,3.6225 h 65.0005 c 2.001,0 3.6225,-1.6215 3.6225,-3.6225 v -69.334 c -5e-4,-2.001 -1.6215,-3.6225 -3.623,-3.6225 z"
|
||||
id="path2" /><path
|
||||
style="fill:#687f82;stroke-width:0.5"
|
||||
d="m 434.42146,413.9328 h -65 c -2.001,0 -3.6225,1.622 -3.6225,3.6225 v 69.334 c 0,2.001 1.6215,3.6225 3.6225,3.6225 h 65.0005 c 2.001,0 3.6225,-1.6215 3.6225,-3.6225 v -69.334 c -5e-4,-2.0005 -1.6215,-3.6225 -3.623,-3.6225 z"
|
||||
id="path4" /><path
|
||||
style="fill:#ff8c29;stroke-width:0.5"
|
||||
d="m 520.12296,325.0573 h -65 c -2.001,0 -3.6225,1.6215 -3.6225,3.6225 v 69.334 c 0,2.001 1.6215,3.6225 3.6225,3.6225 h 65.0005 c 2.001,0 3.6225,-1.6215 3.6225,-3.6225 v -69.334 c 0,-2.001 -1.6215,-3.6225 -3.623,-3.6225 z"
|
||||
id="path6-0" /><path
|
||||
style="fill:#f0353d;stroke-width:0.5"
|
||||
d="m 520.12296,413.9328 h -65 c -2.001,0 -3.6225,1.622 -3.6225,3.6225 v 69.334 c 0,2.001 1.6215,3.6225 3.6225,3.6225 h 65.0005 c 2.001,0 3.6225,-1.6215 3.6225,-3.6225 v -69.334 c 0,-2.0005 -1.6215,-3.6225 -3.623,-3.6225 z"
|
||||
id="path8-8" /><path
|
||||
style="fill:#cdd4d5;stroke-width:0.5"
|
||||
d="m 555.86146,318.8653 -27.3235,-27.3235 c -1.415,-1.4145 -3.7085,-1.4145 -5.1235,0 l -92.901,92.9 c -0.18,0.1805 -0.341,0.3795 -0.4795,0.5935 l -30.056,46.451 c -0.928,1.434 -0.728,3.3215 0.4795,4.5295 l 10.9295,10.9295 c 0.7,0.6995 1.6275,1.0605 2.5635,1.0605 0.679,0 1.363,-0.191 1.9665,-0.581 l 46.4505,-30.0565 c 0.214,-0.1385 0.413,-0.2995 0.5935,-0.4795 l 92.901,-92.9 c 1.4145,-1.415 1.4145,-3.7085 -5e-4,-5.1235 z"
|
||||
id="path10-8" /><path
|
||||
style="fill:#ff8c29;stroke-width:0.5"
|
||||
d="m 574.98848,272.4153 c -8.946,-8.9455 -23.50102,-8.9455 -32.44752,0 l -21.859,21.859 c -1.4145,1.415 -1.4145,3.7085 0,5.1235 l 27.3235,27.3235 c 0.7075,0.707 1.635,1.0605 2.562,1.0605 0.927,0 1.8545,-0.3535 2.562,-1.0605 l 21.85903,-21.859 c 4.3335,-4.3335 6.7195,-10.095 6.7195,-16.2235 0,-6.129 -2.3865,-11.89 -6.71951,-16.2235 z"
|
||||
id="path12-2" /><path
|
||||
style="fill:#ffffff;stroke-width:0.5"
|
||||
d="m 545.10296,294.9938 c -0.927,0 -1.8545,-0.3535 -2.562,-1.0605 -1.4145,-1.415 -1.4145,-3.7085 0,-5.1235 l 8.1975,-8.1975 c 1.415,-1.4145 3.7085,-1.4145 5.1235,0 1.415,1.415 1.415,3.7085 0,5.1235 l -8.197,8.1975 c -0.7075,0.7065 -1.635,1.0605 -2.562,1.0605 z"
|
||||
id="path14-7" /><path
|
||||
style="fill:#fd6a33;stroke-width:0.5"
|
||||
d="m 572.25648,329.7953 -54.64802,-54.648 c -1.4155,-1.4145 -3.7085,-1.4145 -5.1235,0 l -13.6615,13.6615 c -1.4145,1.415 -1.4145,3.7085 0,5.1235 l 54.6475,54.648 c 0.7075,0.707 1.6345,1.0605 2.562,1.0605 0.927,0 1.8545,-0.3535 2.5615,-1.0605 l 13.66202,-13.6615 c 0.6795,-0.6795 1.061,-1.6005 1.061,-2.562 -4.9e-4,-0.961 -0.382,-1.882 -1.061,-2.5615 z"
|
||||
id="path16-3" /><path
|
||||
style="fill:#f0353d;stroke-width:0.5"
|
||||
d="m 545.03846,302.5773 -18.7855,18.7855 27.217,27.217 c 0.7075,0.707 1.6345,1.0605 2.562,1.0605 0.927,0 1.8545,-0.3535 2.5615,-1.0605 l 13.66203,-13.6615 c 0.67949,-0.6795 1.06099,-1.6005 1.06099,-2.562 0,-0.9605 -0.3815,-1.882 -1.06049,-2.562 z"
|
||||
id="path18-8" /><g
|
||||
id="g24"
|
||||
transform="matrix(0.5,0,0,0.5,361.35046,265.7063)"><path
|
||||
style="fill:#ffffff"
|
||||
d="m 170.774,255.305 c -1.854,0 -3.709,-0.707 -5.123,-2.121 -2.83,-2.829 -2.83,-7.417 -0.001,-10.247 l 21.859,-21.859 c 2.83,-2.83 7.418,-2.83 10.246,-0.001 2.83,2.83 2.83,7.417 0.001,10.246 l -21.859,21.859 c -1.414,1.416 -3.269,2.123 -5.123,2.123 z"
|
||||
id="path20-5" /><path
|
||||
style="fill:#ffffff"
|
||||
d="m 214.492,211.587 c -1.854,0 -3.709,-0.707 -5.124,-2.121 -2.83,-2.83 -2.83,-7.417 0,-10.247 l 76.505,-76.506 c 2.831,-2.83 7.418,-2.828 10.247,0 2.83,2.83 2.83,7.417 0,10.247 l -76.505,76.506 c -1.414,1.414 -3.269,2.121 -5.123,2.121 z"
|
||||
id="path22-7" /></g></svg>
|
||||
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"level": 4,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Target Size In Base Asset->Target Size In Quoted Asset->Target Rate->Phase->Simulated Actual Rate->Situation->Indicator Function->Order Rate->"
|
||||
"compatibleTypes": "->Target Size In Base Asset->Target Size In Quoted Asset->Target Rate->Phase->Simulated Actual Rate->Situation->Indicator Function->Order Rate->Social Bot Command->"
|
||||
},
|
||||
"propertyNameAtParent": "formula"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"type": "Social Bot Command",
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "formula",
|
||||
"label": "Add Formula",
|
||||
"relatedUiObject": "Formula",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"initialValues": {
|
||||
"config": "{ \n\"name\": \"Enter the name of the command without a leading slash\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 4,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Telegram Bot->"
|
||||
},
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "formula",
|
||||
"type": "node",
|
||||
"childType": "Formula",
|
||||
"autoAdd": true
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "socialBotCommand"
|
||||
}
|
||||
@@ -11,6 +11,12 @@
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Social Bot Command",
|
||||
"relatedUiObject": "Social Bot Command",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Send Telegram Test Message",
|
||||
"label": "Send Telegram Test Message",
|
||||
@@ -36,6 +42,13 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Social Bots->"
|
||||
},
|
||||
"childrenNodesProperties": [],
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "socialBotCommand",
|
||||
"type": "array",
|
||||
"childType": "Social Bot Command",
|
||||
"autoAdd": true
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "telegramBots"
|
||||
}
|
||||
@@ -16,16 +16,15 @@ exports.newSuperalgosBotModulesSocialBots = function (processIndex) {
|
||||
if (prop.toLowerCase().includes("Bots".toLowerCase())) {
|
||||
for (let i = 0; i < TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop].length; i++) {
|
||||
let socialBot = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop][i]
|
||||
let config = socialBot.config
|
||||
let commands = socialBot.socialBotCommand
|
||||
if (socialBot.type === "Telegram Bot") {
|
||||
let config = socialBot.config
|
||||
socialBot.botInstance = TS.projects.superalgos.botModules.telegramBot.newSuperalgosBotModulesTelegramBot(processIndex)
|
||||
socialBot.botInstance.initialize(config.botToken, config.chatId)
|
||||
socialBot.botInstance.initialize(config, commands)
|
||||
} else if (socialBot.type === "Discord Bot") {
|
||||
let config = socialBot.config
|
||||
socialBot.botInstance = TS.projects.superalgos.botModules.discordBot.newSuperalgosBotModulesDiscordBot(processIndex)
|
||||
socialBot.botInstance.initialize(config)
|
||||
} else if (socialBot.type === "Slack Bot") {
|
||||
let config = socialBot.config
|
||||
socialBot.botInstance = TS.projects.superalgos.botModules.slackBot.newSuperalgosBotModulesSlackBot(processIndex)
|
||||
socialBot.botInstance.initialize(config)
|
||||
}
|
||||
|
||||
@@ -14,9 +14,12 @@ exports.newSuperalgosBotModulesTelegramBot = function (processIndex) {
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize(botToken, chatId) {
|
||||
function initialize(config, commands) {
|
||||
/* Telegram Bot Initialization */
|
||||
try {
|
||||
let botToken = config.botToken
|
||||
let chatId = config.chatId
|
||||
|
||||
thisObject.chatId = chatId
|
||||
|
||||
const Telegraf = require('telegraf')
|
||||
@@ -25,16 +28,17 @@ exports.newSuperalgosBotModulesTelegramBot = function (processIndex) {
|
||||
thisObject.telegramBot.start((ctx) => ctx.reply('Hi! I am the Telegram Bot that will tell you what happens with your trading session.'))
|
||||
thisObject.telegramBot.help((ctx) => ctx.replyWithHTML('<b><u>SUPERALGOS BOT HELP</u></b>\n\n' +
|
||||
'• Use /stop to stop the session.\n' +
|
||||
'• Use /help to receive this help message.\n' +
|
||||
'• Use /balances for episode balances.\n' +
|
||||
'• Use /counters for episode counters.\n' +
|
||||
'• Use /statistics for episode statistics.\n' +
|
||||
'• Use /uptime for episode uptime.'))
|
||||
'• Use /help to receive this help message.\n\n' +
|
||||
'Additional commands can be configured using the Social Bot Command node.'))
|
||||
thisObject.telegramBot.command('stop', (ctx) => TS.projects.superalgos.functionLibraries.sessionFunctions.stopSession(processIndex, 'by command from Telegram.'))
|
||||
thisObject.telegramBot.command('balances', (ctx) => interpretCommand('balances', processIndex))
|
||||
thisObject.telegramBot.command('uptime', (ctx) => interpretCommand('uptime', processIndex))
|
||||
thisObject.telegramBot.command('statistics', (ctx) => interpretCommand('statistics', processIndex))
|
||||
thisObject.telegramBot.command('counters', (ctx) => interpretCommand('counters', processIndex))
|
||||
|
||||
/* Set up additional commands for each Social Bot Command node */
|
||||
if(commands !== undefined) {
|
||||
for (let i = 0; i < commands.length; i++) {
|
||||
thisObject.telegramBot.command(commands[i].config.name, (ctx) => interpretCommand(commands[i].formula.code, processIndex))
|
||||
}
|
||||
}
|
||||
|
||||
thisObject.telegramBot.launch()
|
||||
|
||||
const Telegram = require('telegraf/telegram')
|
||||
@@ -67,72 +71,28 @@ exports.newSuperalgosBotModulesTelegramBot = function (processIndex) {
|
||||
|
||||
let message
|
||||
let tradingEngine
|
||||
let tradingEpisode
|
||||
let sessionNode
|
||||
let sessionName
|
||||
let tradingSystem
|
||||
let sessionParameters
|
||||
|
||||
tradingEngine = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingEngine
|
||||
tradingEpisode = tradingEngine.tradingCurrent.tradingEpisode
|
||||
if(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE !== undefined) {
|
||||
tradingEngine = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingEngine
|
||||
tradingSystem = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingSystem
|
||||
}
|
||||
sessionParameters = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters
|
||||
|
||||
sessionNode = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE
|
||||
sessionName = sessionNode.name
|
||||
let taskParameters = {
|
||||
exchange: TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.name,
|
||||
market: TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName +
|
||||
'/' +
|
||||
TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName
|
||||
}
|
||||
|
||||
|
||||
switch (command) {
|
||||
case 'balances': {
|
||||
|
||||
let baseAsset = TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName
|
||||
let quotedAsset = TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName
|
||||
|
||||
message = "<b><u>SUPERALGOS BALANCES</u></b>\n\n<b>Trading Session:</b> " + sessionName +
|
||||
"\n<b>Pair:</b> " + baseAsset + "/" + quotedAsset +
|
||||
"\n<b>Base Asset:</b> " + tradingEpisode.episodeBaseAsset.balance.value + " " + baseAsset +
|
||||
"\n<b>Quoted Asset:</b> " + tradingEpisode.episodeQuotedAsset.balance.value + " " + quotedAsset
|
||||
break
|
||||
}
|
||||
case 'uptime': {
|
||||
|
||||
let sessionBegin = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_BEGIN
|
||||
|
||||
let dateBegin = new Date(sessionBegin)
|
||||
let dateNow = new Date();
|
||||
|
||||
let seconds = Math.floor((dateNow - (dateBegin))/1000)
|
||||
let minutes = Math.floor(seconds/60)
|
||||
let hours = Math.floor(minutes/60)
|
||||
let days = Math.floor(hours/24)
|
||||
|
||||
hours = hours-(days*24)
|
||||
minutes = minutes-(days*24*60)-(hours*60)
|
||||
seconds = seconds-(days*24*60*60)-(hours*60*60)-(minutes*60)
|
||||
|
||||
let uptime = days + "D, " + hours + "H, " + minutes + "M, " + seconds + "S"
|
||||
|
||||
message = "<b><u>SUPERALGOS UPTIME</u></b>\n\n<b>Trading Session:</b> " + sessionName +
|
||||
"\n<b>Uptime:</b> " + uptime
|
||||
break
|
||||
}
|
||||
case 'statistics': {
|
||||
|
||||
message = "<b><u>SUPERALGOS STATISTICS</u></b>\n\n<b>Trading Session:</b> " + sessionName +
|
||||
"\n<b>Days:</b> " + (tradingEpisode.tradingEpisodeStatistics.days.value).toFixed(2) +
|
||||
"\n<b>Profit Loss:</b> " + tradingEpisode.tradingEpisodeStatistics.profitLoss.value +
|
||||
"\n<b>ROI:</b> " + (tradingEpisode.tradingEpisodeStatistics.ROI.value).toFixed(2) +
|
||||
"\n<b>Annualized Rate Of Return:</b> " + (tradingEpisode.tradingEpisodeStatistics.annualizedRateOfReturn.value).toFixed(2) +
|
||||
"\n<b>Hit Fail:</b> " + tradingEpisode.tradingEpisodeStatistics.hitFail.value
|
||||
break
|
||||
}
|
||||
case 'counters': {
|
||||
|
||||
message = "<b><u>SUPERALGOS COUNTERS</u></b>\n\n<b>Trading Session:</b> " + sessionName +
|
||||
"\n<b>Periods:</b> " + tradingEpisode.tradingEpisodeCounters.periods.value +
|
||||
"\n<b>Strategies:</b> " + tradingEpisode.tradingEpisodeCounters.strategies.value +
|
||||
"\n<b>Positions:</b> " + tradingEpisode.tradingEpisodeCounters.positions.value +
|
||||
"\n<b>Orders:</b> " + tradingEpisode.tradingEpisodeCounters.orders.value +
|
||||
"\n<b>Hits:</b> " + tradingEpisode.tradingEpisodeCounters.hits.value +
|
||||
"\n<b>Fails:</b> " + tradingEpisode.tradingEpisodeCounters.fails.value
|
||||
break
|
||||
}
|
||||
try {
|
||||
message = eval(command)
|
||||
} catch (err) {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[WARN] interpretCommand -> Telegram API error evaluating user formula -> err = " + err.stack)
|
||||
return
|
||||
}
|
||||
|
||||
thisObject.telegramAPI.sendMessage(thisObject.chatId, message, {parse_mode: 'HTML'}).catch(err => TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
|
||||
@@ -156,6 +156,7 @@ function newSuperalgosFunctionLibraryTradingSessionFunctions() {
|
||||
'Trading Parameters->' +
|
||||
'Session Base Asset->Session Quoted Asset->Time Range->Time Frame->Slippage->Fee Structure->Snapshots->Heartbeats->User Defined Parameters->' +
|
||||
'Social Bots->Telegram Bot->Discord Bot->Slack Bot->' +
|
||||
'Social Bot Command->Formula->' +
|
||||
'Exchange Account Asset->Asset->'
|
||||
|
||||
let session = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath)
|
||||
|
||||
Reference in new issue
Block a user