Advertisement
StartledMonkey

node-red flow for crypto-signals webhook v0.03

Mar 23rd, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.     {
  3.         "id": "2b1c064.57a53fa",
  4.         "type": "tab",
  5.         "label": "CryptoSignal_TradeAlerts_v0.03",
  6.         "disabled": false,
  7.         "info": ""
  8.     },
  9.     {
  10.         "id": "e07887aa.9feca8",
  11.         "type": "http in",
  12.         "z": "2b1c064.57a53fa",
  13.         "name": "Crypto-Signals",
  14.         "url": "/cryptosignals",
  15.         "method": "post",
  16.         "upload": false,
  17.         "swaggerDoc": "",
  18.         "x": 177,
  19.         "y": 107.75,
  20.         "wires": [
  21.             [
  22.                 "b305f298.4f6cd",
  23.                 "c9a1c135.ef996"
  24.             ]
  25.         ]
  26.     },
  27.     {
  28.         "id": "b305f298.4f6cd",
  29.         "type": "http response",
  30.         "z": "2b1c064.57a53fa",
  31.         "name": "",
  32.         "statusCode": "",
  33.         "headers": {},
  34.         "x": 414,
  35.         "y": 107.75,
  36.         "wires": []
  37.     },
  38.     {
  39.         "id": "c9a1c135.ef996",
  40.         "type": "function",
  41.         "z": "2b1c064.57a53fa",
  42.         "name": "Parser",
  43.         "func": "var string = msg.payload.messages;\nvar obj = JSON.parse(string);\nmsg.payload = obj;\nreturn msg;",
  44.         "outputs": 1,
  45.         "noerr": 0,
  46.         "x": 144.00003051757812,
  47.         "y": 194.75,
  48.         "wires": [
  49.             [
  50.                 "cf73616b.df6be"
  51.             ]
  52.         ]
  53.     },
  54.     {
  55.         "id": "cf73616b.df6be",
  56.         "type": "split",
  57.         "z": "2b1c064.57a53fa",
  58.         "name": "Splitter",
  59.         "splt": "\\n",
  60.         "spltType": "str",
  61.         "arraySplt": 1,
  62.         "arraySpltType": "len",
  63.         "stream": false,
  64.         "addname": "",
  65.         "x": 290.0000305175781,
  66.         "y": 194.75,
  67.         "wires": [
  68.             [
  69.                 "18e5bc3d.5558b4"
  70.             ]
  71.         ]
  72.     },
  73.     {
  74.         "id": "18e5bc3d.5558b4",
  75.         "type": "switch",
  76.         "z": "2b1c064.57a53fa",
  77.         "name": "IndicatorType",
  78.         "property": "payload.indicator",
  79.         "propertyType": "msg",
  80.         "rules": [
  81.             {
  82.                 "t": "eq",
  83.                 "v": "rsi",
  84.                 "vt": "str"
  85.             },
  86.             {
  87.                 "t": "eq",
  88.                 "v": "stoch_rsi",
  89.                 "vt": "str"
  90.             },
  91.             {
  92.                 "t": "eq",
  93.                 "v": "momentum",
  94.                 "vt": "str"
  95.             },
  96.             {
  97.                 "t": "eq",
  98.                 "v": "mfi",
  99.                 "vt": "str"
  100.             },
  101.             {
  102.                 "t": "eq",
  103.                 "v": "std_crossover",
  104.                 "vt": "str"
  105.             }
  106.         ],
  107.         "checkall": "true",
  108.         "repair": false,
  109.         "outputs": 5,
  110.         "x": 468.0000305175781,
  111.         "y": 194.75,
  112.         "wires": [
  113.             [
  114.                 "421e572b.cfa508"
  115.             ],
  116.             [
  117.                 "128e2c91.d947a3"
  118.             ],
  119.             [
  120.                 "218be0e3.15da4"
  121.             ],
  122.             [
  123.                 "3441ce0f.53f612"
  124.             ],
  125.             [
  126.                 "bf09db41.b85788"
  127.             ]
  128.         ]
  129.     },
  130.     {
  131.         "id": "421e572b.cfa508",
  132.         "type": "change",
  133.         "z": "2b1c064.57a53fa",
  134.         "name": "Set flow variables for Current Prices and RSI",
  135.         "rules": [
  136.             {
  137.                 "t": "set",
  138.                 "p": "currentprices",
  139.                 "pt": "flow",
  140.                 "to": "payload.prices",
  141.                 "tot": "jsonata"
  142.             },
  143.             {
  144.                 "t": "set",
  145.                 "p": "currentrsivalue",
  146.                 "pt": "flow",
  147.                 "to": "payload.values.rsi",
  148.                 "tot": "jsonata"
  149.             }
  150.         ],
  151.         "action": "",
  152.         "property": "",
  153.         "from": "",
  154.         "to": "",
  155.         "reg": false,
  156.         "x": 816.2500305175781,
  157.         "y": 138,
  158.         "wires": [
  159.             []
  160.         ]
  161.     },
  162.     {
  163.         "id": "128e2c91.d947a3",
  164.         "type": "change",
  165.         "z": "2b1c064.57a53fa",
  166.         "name": "Set flow variable for Stoch_RSI",
  167.         "rules": [
  168.             {
  169.                 "t": "set",
  170.                 "p": "currentstochrsivalue",
  171.                 "pt": "flow",
  172.                 "to": "msg.payload.values.stoch_rsi",
  173.                 "tot": "jsonata"
  174.             }
  175.         ],
  176.         "action": "",
  177.         "property": "",
  178.         "from": "",
  179.         "to": "",
  180.         "reg": false,
  181.         "x": 775.2500305175781,
  182.         "y": 181,
  183.         "wires": [
  184.             []
  185.         ]
  186.     },
  187.     {
  188.         "id": "218be0e3.15da4",
  189.         "type": "change",
  190.         "z": "2b1c064.57a53fa",
  191.         "name": "Set flow variable for momentum",
  192.         "rules": [
  193.             {
  194.                 "t": "set",
  195.                 "p": "currentmomentumvalue",
  196.                 "pt": "flow",
  197.                 "to": "\"Momentum : \" & msg.payload.values.momentum",
  198.                 "tot": "jsonata"
  199.             }
  200.         ],
  201.         "action": "",
  202.         "property": "",
  203.         "from": "",
  204.         "to": "",
  205.         "reg": false,
  206.         "x": 775.2500305175781,
  207.         "y": 234,
  208.         "wires": [
  209.             []
  210.         ]
  211.     },
  212.     {
  213.         "id": "3441ce0f.53f612",
  214.         "type": "change",
  215.         "z": "2b1c064.57a53fa",
  216.         "name": "Set flow variable for mfi",
  217.         "rules": [
  218.             {
  219.                 "t": "set",
  220.                 "p": "currentmfivalue",
  221.                 "pt": "flow",
  222.                 "to": "\"MFI : \" & msg.payload.values.mfi",
  223.                 "tot": "jsonata"
  224.             }
  225.         ],
  226.         "action": "",
  227.         "property": "",
  228.         "from": "",
  229.         "to": "",
  230.         "reg": false,
  231.         "x": 756.2500305175781,
  232.         "y": 289,
  233.         "wires": [
  234.             []
  235.         ]
  236.     },
  237.     {
  238.         "id": "1115f40a.ae8a1c",
  239.         "type": "comment",
  240.         "z": "2b1c064.57a53fa",
  241.         "name": "Flow for Crypto Signals",
  242.         "info": "Signals received from Crypto-Signals webhook",
  243.         "x": 197.25003051757812,
  244.         "y": 58,
  245.         "wires": []
  246.     },
  247.     {
  248.         "id": "e044778a.4079c8",
  249.         "type": "function",
  250.         "z": "2b1c064.57a53fa",
  251.         "name": "Create trade alert",
  252.         "func": "msg.payload = {chatId : enter_your_telegram_chatid_here, type : 'message', content: \"All criteria met. Check the charts! - Close Price: \" + msg.payload.values.close_0 + \" vs Bollinger Upperband: \" + msg.payload.values.upperband_0 + \"Stoch_RSI is \" + flow.get('currentstochrsivalue')};\nreturn msg;",
  253.         "outputs": 1,
  254.         "noerr": 0,
  255.         "x": 453.2500305175781,
  256.         "y": 407.66668701171875,
  257.         "wires": [
  258.             [
  259.                 "f39d5270.4f59c",
  260.                 "ec2f3665.5e0b48"
  261.             ]
  262.         ]
  263.     },
  264.     {
  265.         "id": "f9193e10.9870c",
  266.         "type": "comment",
  267.         "z": "2b1c064.57a53fa",
  268.         "name": "Check for criteria match",
  269.         "info": "",
  270.         "x": 193.25003051757812,
  271.         "y": 319.66668701171875,
  272.         "wires": []
  273.     },
  274.     {
  275.         "id": "27937a7e.74eb66",
  276.         "type": "function",
  277.         "z": "2b1c064.57a53fa",
  278.         "name": "Create message for do nothing",
  279.         "func": "msg.payload = \"Do nothing! Criteria not met - Close: \" + msg.payload.values.close_0 + \" vs Bollinger Upperband: \" + msg.payload.values.upperband_0 + \" and Stoch_RSI is \" + flow.get('currentstochrsivalue');\nreturn msg;",
  280.         "outputs": 1,
  281.         "noerr": 0,
  282.         "x": 492.2500305175781,
  283.         "y": 360.66668701171875,
  284.         "wires": [
  285.             [
  286.                 "58c9ca29.620124"
  287.             ]
  288.         ]
  289.     },
  290.     {
  291.         "id": "ec2f3665.5e0b48",
  292.         "type": "telegram sender",
  293.         "z": "2b1c064.57a53fa",
  294.         "name": "Send trade alert to Telegram",
  295.         "bot": "",
  296.         "x": 831.2500305175781,
  297.         "y": 407.66668701171875,
  298.         "wires": [
  299.             []
  300.         ]
  301.     },
  302.     {
  303.         "id": "f39d5270.4f59c",
  304.         "type": "debug",
  305.         "z": "2b1c064.57a53fa",
  306.         "name": "",
  307.         "active": true,
  308.         "tosidebar": true,
  309.         "console": false,
  310.         "tostatus": false,
  311.         "complete": "false",
  312.         "x": 782.2500305175781,
  313.         "y": 469.66668701171875,
  314.         "wires": []
  315.     },
  316.     {
  317.         "id": "bf09db41.b85788",
  318.         "type": "function",
  319.         "z": "2b1c064.57a53fa",
  320.         "name": "Evaluate Criteria",
  321.         "func": "if (msg.payload.values.close_0 > msg.payload.values.upperband_0 && flow.get('currentstochrsivalue') > 80) {\n   return [ null, msg ];\n} else {\n   return [ msg, null ];\n}",
  322.         "outputs": 2,
  323.         "noerr": 0,
  324.         "x": 210.25003051757812,
  325.         "y": 378.66668701171875,
  326.         "wires": [
  327.             [
  328.                 "27937a7e.74eb66"
  329.             ],
  330.             [
  331.                 "e044778a.4079c8"
  332.             ]
  333.         ]
  334.     },
  335.     {
  336.         "id": "58c9ca29.620124",
  337.         "type": "debug",
  338.         "z": "2b1c064.57a53fa",
  339.         "name": "",
  340.         "active": true,
  341.         "tosidebar": true,
  342.         "console": false,
  343.         "tostatus": false,
  344.         "complete": "false",
  345.         "x": 781.25,
  346.         "y": 360.66668701171875,
  347.         "wires": []
  348.     }
  349. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement