#Stock price alerts
Get a stock price quote and output an alert. Output is a full json object and simple text sentence.
How-to
- Import the flow.json to Node-RED, Deploy.
Dependencies
- This flow uses the Yahoo Stock Quote REST API
Example
#Stock price alerts
Get a stock price quote and output an alert. Output is a full json object and simple text sentence.
How-to
Dependencies
Example
[{"id":"8eaef84e.cc3f98","type":"inject","z":"f2301d52.0cff4","name":"","topic":"","payload":"IBM","payloadType":"str","repeat":"","crontab":"","once":true,"x":90,"y":80,"wires":[["f24d9387.e9df9"]]},{"id":"f24d9387.e9df9","type":"http request","z":"f2301d52.0cff4","name":"Get Quote from Yahoo API","method":"GET","ret":"txt","url":"https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22IBM%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=","tls":"","x":300,"y":80,"wires":[["cdec13ad.4c474"]]},{"id":"7d14ca58.058d3c","type":"debug","z":"f2301d52.0cff4","name":"","active":true,"console":"false","complete":"false","x":710,"y":40,"wires":[]},{"id":"cdec13ad.4c474","type":"json","z":"f2301d52.0cff4","name":"","x":510,"y":80,"wires":[["7d14ca58.058d3c","7b8bb4c7.2c72cc","b6c17f83.261c58"]]},{"id":"7b8bb4c7.2c72cc","type":"debug","z":"f2301d52.0cff4","name":"","active":true,"console":"false","complete":"payload.query.results.quote.PercentChange","x":830,"y":80,"wires":[]},{"id":"c5efded6.6316a8","type":"switch","z":"f2301d52.0cff4","name":"","property":"msg.payload.query.results.quote.TickerTrend","propertyType":"msg","rules":[{"t":"eq","v":"+","vt":"str"},{"t":"eq","v":"-","vt":"str"}],"checkall":"true","outputs":2,"x":430,"y":240,"wires":[["5b39977e.572388"],["dc289d30.c2ed48"]]},{"id":"b6c17f83.261c58","type":"function","z":"f2301d52.0cff4","name":"Last Quote Up or Down for Today","func":"msg.payload.query.results.quote.TickerTrend = msg.payload.query.results.quote.PercentChange.charAt(0);\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":240,"wires":[["c5efded6.6316a8","83e49854.4a8a"]]},{"id":"83e49854.4a8a","type":"debug","z":"f2301d52.0cff4","name":"","active":true,"console":"false","complete":"false","x":450,"y":340,"wires":[]},{"id":"dc289d30.c2ed48","type":"template","z":"f2301d52.0cff4","name":"Stock is DOWN","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.query.results.quote.symbol}} is DOWN for the day.","x":640,"y":280,"wires":[["65375fff.c2732"]]},{"id":"5b39977e.572388","type":"template","z":"f2301d52.0cff4","name":"Stock is UP.....","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.query.results.quote.symbol}} is UP for the day.","x":640,"y":200,"wires":[["65375fff.c2732"]]},{"id":"65375fff.c2732","type":"debug","z":"f2301d52.0cff4","name":"","active":true,"console":"false","complete":"false","x":840,"y":240,"wires":[]}] |