Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bitcoin prices in real time from the coindesk website api (bash script)
#!/bin/bash
# Credit to David Walsh for the original script <https://davidwalsh.name/bitcoin>
# The improved version of David's script doesn't go back to prompt. It keeps refreshing the prices every 5 seconds.
# Prices are in USD, EUR & GBP (in real time)
# curl must be installed in terminal
clear
echo "Coindesk BTC: "
echo " USD EUR GBP "
while [ 1 ]
do
curl -s http://api.coindesk.com/v1/bpi/currentprice.json | python -c "import json, sys; bitcoin=json.load(sys.stdin); print bitcoin['bpi']['USD']['rate'] + '\t' + bitcoin['bpi']['EUR']['rate'] + '\t' + bitcoin['bpi']['GBP']['rate']"
printf "\033[A"
sleep 5
done
@mountaineerbr

This comment has been minimized.

Copy link

mountaineerbr commented Jul 7, 2020

hey, nice one! check my scripts, some of them have websockets or curl loop to keep fetching the latest rate of bitcoin and other cryptos..
https://github.com/mountaineerbr/markets
cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.