How to add a stock tracker?

I was just wondering what script I would use to add for example AAPL to my touch bar and get live updates on its movements?

Any help is really appreciated :slight_smile:

1 Like

I havent found anything yet that works well. Im not investing time into this now, I am surprised no one has a good widget for this yet.

since google and yahoo shut down their finance APIs there haven't been many good APIs available last time I checked. I think now there are some unofficial yahoo finance apis. If I get some time I'll have a look at these and update one of the old google finance widgets.

You can always do something like

curl -s https://finance.yahoo.com/quote/AAPL/ | perl -MJSON::PP=decode_json -nE 'm/^root\.App\.main = (\{.*\});$/m && say decode_json($1)->{context}{dispatcher}{stores}{StreamDataStore}{quoteData}{AAPL}{regularMarketPrice}{fmt}'

or with up/down and percentages:

curl -s https://finance.yahoo.com/quote/AAPL/ | perl -MJSON::PP=decode_json -nE 'm/^root\.App\.main = (\{.*\});$/m && say join " ", map $_->{fmt}, @{decode_json($1)->{context}{dispatcher}{stores}{StreamDataStore}{quoteData}{AAPL}}{qw/regularMarketPrice regularMarketChange regularMarketChangePercent/}'