INDONESIA STOCK EXCHANGE API

This flow pulls IDX information in every 1 minute, and show them with respond JSON. You can use this flow to create API gathers information about the Constituent, sectoral, and company price. This flow also have a search function for Company stock price.

[{"id":"954d764e.834528","type":"tab","label":"IDX 1","disabled":false,"info":""},{"id":"aafbfa35.be1798","type":"inject","z":"954d764e.834528","name":"","topic":"","payload":"Every 1 min.","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":110,"y":100,"wires":[["6fe149bf.8ccc88"]]},{"id":"1a64bd2c.2055e3","type":"debug","z":"954d764e.834528","name":"","active":false,"console":"false","complete":"false","x":910,"y":60,"wires":[]},{"id":"6fe149bf.8ccc88","type":"http request","z":"954d764e.834528","name":"Get IDX Constituent","method":"GET","ret":"obj","paytoqs":false,"url":"https://www.idx.co.id/umbraco/Surface/StockData/GetConstituent","tls":"","persist":false,"proxy":"","authType":"","x":460,"y":100,"wires":[["8c258ee5.9de6c"]]},{"id":"8e7ebff8.6864b","type":"websocket out","z":"954d764e.834528","name":"","server":"25025d9b.e76942","client":"","x":970,"y":100,"wires":[]},{"id":"4fd6df5d.42dd1","type":"http response","z":"954d764e.834528","name":"","statusCode":"","headers":{"content-type":"application/json"},"x":890,"y":140,"wires":[]},{"id":"b16628e1.eaeae8","type":"http in","z":"954d764e.834528","name":"","url":"/idx/constituent","method":"get","upload":false,"swaggerDoc":"","x":140,"y":60,"wires":[["6fe149bf.8ccc88"]]},{"id":"8c258ee5.9de6c","type":"change","z":"954d764e.834528","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":100,"wires":[["1a64bd2c.2055e3","8e7ebff8.6864b","4fd6df5d.42dd1"]]},{"id":"50ab8331.7c08fc","type":"http request","z":"954d764e.834528","name":"Get IDX Sectoral","method":"GET","ret":"obj","paytoqs":false,"url":"https://www.idx.co.id/umbraco/Surface/StockData/GetSectoral","tls":"","persist":false,"proxy":"","authType":"","x":450,"y":240,"wires":[["3d440191.cfe7be"]]},{"id":"3d440191.cfe7be","type":"change","z":"954d764e.834528","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":240,"wires":[["e05b9244.63d18","a99254e9.71c0b8","cfee8f0c.7eec4"]]},{"id":"e05b9244.63d18","type":"debug","z":"954d764e.834528","name":"","active":false,"console":"false","complete":"false","x":910,"y":200,"wires":[]},{"id":"a99254e9.71c0b8","type":"websocket out","z":"954d764e.834528","name":"","server":"25025d9b.e76942","client":"","x":970,"y":240,"wires":[]},{"id":"cfee8f0c.7eec4","type":"http response","z":"954d764e.834528","name":"","statusCode":"","headers":{"content-type":"application/json"},"x":890,"y":280,"wires":[]},{"id":"3e284087.801a1","type":"inject","z":"954d764e.834528","name":"","topic":"","payload":"Every 1 min.","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":110,"y":240,"wires":[["50ab8331.7c08fc"]]},{"id":"4aafe4c2.6494dc","type":"http in","z":"954d764e.834528","name":"","url":"/idx/sectoral","method":"get","upload":false,"swaggerDoc":"","x":130,"y":200,"wires":[["50ab8331.7c08fc"]]},{"id":"c7843bc3.5eba88","type":"http request","z":"954d764e.834528","name":"Get IDX Summary","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":590,"y":400,"wires":[["bca0f4c3.2863a8","444520ba.bd1ce"]]},{"id":"cdbca610.459d48","type":"http in","z":"954d764e.834528","name":"","url":"/idx/summary","method":"get","upload":false,"swaggerDoc":"","x":140,"y":400,"wires":[["c209450c.d02db8"]]},{"id":"f718b325.5b18d","type":"debug","z":"954d764e.834528","name":"","active":false,"console":"false","complete":"false","x":1030,"y":360,"wires":[]},{"id":"397122cd.8f918e","type":"websocket out","z":"954d764e.834528","name":"","server":"25025d9b.e76942","client":"","x":1070,"y":400,"wires":[]},{"id":"2034bfdd.9a5d5","type":"http response","z":"954d764e.834528","name":"","statusCode":"","headers":{"content-type":"application/json"},"x":1010,"y":440,"wires":[]},{"id":"444520ba.bd1ce","type":"change","z":"954d764e.834528","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":400,"wires":[["f718b325.5b18d","397122cd.8f918e","2034bfdd.9a5d5"]]},{"id":"bca0f4c3.2863a8","type":"debug","z":"954d764e.834528","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":360,"wires":[]},{"id":"c209450c.d02db8","type":"function","z":"954d764e.834528","name":"Pagination","func":"const page = msg.payload.page\nlet paging = {}\nif(!page || page <2){\n    paging = {\n        start:0,\n        length :50\n    }\n}else{ \n    const startPage = 1 + (page*50) \n    paging = {\n        start:startPage,\n        length:50\n    }\n    msg.page = paging\n}\nlet url =  \"https://www.idx.co.id/umbraco/Surface/TradingSummary/GetStockSummary?start=__START__&length=__LENGTH__\"\nmsg.url = url.replace(\"__START__\",paging.start).replace(\"__LENGTH__\",paging.length)\nnode.warn(msg.url)\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":400,"wires":[["c7843bc3.5eba88"]]},{"id":"2de571f9.8e07de","type":"inject","z":"954d764e.834528","name":"","topic":"","payload":"Every 1 min.","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":110,"y":340,"wires":[["c209450c.d02db8"]]},{"id":"4666558d.c43c9c","type":"http in","z":"954d764e.834528","name":"","url":"/idx/find","method":"get","upload":false,"swaggerDoc":"","x":120,"y":520,"wires":[["36519ecc.868462"]]},{"id":"abcabd08.41535","type":"function","z":"954d764e.834528","name":"Pagination","func":"paging = {\n    start:0,\n    length :700\n}\n\nlet url =  \"https://www.idx.co.id/umbraco/Surface/TradingSummary/GetStockSummary?start=__START__&length=__LENGTH__\"\nmsg.url = url.replace(\"__START__\",paging.start).replace(\"__LENGTH__\",paging.length)\n\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":520,"wires":[["f6898a36.539ef8"]]},{"id":"f6898a36.539ef8","type":"http request","z":"954d764e.834528","name":"Get IDX Summary","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":910,"y":520,"wires":[["9c76a6ae.53ab78","d7ccdc8.b7cb52"]]},{"id":"9c76a6ae.53ab78","type":"debug","z":"954d764e.834528","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1150,"y":480,"wires":[]},{"id":"8934f19e.04cf2","type":"debug","z":"954d764e.834528","name":"","active":false,"console":"false","complete":"false","x":1350,"y":500,"wires":[]},{"id":"a558246e.9d8c88","type":"http response","z":"954d764e.834528","name":"","statusCode":"","headers":{"content-type":"application/json"},"x":1350,"y":580,"wires":[]},{"id":"d7ccdc8.b7cb52","type":"function","z":"954d764e.834528","name":"Filter","func":"const {data} = msg.payload\nconst keyword = msg.keyword\nconst stockList = data\nconst stock = stockList.filter(data=> data.StockCode.toUpperCase().includes(keyword.toUpperCase()) || data.StockName.toUpperCase().includes(keyword.toUpperCase()))\nconsole.log(stock)\n\nmsg.payload = stock\nreturn msg;","outputs":1,"noerr":0,"x":1150,"y":580,"wires":[["a558246e.9d8c88","8934f19e.04cf2"]]},{"id":"36519ecc.868462","type":"change","z":"954d764e.834528","name":"","rules":[{"t":"move","p":"payload.keyword","pt":"msg","to":"keyword","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":520,"wires":[["abcabd08.41535"]]},{"id":"25025d9b.e76942","type":"websocket-listener","z":"","path":"/idx/summary","wholemsg":"false"}]

Flow Info

Created 5 years, 4 months ago
Rating: not yet rated

Actions

Rate:

Node Types

Core
  • change (x4)
  • debug (x6)
  • function (x3)
  • http in (x4)
  • http request (x4)
  • http response (x4)
  • inject (x3)
  • websocket out (x3)
  • websocket-listener (x1)
Other
  • tab (x1)

Tags

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