# Dash Board for showing the Stock Market Indices

**URL:** https://discourse.nodered.org/t/dash-board-for-showing-the-stock-market-indices/66338
**Category:** Share Your Projects
**Tags:** node-red-dashboard
**Created:** [11 August 2022 19:11 UTC](https://discourse.nodered.org/t/dash-board-for-showing-the-stock-market-indices/66338 "2022-08-11T19:11:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ptnodered](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@ptnodered](https://discourse.nodered.org/u/ptnodered)
#### Post date: [11 August 2022 19:11 UTC](https://discourse.nodered.org/t/dash-board-for-showing-the-stock-market-indices/66338/1 "2022-08-11T19:11:26Z")

</div>

I am sharing my Dash Board showing the Stock Market Indices. I have used Node-red example "Example 6.1 Retrieving data from a web page". The selector option in html is different from example.

Regards,  
Prasoon Tewari  
[Dash\_Board\_Share\_Market\_Indices.pdf](https://discourse.nodered.org/uploads/short-url/niOk2CuMbvULzSLSBZHkRgIZExa.pdf) (62.0 KB)

```auto
[{"id":"c0cd3a0a166e073e","type":"http request","z":"89f5d325.b5e2a","name":"Get Market data","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.google.com/finance/","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"headers":[],"x":280,"y":3100,"wires":[["267993ae7035ce64"]]},{"id":"267993ae7035ce64","type":"html","z":"89f5d325.b5e2a","name":"Parse indices","property":"payload","outproperty":"payload","tag":".lkR3Y .lh92 .YMlKec","ret":"html","as":"single","x":520,"y":3000,"wires":[["13c760f60c57e333","82bae9de6677313c","3c1763a6eb2ffcbb"]]},{"id":"15b0579251864545","type":"inject","z":"89f5d325.b5e2a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":3020,"wires":[["c0cd3a0a166e073e"]]},{"id":"d6d2dbf38ac6cd0f","type":"ui_text","z":"89f5d325.b5e2a","group":"c8f428f6.3c4ca8","order":1,"width":"0","height":"0","name":"","label":"StockMarket","format":"{{msg.payload}}","layout":"row-left","x":790,"y":3020,"wires":[]},{"id":"13c760f60c57e333","type":"debug","z":"89f5d325.b5e2a","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":820,"y":3080,"wires":[]},{"id":"82bae9de6677313c","type":"function","z":"89f5d325.b5e2a","name":"function 1","func":"msg.headers = msg.originalHeaders;\nvar prices = msg.payload;\nvar newPayload = [];\nvar priceIndex = ['Dow Jones', 'Dow Jones', 'S&P', 'S&P', 'Nasdaq', 'Nasdaq', 'Russel', 'Russel', 'Vix', 'Vix'];\nfor (var i = 0; i < prices.length; i++) {\n newPayload.push({\n index: priceIndex[i],\n value: msg.payload[i].replace(/,/g,\"\" )\n });\n}\nmsg.payload = newPayload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":3140,"wires":[["a817fa002252a27f","d6d2dbf38ac6cd0f"]]},{"id":"a817fa002252a27f","type":"debug","z":"89f5d325.b5e2a","name":"debug 8","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":3140,"wires":[]},{"id":"cbd200bcf4812c3b","type":"change","z":"89f5d325.b5e2a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":3240,"wires":[["8cfd659c488d98af","c591b71bc6da0ccd"]]},{"id":"c591b71bc6da0ccd","type":"debug","z":"89f5d325.b5e2a","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":3260,"wires":[]},{"id":"8cfd659c488d98af","type":"ui_gauge","z":"89f5d325.b5e2a","name":"Dow Jones","group":"c8f428f6.3c4ca8","order":2,"width":9,"height":5,"gtype":"gage","title":"Dow Jones","label":"units","format":"{{value}}","min":0,"max":"50000","colors":["#00b5c8","#e6e600","#ca3838"],"seg1":"20000","seg2":"50000","x":810,"y":3220,"wires":[]},{"id":"3c1763a6eb2ffcbb","type":"function","z":"89f5d325.b5e2a","name":"function 2","func":"msg.headers = msg.originalHeaders;\nvar prices = msg.payload;\nvar newPayload = [];\nfor (var i = 0; i < prices.length; i++) {\n newPayload.push(\n msg.payload[i].replace(/,/g, \"\")\n );\n}\nmsg.payload = newPayload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":3180,"wires":[["cbd200bcf4812c3b","76a2e720690b4cf4","f35b561fdd7489f1","4dc6f7eec6be2832","1a2a72e13fac8b96"]]},{"id":"76a2e720690b4cf4","type":"change","z":"89f5d325.b5e2a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[2]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":3300,"wires":[["a5c6b6f2f25a62d2"]]},{"id":"a5c6b6f2f25a62d2","type":"ui_gauge","z":"89f5d325.b5e2a","name":"S&P","group":"c8f428f6.3c4ca8","order":3,"width":9,"height":5,"gtype":"gage","title":"S&P","label":"units","format":"{{value}}","min":0,"max":"50000","colors":["#00b5c8","#e6e600","#ca3838"],"seg1":"20000","seg2":"50000","x":790,"y":3300,"wires":[]},{"id":"f35b561fdd7489f1","type":"change","z":"89f5d325.b5e2a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[4]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":3360,"wires":[["c24057198003224b"]]},{"id":"c24057198003224b","type":"ui_gauge","z":"89f5d325.b5e2a","name":"Nasdaq","group":"c8f428f6.3c4ca8","order":3,"width":9,"height":5,"gtype":"gage","title":"Nasdaq","label":"units","format":"{{value}}","min":0,"max":"50000","colors":["#00b5c8","#e6e600","#ca3838"],"seg1":"20000","seg2":"50000","x":800,"y":3360,"wires":[]},{"id":"4dc6f7eec6be2832","type":"change","z":"89f5d325.b5e2a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[6]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":3420,"wires":[["f2b859b0094c2325"]]},{"id":"f2b859b0094c2325","type":"ui_gauge","z":"89f5d325.b5e2a","name":"Russel","group":"c8f428f6.3c4ca8","order":3,"width":9,"height":5,"gtype":"gage","title":"Russel","label":"units","format":"{{value}}","min":0,"max":"50000","colors":["#00b5c8","#e6e600","#ca3838"],"seg1":"20000","seg2":"50000","x":790,"y":3420,"wires":[]},{"id":"1a2a72e13fac8b96","type":"change","z":"89f5d325.b5e2a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[8]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":3480,"wires":[["e33cc3cfbbe1f5bd"]]},{"id":"e33cc3cfbbe1f5bd","type":"ui_gauge","z":"89f5d325.b5e2a","name":"Vix","group":"c8f428f6.3c4ca8","order":3,"width":9,"height":5,"gtype":"gage","title":"Vix","label":"units","format":"{{value}}","min":0,"max":"50000","colors":["#00b5c8","#e6e600","#ca3838"],"seg1":"20000","seg2":"50000","x":790,"y":3480,"wires":[]},{"id":"c8f428f6.3c4ca8","type":"ui_group","name":"Stock Market Index","tab":"5a28a0ac.e6b3e","order":1,"disp":true,"width":"27","collapse":true},{"id":"5a28a0ac.e6b3e","type":"ui_tab","name":"Home","icon":"dashboard","order":15}]

```

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [12 August 2022 06:30 UTC](https://discourse.nodered.org/t/dash-board-for-showing-the-stock-market-indices/66338/2 "2022-08-12T06:30:44Z")

</div>

Just tried your flow. Although it returns Code 200 all the Debug nodes show 'empty'.  
I live in the UK not the USA, so maybe the selectors need changing for the FTSE.  
Any suggestions of things I could try?  
 ![empty](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e5bf621740b448ad76ca5653e9ab3dd9c0f651b9.png)

---

<div class="post-metadata">

### Author: ![ptnodered](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@ptnodered](https://discourse.nodered.org/u/ptnodered)
#### Post date: [13 August 2022 02:39 UTC](https://discourse.nodered.org/t/dash-board-for-showing-the-stock-market-indices/66338/3 "2022-08-13T02:39:53Z")

</div>

When I tried selector given in the example "Example 6.1 Retrieving data from a web page" did not work so after many trial the selector worked. So for your location you can try the attached document to know the correct selector.  
[To\_know\_the\_selector\_of\_web\_Page.pdf](https://discourse.nodered.org/uploads/short-url/vM08uxXeACQ0Laf0LLcDXMsUomx.pdf) (908.4 KB)
