Advertisement
StartledMonkey

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

Mar 23rd, 2019
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.     {
  3.         "id": "829d5010.37065",
  4.         "type": "tab",
  5.         "label": "CryptoSignal_TradeAlerts_v0.04",
  6.         "disabled": false,
  7.         "info": ""
  8.     },
  9.     {
  10.         "id": "7a7fc1d8.c924f",
  11.         "type": "http in",
  12.         "z": "829d5010.37065",
  13.         "name": "Crypto-Signals",
  14.         "url": "/cryptosignals",
  15.         "method": "post",
  16.         "upload": false,
  17.         "swaggerDoc": "",
  18.         "x": 157,
  19.         "y": 95.75,
  20.         "wires": [
  21.             [
  22.                 "4361a4e6.5373ac",
  23.                 "98901d43.8439a"
  24.             ]
  25.         ]
  26.     },
  27.     {
  28.         "id": "4361a4e6.5373ac",
  29.         "type": "http response",
  30.         "z": "829d5010.37065",
  31.         "name": "",
  32.         "statusCode": "",
  33.         "headers": {},
  34.         "x": 394,
  35.         "y": 95.75,
  36.         "wires": []
  37.     },
  38.     {
  39.         "id": "98901d43.8439a",
  40.         "type": "function",
  41.         "z": "829d5010.37065",
  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": 124.00003051757812,
  47.         "y": 182.75,
  48.         "wires": [
  49.             [
  50.                 "1f760789.f031d8"
  51.             ]
  52.         ]
  53.     },
  54.     {
  55.         "id": "1f760789.f031d8",
  56.         "type": "split",
  57.         "z": "829d5010.37065",
  58.         "name": "Splitter",
  59.         "splt": "\\n",
  60.         "spltType": "str",
  61.         "arraySplt": 1,
  62.         "arraySpltType": "len",
  63.         "stream": false,
  64.         "addname": "",
  65.         "x": 270.0000305175781,
  66.         "y": 182.75,
  67.         "wires": [
  68.             [
  69.                 "347ae168.04f5ce"
  70.             ]
  71.         ]
  72.     },
  73.     {
  74.         "id": "347ae168.04f5ce",
  75.         "type": "switch",
  76.         "z": "829d5010.37065",
  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": 448.0000305175781,
  111.         "y": 182.75,
  112.         "wires": [
  113.             [
  114.                 "f1a45db5.5fb94"
  115.             ],
  116.             [
  117.                 "77164366.1a247c"
  118.             ],
  119.             [
  120.                 "25e68347.83d71c"
  121.             ],
  122.             [
  123.                 "520fae02.ac7ef"
  124.             ],
  125.             [
  126.                 "8a31c682.c62618"
  127.             ]
  128.         ]
  129.     },
  130.     {
  131.         "id": "f1a45db5.5fb94",
  132.         "type": "change",
  133.         "z": "829d5010.37065",
  134.         "name": "Set flow variables for Current Prices, RSI and Market",
  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.                 "t": "set",
  152.                 "p": "currentmarketpair",
  153.                 "pt": "flow",
  154.                 "to": "payload.market",
  155.                 "tot": "jsonata"
  156.             }
  157.         ],
  158.         "action": "",
  159.         "property": "",
  160.         "from": "",
  161.         "to": "",
  162.         "reg": false,
  163.         "x": 826.2500305175781,
  164.         "y": 126,
  165.         "wires": [
  166.             []
  167.         ]
  168.     },
  169.     {
  170.         "id": "77164366.1a247c",
  171.         "type": "change",
  172.         "z": "829d5010.37065",
  173.         "name": "Set flow variable for Stoch_RSI",
  174.         "rules": [
  175.             {
  176.                 "t": "set",
  177.                 "p": "currentstochrsivalue",
  178.                 "pt": "flow",
  179.                 "to": "msg.payload.values.stoch_rsi",
  180.                 "tot": "jsonata"
  181.             }
  182.         ],
  183.         "action": "",
  184.         "property": "",
  185.         "from": "",
  186.         "to": "",
  187.         "reg": false,
  188.         "x": 755.2500305175781,
  189.         "y": 169,
  190.         "wires": [
  191.             []
  192.         ]
  193.     },
  194.     {
  195.         "id": "25e68347.83d71c",
  196.         "type": "change",
  197.         "z": "829d5010.37065",
  198.         "name": "Set flow variable for momentum",
  199.         "rules": [
  200.             {
  201.                 "t": "set",
  202.                 "p": "currentmomentumvalue",
  203.                 "pt": "flow",
  204.                 "to": "\"Momentum : \" & msg.payload.values.momentum",
  205.                 "tot": "jsonata"
  206.             }
  207.         ],
  208.         "action": "",
  209.         "property": "",
  210.         "from": "",
  211.         "to": "",
  212.         "reg": false,
  213.         "x": 755.2500305175781,
  214.         "y": 222,
  215.         "wires": [
  216.             []
  217.         ]
  218.     },
  219.     {
  220.         "id": "520fae02.ac7ef",
  221.         "type": "change",
  222.         "z": "829d5010.37065",
  223.         "name": "Set flow variable for mfi",
  224.         "rules": [
  225.             {
  226.                 "t": "set",
  227.                 "p": "currentmfivalue",
  228.                 "pt": "flow",
  229.                 "to": "\"MFI : \" & msg.payload.values.mfi",
  230.                 "tot": "jsonata"
  231.             }
  232.         ],
  233.         "action": "",
  234.         "property": "",
  235.         "from": "",
  236.         "to": "",
  237.         "reg": false,
  238.         "x": 736.2500305175781,
  239.         "y": 277,
  240.         "wires": [
  241.             []
  242.         ]
  243.     },
  244.     {
  245.         "id": "ef0c9331.dbfe9",
  246.         "type": "comment",
  247.         "z": "829d5010.37065",
  248.         "name": "Flow for Crypto Signals",
  249.         "info": "Signals received from Crypto-Signals webhook",
  250.         "x": 177.25003051757812,
  251.         "y": 46,
  252.         "wires": []
  253.     },
  254.     {
  255.         "id": "617f11b9.97655",
  256.         "type": "function",
  257.         "z": "829d5010.37065",
  258.         "name": "Create trade alert",
  259.         "func": "msg.payload = {chatId : enter_your_telegram_chatid_here, type : 'message', content: \"All criteria met for Market Pair: \" + flow.get('currentmarketpair') + \". 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;",
  260.         "outputs": 1,
  261.         "noerr": 0,
  262.         "x": 433.2500305175781,
  263.         "y": 395.66668701171875,
  264.         "wires": [
  265.             [
  266.                 "e2b0c14d.63f6f",
  267.                 "29a9498d.9bd196"
  268.             ]
  269.         ]
  270.     },
  271.     {
  272.         "id": "82717a18.830de8",
  273.         "type": "comment",
  274.         "z": "829d5010.37065",
  275.         "name": "Check for criteria match",
  276.         "info": "",
  277.         "x": 173.25003051757812,
  278.         "y": 307.66668701171875,
  279.         "wires": []
  280.     },
  281.     {
  282.         "id": "6dbaf91d.fc0b38",
  283.         "type": "function",
  284.         "z": "829d5010.37065",
  285.         "name": "Create message for do nothing",
  286.         "func": "msg.payload = \"Do nothing! Criteria not met for Market Pair: \" + flow.get('currentmarketpair') + \" - Close Price: \" + msg.payload.values.close_0 + \" vs Bollinger Upperband: \" + msg.payload.values.upperband_0 + \" and Stoch_RSI is \" + flow.get('currentstochrsivalue');\nreturn msg;",
  287.         "outputs": 1,
  288.         "noerr": 0,
  289.         "x": 472.2500305175781,
  290.         "y": 348.66668701171875,
  291.         "wires": [
  292.             [
  293.                 "622f5815.faa818"
  294.             ]
  295.         ]
  296.     },
  297.     {
  298.         "id": "29a9498d.9bd196",
  299.         "type": "telegram sender",
  300.         "z": "829d5010.37065",
  301.         "name": "Send trade alert to Telegram",
  302.         "bot": "",
  303.         "x": 811.2500305175781,
  304.         "y": 395.66668701171875,
  305.         "wires": [
  306.             []
  307.         ]
  308.     },
  309.     {
  310.         "id": "e2b0c14d.63f6f",
  311.         "type": "debug",
  312.         "z": "829d5010.37065",
  313.         "name": "",
  314.         "active": true,
  315.         "tosidebar": true,
  316.         "console": false,
  317.         "tostatus": false,
  318.         "complete": "false",
  319.         "x": 762.2500305175781,
  320.         "y": 457.66668701171875,
  321.         "wires": []
  322.     },
  323.     {
  324.         "id": "8a31c682.c62618",
  325.         "type": "function",
  326.         "z": "829d5010.37065",
  327.         "name": "Evaluate Criteria",
  328.         "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}",
  329.         "outputs": 2,
  330.         "noerr": 0,
  331.         "x": 190.25003051757812,
  332.         "y": 366.66668701171875,
  333.         "wires": [
  334.             [
  335.                 "6dbaf91d.fc0b38"
  336.             ],
  337.             [
  338.                 "617f11b9.97655"
  339.             ]
  340.         ]
  341.     },
  342.     {
  343.         "id": "622f5815.faa818",
  344.         "type": "debug",
  345.         "z": "829d5010.37065",
  346.         "name": "",
  347.         "active": true,
  348.         "tosidebar": true,
  349.         "console": false,
  350.         "tostatus": false,
  351.         "complete": "false",
  352.         "x": 761.2500305175781,
  353.         "y": 348.66668701171875,
  354.         "wires": []
  355.     }
  356. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement