Advertisement
StartledMonkey

node-red flow for crypto-signals webhook BB 20190321

Mar 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.     {
  3.         "id": "617f0f21.4c48d",
  4.         "type": "tab",
  5.         "label": "Cryptosignals_BollingerAlerts",
  6.         "disabled": false,
  7.         "info": ""
  8.     },
  9.     {
  10.         "id": "3f3c9684.7f08fa",
  11.         "type": "http in",
  12.         "z": "617f0f21.4c48d",
  13.         "name": "Crypto-Signals",
  14.         "url": "/cryptosignals",
  15.         "method": "post",
  16.         "upload": false,
  17.         "swaggerDoc": "",
  18.         "x": 150,
  19.         "y": 96,
  20.         "wires": [
  21.             [
  22.                 "d03bfb1a.038d08",
  23.                 "d03a687e.aaaa38"
  24.             ]
  25.         ]
  26.     },
  27.     {
  28.         "id": "d03bfb1a.038d08",
  29.         "type": "http response",
  30.         "z": "617f0f21.4c48d",
  31.         "name": "",
  32.         "statusCode": "",
  33.         "headers": {},
  34.         "x": 387,
  35.         "y": 96,
  36.         "wires": []
  37.     },
  38.     {
  39.         "id": "d03a687e.aaaa38",
  40.         "type": "function",
  41.         "z": "617f0f21.4c48d",
  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": 117.00003051757812,
  47.         "y": 183,
  48.         "wires": [
  49.             [
  50.                 "2b2e9c57.32ef64"
  51.             ]
  52.         ]
  53.     },
  54.     {
  55.         "id": "2b2e9c57.32ef64",
  56.         "type": "split",
  57.         "z": "617f0f21.4c48d",
  58.         "name": "Splitter",
  59.         "splt": "\\n",
  60.         "spltType": "str",
  61.         "arraySplt": 1,
  62.         "arraySpltType": "len",
  63.         "stream": false,
  64.         "addname": "",
  65.         "x": 263.0000305175781,
  66.         "y": 183,
  67.         "wires": [
  68.             [
  69.                 "5407cd5e.d28214"
  70.             ]
  71.         ]
  72.     },
  73.     {
  74.         "id": "5407cd5e.d28214",
  75.         "type": "switch",
  76.         "z": "617f0f21.4c48d",
  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": 441.0000305175781,
  111.         "y": 183,
  112.         "wires": [
  113.             [
  114.                 "2e36bea3.116992"
  115.             ],
  116.             [
  117.                 "6f4b362b.85a648"
  118.             ],
  119.             [
  120.                 "f9c9eaca.377a68"
  121.             ],
  122.             [
  123.                 "7edf3fc1.3483e"
  124.             ],
  125.             [
  126.                 "f4f1b970.2c64f8"
  127.             ]
  128.         ]
  129.     },
  130.     {
  131.         "id": "2e36bea3.116992",
  132.         "type": "change",
  133.         "z": "617f0f21.4c48d",
  134.         "name": "Convert RSI  to number",
  135.         "rules": [
  136.             {
  137.                 "t": "set",
  138.                 "p": "payload.values.rsi",
  139.                 "pt": "msg",
  140.                 "to": "$number(payload.values.rsi)",
  141.                 "tot": "jsonata"
  142.             }
  143.         ],
  144.         "action": "",
  145.         "property": "",
  146.         "from": "",
  147.         "to": "",
  148.         "reg": false,
  149.         "x": 720.2500381469727,
  150.         "y": 124.2500057220459,
  151.         "wires": [
  152.             [
  153.                 "fb9e2d75.cb6c8"
  154.             ]
  155.         ]
  156.     },
  157.     {
  158.         "id": "6f4b362b.85a648",
  159.         "type": "change",
  160.         "z": "617f0f21.4c48d",
  161.         "name": "Convert Stoch_RSI to number",
  162.         "rules": [
  163.             {
  164.                 "t": "set",
  165.                 "p": "payload.values.stoch_rsi",
  166.                 "pt": "msg",
  167.                 "to": "$number(payload.values.stoch_rsi)",
  168.                 "tot": "jsonata"
  169.             }
  170.         ],
  171.         "action": "",
  172.         "property": "",
  173.         "from": "",
  174.         "to": "",
  175.         "reg": false,
  176.         "x": 750.2500381469727,
  177.         "y": 176.2500057220459,
  178.         "wires": [
  179.             [
  180.                 "674f2be7.cda6a4"
  181.             ]
  182.         ]
  183.     },
  184.     {
  185.         "id": "fb9e2d75.cb6c8",
  186.         "type": "change",
  187.         "z": "617f0f21.4c48d",
  188.         "name": "Set flow variables for Current Prices and RSI",
  189.         "rules": [
  190.             {
  191.                 "t": "set",
  192.                 "p": "currentprices",
  193.                 "pt": "flow",
  194.                 "to": "payload.prices",
  195.                 "tot": "jsonata"
  196.             },
  197.             {
  198.                 "t": "set",
  199.                 "p": "currentrsivalue",
  200.                 "pt": "flow",
  201.                 "to": "payload.values.rsi",
  202.                 "tot": "jsonata"
  203.             }
  204.         ],
  205.         "action": "",
  206.         "property": "",
  207.         "from": "",
  208.         "to": "",
  209.         "reg": false,
  210.         "x": 1196.2500305175781,
  211.         "y": 124.25,
  212.         "wires": [
  213.             []
  214.         ]
  215.     },
  216.     {
  217.         "id": "674f2be7.cda6a4",
  218.         "type": "change",
  219.         "z": "617f0f21.4c48d",
  220.         "name": "Set flow variable for Stoch_RSI",
  221.         "rules": [
  222.             {
  223.                 "t": "set",
  224.                 "p": "currentstochrsivalue",
  225.                 "pt": "flow",
  226.                 "to": "\"Stoch_RSI : \" & msg.payload.values.stoch_rsi",
  227.                 "tot": "jsonata"
  228.             }
  229.         ],
  230.         "action": "",
  231.         "property": "",
  232.         "from": "",
  233.         "to": "",
  234.         "reg": false,
  235.         "x": 1156.2500381469727,
  236.         "y": 176.2500057220459,
  237.         "wires": [
  238.             []
  239.         ]
  240.     },
  241.     {
  242.         "id": "f9c9eaca.377a68",
  243.         "type": "change",
  244.         "z": "617f0f21.4c48d",
  245.         "name": "Convert momentum to number",
  246.         "rules": [
  247.             {
  248.                 "t": "set",
  249.                 "p": "payload.values.momentum",
  250.                 "pt": "msg",
  251.                 "to": "$number(payload.values.momentum)",
  252.                 "tot": "jsonata"
  253.             }
  254.         ],
  255.         "action": "",
  256.         "property": "",
  257.         "from": "",
  258.         "to": "",
  259.         "reg": false,
  260.         "x": 748.2500381469727,
  261.         "y": 225.2500057220459,
  262.         "wires": [
  263.             [
  264.                 "276d4541.d03a6a"
  265.             ]
  266.         ]
  267.     },
  268.     {
  269.         "id": "7edf3fc1.3483e",
  270.         "type": "change",
  271.         "z": "617f0f21.4c48d",
  272.         "name": "Convert mfi to number",
  273.         "rules": [
  274.             {
  275.                 "t": "set",
  276.                 "p": "payload.values.mfi",
  277.                 "pt": "msg",
  278.                 "to": "$number(payload.values.mfi)",
  279.                 "tot": "jsonata"
  280.             }
  281.         ],
  282.         "action": "",
  283.         "property": "",
  284.         "from": "",
  285.         "to": "",
  286.         "reg": false,
  287.         "x": 719.2500381469727,
  288.         "y": 277.2500057220459,
  289.         "wires": [
  290.             [
  291.                 "1475889c.7b4807"
  292.             ]
  293.         ]
  294.     },
  295.     {
  296.         "id": "276d4541.d03a6a",
  297.         "type": "change",
  298.         "z": "617f0f21.4c48d",
  299.         "name": "Set flow variable for momentum",
  300.         "rules": [
  301.             {
  302.                 "t": "set",
  303.                 "p": "currentmomentumvalue",
  304.                 "pt": "flow",
  305.                 "to": "\"Momentum : \" & msg.payload.values.momentum",
  306.                 "tot": "jsonata"
  307.             }
  308.         ],
  309.         "action": "",
  310.         "property": "",
  311.         "from": "",
  312.         "to": "",
  313.         "reg": false,
  314.         "x": 1156.2500305175781,
  315.         "y": 225.25,
  316.         "wires": [
  317.             []
  318.         ]
  319.     },
  320.     {
  321.         "id": "1475889c.7b4807",
  322.         "type": "change",
  323.         "z": "617f0f21.4c48d",
  324.         "name": "Set flow variable for mfi",
  325.         "rules": [
  326.             {
  327.                 "t": "set",
  328.                 "p": "currentmfivalue",
  329.                 "pt": "flow",
  330.                 "to": "\"MFI : \" & msg.payload.values.mfi",
  331.                 "tot": "jsonata"
  332.             }
  333.         ],
  334.         "action": "",
  335.         "property": "",
  336.         "from": "",
  337.         "to": "",
  338.         "reg": false,
  339.         "x": 1138.2500305175781,
  340.         "y": 276.25,
  341.         "wires": [
  342.             []
  343.         ]
  344.     },
  345.     {
  346.         "id": "5894bcd7.c03c44",
  347.         "type": "comment",
  348.         "z": "617f0f21.4c48d",
  349.         "name": "Flow for Crypto Signals",
  350.         "info": "Signals received from Crypto-Signals webhook",
  351.         "x": 170.25003051757812,
  352.         "y": 46.25,
  353.         "wires": []
  354.     },
  355.     {
  356.         "id": "f4f1b970.2c64f8",
  357.         "type": "change",
  358.         "z": "617f0f21.4c48d",
  359.         "name": "Convert Bollinger values to Numbers",
  360.         "rules": [
  361.             {
  362.                 "t": "set",
  363.                 "p": "payload.values.close_0",
  364.                 "pt": "msg",
  365.                 "to": "$number(payload.values.close_0)",
  366.                 "tot": "jsonata"
  367.             },
  368.             {
  369.                 "t": "set",
  370.                 "p": "payload.values.upperband_1",
  371.                 "pt": "msg",
  372.                 "to": "$number(payload.values.upperband_1)",
  373.                 "tot": "jsonata"
  374.             }
  375.         ],
  376.         "action": "",
  377.         "property": "",
  378.         "from": "",
  379.         "to": "",
  380.         "reg": false,
  381.         "x": 770.2500305175781,
  382.         "y": 332.91668701171875,
  383.         "wires": [
  384.             [
  385.                 "15300d73.958da3"
  386.             ]
  387.         ]
  388.     },
  389.     {
  390.         "id": "15300d73.958da3",
  391.         "type": "switch",
  392.         "z": "617f0f21.4c48d",
  393.         "name": "Eval Close Price vs Bollinger Upperband",
  394.         "property": "payload.values.close_0",
  395.         "propertyType": "msg",
  396.         "rules": [
  397.             {
  398.                 "t": "lte",
  399.                 "v": "payload.values.upperband_1",
  400.                 "vt": "msg"
  401.             },
  402.             {
  403.                 "t": "gt",
  404.                 "v": "payload.values.upperband_1",
  405.                 "vt": "msg"
  406.             }
  407.         ],
  408.         "checkall": "true",
  409.         "repair": false,
  410.         "outputs": 2,
  411.         "x": 232.25003051757812,
  412.         "y": 491.91668701171875,
  413.         "wires": [
  414.             [
  415.                 "d8935e63.0ecbb"
  416.             ],
  417.             [
  418.                 "61c48900.a8d738"
  419.             ]
  420.         ]
  421.     },
  422.     {
  423.         "id": "61c48900.a8d738",
  424.         "type": "function",
  425.         "z": "617f0f21.4c48d",
  426.         "name": "Create alert for Bollinger Breakout",
  427.         "func": "msg.payload = {chatId : -chatidref, type : 'message', content: \"Bollinger breakout, Check the charts! - Close Price: \" + msg.payload.values.close_0 + \" vs Bollinger Upperband: \" + msg.payload.values.upperband_1};\nreturn msg;",
  428.         "outputs": 1,
  429.         "noerr": 0,
  430.         "x": 640.2500305175781,
  431.         "y": 524.9166870117188,
  432.         "wires": [
  433.             [
  434.                 "8a06fd10.be136",
  435.                 "9655b6d0.edd8f8"
  436.             ]
  437.         ]
  438.     },
  439.     {
  440.         "id": "63e6782e.c1a5f8",
  441.         "type": "comment",
  442.         "z": "617f0f21.4c48d",
  443.         "name": "Check for Bollinger breakout",
  444.         "info": "",
  445.         "x": 194.25003051757812,
  446.         "y": 431.91668701171875,
  447.         "wires": []
  448.     },
  449.     {
  450.         "id": "8a06fd10.be136",
  451.         "type": "debug",
  452.         "z": "617f0f21.4c48d",
  453.         "name": "",
  454.         "active": true,
  455.         "tosidebar": true,
  456.         "console": false,
  457.         "tostatus": false,
  458.         "complete": "false",
  459.         "x": 924.2500305175781,
  460.         "y": 600.9166870117188,
  461.         "wires": []
  462.     },
  463.     {
  464.         "id": "d8935e63.0ecbb",
  465.         "type": "function",
  466.         "z": "617f0f21.4c48d",
  467.         "name": "Create message for do nothing",
  468.         "func": "msg.payload = \"Do nothing! - Close Price: \" + msg.payload.values.close_0 + \" vs Bollinger Upperband: \" + msg.payload.values.upperband_1;\nreturn msg;",
  469.         "outputs": 1,
  470.         "noerr": 0,
  471.         "x": 628.2500305175781,
  472.         "y": 469.91668701171875,
  473.         "wires": [
  474.             [
  475.                 "268480e8.fb914"
  476.             ]
  477.         ]
  478.     },
  479.     {
  480.         "id": "268480e8.fb914",
  481.         "type": "debug",
  482.         "z": "617f0f21.4c48d",
  483.         "name": "",
  484.         "active": true,
  485.         "tosidebar": true,
  486.         "console": false,
  487.         "tostatus": false,
  488.         "complete": "false",
  489.         "x": 919.2500305175781,
  490.         "y": 469.91668701171875,
  491.         "wires": []
  492.     },
  493.     {
  494.         "id": "9655b6d0.edd8f8",
  495.         "type": "telegram sender",
  496.         "z": "617f0f21.4c48d",
  497.         "name": "Send bollinger breakout alert to Telegram",
  498.         "bot": "",
  499.         "x": 1008.2500305175781,
  500.         "y": 524.9166870117188,
  501.         "wires": [
  502.             []
  503.         ]
  504.     }
  505. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement