Touch Bar cryptocurrency ticker

If you’re not distracted enough by your cryptocurrency investments as it is, here’s a little thing for you if you have a MacBook Pro with Touch Bar.

Let’s make a ticker for your coins.

It takes a little bit of fidgeting, but it’ll be all worth it in the end to be able to see the price of your investments rise directly above your keyboard. Or, as in my case above, fall into a seemingly bottomless pit. HODL!

First of all, we’ll be using AppleScript for this magic, and we’ll get the current ticker price from CoinMarketCap. As AppleScript sucks notoriously with JSON, we’ll use a little helper tool from the Mac App Store called JSON Helper for AppleScript, so go ahead and install that now.

The main part of the equation is an app called BetterTouchTool. It’s an insanely awesome piece of software that has a stunning amount of features, but the prominent ones are adding custom gestures to your trackpad and mouse, and, as you’ll see, actually putting your Touch Bar to practical use.

After you’ve installed BetterTouchTool, run it, go to the TouchBar tab (1)and click the + Widget button (2). Next, in the Select Widget drop down (3) select Run Apple Script and Show Value, and then click Advanced configuration (4).

Next up, you’ll configure your new Touch Bar widget.

Give the widget a name. Let’s call it BTC. Then, paste the following code in the text field:

This code, when run, retrieves the current bitcoin price from CoinMarketCap, formats it and spits it out again.

Now, I’m not a very good AppleScript coder, and this could probably be done much more elegantly — but it works, and that’s good enough for me. BTW, the origin of this idea came from Charlie Lee; I have just mangled it to my likings.

Next, go to https://coinmarketcap.com/currencies/bitcoin/ and drag the bitcoin logo from the page to the Icon target, and then again to the Alternate icon target. Type a minus in the Activate alternate color and icon if result matches regex text field, and set the Alternate color to #AA0000 (RGB 170 0 0). Lastly, move the slider where it says Execute this script every x seconds to above 60, so the script will only trigger once a minute or so.

Click Save and you’re done!

The code above removes decimals from the price, which is fine for bitcoin as we’re in the thousands now, but if you want your altcoins in the Touch Bar, you’ll probably need a couple of decimals. So use this code for altcoins and tokens:

The above example fetches the current price for ZenCash. For other coins or tokens, just replace zencash in the URL in line 1 with for example litecoin or walton or whatever the url is for the coin or token on CoinMarketCap.

If you enjoyed this, tips are always appreciated. My NANO address is xrb_37uqr5iup7bxws4ee5de75j4hgwpqep3hfbuw9axadiuukqkypiq3jtbqfwa .

Like what you read? Give Noom a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.