Monitor Bitcoin price via Linux command line
Quick and dirty way to visually monitor bitcoin price on your desktop using the command line.
You can use any crypto exchange API out there. This example uses Bitfinex REST API.
Open your terminal and issue the following
watch -tcn5 "curl -s https://api-pub.bitfinex.com/v2/ticker/tBTCUSD | awk -F',' '{print \"BTC/USD: $\" \$7}'"
This set of commands runs via the watch
utility that allows us to continuously run them in any given interval. On the previous example it runs every 5 seconds.
In double quotes we enclosing the command(s) we want watch
to run escaping any special character.
We use curl
to send a request to the Bitfinex REST API and specifically we are querying the BTC/USD price. You can use any ticker available by Bitfinex.
Piping the output of curl
to awk
we split the string received by using comma as a delimiter. By a look of the documentation the LAST_PRICE of the ticker is the 7th item.
We use TOIlet to format our text nicely, using a specific font a border and some coloring.
Also make note of the following coming directly from the Bitfinex documentation. Use the watch
interval flag to control the number of total requests you make per minute.
RTFM of the mentioned commands and experiment to harness the power of watch
, awk
, curl
and toilet
!