bot_try_with_webhook

bot_try_with_webhook bot_try_with_webhook bot_try_with_webhook

[{"id":"1a1154a31ca6eb6e","type":"http request","z":"82efa5e1a9b1dc9b","name":"binance ticker","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.binance.com/api/v3/klines?symbol={{{query}}}&interval={{{interval}}}&limit={{{limit}}}","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":780,"y":740,"wires":[["ccb8bf4a3d20e8d9"]]},{"id":"ccb8bf4a3d20e8d9","type":"function","z":"82efa5e1a9b1dc9b","name":"convert for talib","func":"// store data for candlestick chart\nmsg.chartData= msg.payload;\n\n\nvar temp = {};\ntemp.time = [];\ntemp.open = [];\ntemp.high = [];\ntemp.low = [];\ntemp.close = [];\ntemp.volume = [];\n\nfor (let i = 0; i < msg.payload.length; i++) {\n  \n  temp.time.push(msg.payload[i][0]);\n  temp.open.push(msg.payload[i][1]);\n  temp.high.push(msg.payload[i][2]);\n  temp.low.push(msg.payload[i][3]);\n  temp.close.push(msg.payload[i][4]);\n  temp.volume.push(msg.payload[i][5]);\n  \n}\n\nmsg.time = temp.time;\n\nmsg.payload = (Object.assign({\n    time:temp.time,\n    open:temp.open,\n    high:temp.high,\n    low:temp.low,\n    close:temp.close,\n    volume:temp.volume,\n    \n}));\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":780,"wires":[["c04ae378efe12708"]]},{"id":"69467e73f817369a","type":"template","z":"82efa5e1a9b1dc9b","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Document</title>\n\n</head>\n<body>\n\n<script src=\"https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js\"></script>\n\n<script>\nvar chart = LightweightCharts.createChart(document.body, {\n\twidth: 1500,\n    height: 750,\n\n\tlayout: {\n\t\ttextColor: '#000000',\n\t\tbackgroundColor: 'rgba(255, 255, 255, 0.9)',\n\t},\n\tgrid: {\n\t\tvertLines: {\n\t\t\tcolor: 'rgba(197, 203, 206, 0.5)',\n\t\t},\n\t\thorzLines: {\n\t\t\tcolor: 'rgba(197, 203, 206, 0.5)',\n\t\t},\n\t},\n\tcrosshair: {\n\t\tmode: LightweightCharts.CrosshairMode.Normal,\n\t},\n\trightPriceScale: {\n\t\tborderColor: 'rgba(197, 203, 206, 0.8)',\n\t},\n\ttimeScale: {\n\t\tborderColor: 'rgba(197, 203, 206, 0.8)',\n\t\t\t\t\ttimeVisible: true,\n\t\t\tsecondsVisible: true\n\t},\n});\n\n\n\nvar candleSeries = chart.addCandlestickSeries({\n  upColor: 'rgba(0, 255, 0, 1)',\n  downColor: 'rgba(255, 0, 0, 1)',\n  borderDownColor: 'rgba(255, 144, 0, 1)',\n  borderUpColor: 'rgba(255, 144, 0, 1)',\n  wickDownColor: 'rgba(255, 144, 0, 1)',\n  wickUpColor: 'rgba(255, 144, 0, 1)',\n});\n\ncandleSeries.setData(\n    [ {{{payload}}}]\n)\n\n\n\n\n</script>\n    \n</body>\n</html>","output":"str","x":820,"y":820,"wires":[["f4a1575f90f83a03"]]},{"id":"a6ed6ca703c21d59","type":"http in","z":"82efa5e1a9b1dc9b","name":"","url":"/chart","method":"get","upload":false,"swaggerDoc":"","x":400,"y":740,"wires":[["74ec21a3c374b743"]]},{"id":"f4a1575f90f83a03","type":"http response","z":"82efa5e1a9b1dc9b","name":"","statusCode":"","headers":{},"x":830,"y":860,"wires":[]},{"id":"74ec21a3c374b743","type":"function","z":"82efa5e1a9b1dc9b","name":"BNXUSDT","func":"msg.query = \"ALPINEUSDT\";\nmsg.interval = \"4h\";\nmsg.limit=\"100\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":740,"wires":[["1a1154a31ca6eb6e"]]},{"id":"c04ae378efe12708","type":"function","z":"82efa5e1a9b1dc9b","name":"convert for chart Candle","func":"\nvar out = [];\n\nfor (let i = 0; i < msg.payload.time.length; i++) {\n    \nvar singleline =  \"{\\\"time\\\": \" + msg.payload.time[i]/1000 + \",\" + \n                  \"\\\"open\\\":\" + msg.payload.open[i]+ \",\" +\n                  \"\\\"high\\\":\" + msg.payload.high[i]+ \",\" +\n                  \"\\\"low\\\":\" + msg.payload.low[i]+ \",\" +\n                  \"\\\"close\\\":\" + msg.payload.close[i]+ \"\" +\n                  \"}\";\n                  \n                   \n\n\nout.push(singleline);\n  \n}\n\nmsg.payload = (out);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":820,"wires":[["69467e73f817369a"]]}]

Flow Info

Created 1 year, 3 months ago
Rating: not yet rated

Actions

Rate:

Node Types

Core
  • function (x3)
  • http in (x1)
  • http request (x1)
  • http response (x1)
  • template (x1)

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option