Coinbase Cryptocurrency/Litecoin price checker script via API

Howdy all–

Noticed a few days ago that a long running script I had on a cronjob had stopped… about 2 months ago. Yeah.. I should have made some type of checker code but didn’t. Any how. I decided to update the script using the Coinbase Pro API instead of the coinmarket cap API. The main reason for the switch being CMC seems to be super sketchy as of lately. Their numbers, long story short, don’t add up. So without further interruption;

Note: You will need to register on Pro.Coinbase.com and generate an API key for some functions. I don’t believe pricing is one of them but DYOR.

user@buf0rd:~$ curl https://api.coinbase.com/v2/prices/LTC-USD/spot -H ‘Authorization: Bearer API-KEY-HERE | jq -r ‘.data.amount’

Also, if you want to bot-zombie it all and twitterfy it I would recommend doing this all on a Raspberry Pi. Install Twidge. Pipe info.

user@buf0rd:~$ apt-get install twidge #also run setup

user@buf0rd:~$ curl https://api.coinbase.com/v2/prices/LTC-USD/spot -H ‘Authorization: Bearer API-KEY-HERE | jq -r ‘.data.amount’ | twidge