Show Stock Ticker, Possible Solution Found...?

I was looking around to see if there was anyway to display stock tickers on the touch bar and i came across this old posting about it where people were trying to figure it out. Funny enough, it looks like the last comment on the thread might have solved the issue but it was never responded to. For example, using "https://api.iextrading.com/1.0/stock/aapl/quote" returns a bunch of info about AAPL including "changePercent"

I have zero idea how to write apple or shell script, but wouldnt it be possible to have the script return that value (and hopefully convert it into a percentage format by moving the decimal over)? Can someone with more knowledge about this type of stuff take a peak at it?

Soooo has anyone had a chance to take a look at this?

It looks like no one has shared a solution to this problem since late 2017.

Here is a simple Node.js script that uses the Finnhub stock market API and a library called Axios to display a stock's current price as well as its percent change.

btt_node_stock_tracker.js (1.6 KB)
EDIT: File uploaded to Pastebin since the original upload didn't work.

Setup Instructions

  1. Create a new Touch Bar trigger
  2. Set the type to: "Shell Script / Task Widget"
  3. Under "Widget Specific" settings:
    1. "Execute script every":
      5 seconds
    2. "Launch Path":
      /usr/local/bin/node
    3. "Parameters":
      ~/Downlods/btt_node_stock_tracker.js
  4. Open Terminal and run this command:
    cd ~/Downloads/btt_node_stock_tracker.js && npm install axios

The link isn't working, I get the following error when trying to download the file: "The change you wanted was rejected. Maybe you tried to change something you didn't have access to."

1 Like

There seems to be a bug with the file upload on this site.

I've uploaded the same file to WeTransfer, so you can download it from there:

And here is the same file again, but uploaded to Pastebin:
https://pastebin.com/pHQnfjmU