Skip to content

Instantly share code, notes, and snippets.

@johnwalicki
Forked from dceejay/README.md
Last active December 11, 2019 13:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johnwalicki/d902657ec7fa2b45b14e75fd870c2ba9 to your computer and use it in GitHub Desktop.
Save johnwalicki/d902657ec7fa2b45b14e75fd870c2ba9 to your computer and use it in GitHub Desktop.
Stock Price Alerts

#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

Example

  • Stock Quote flow screenshot
[{"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":[]}]
@SBFfan
Copy link

SBFfan commented Dec 19, 2018

/!\ Update 2017-05-17: Historical API has been shut down by Yahoo Finance
This feature was discontinued by the Finance team and they will not be reintroducing that functionality.

See page http://meumobi.github.io/stocks%20apis/2016/03/13/get-realtime-stock-quotes-yahoo-finance-api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment