Last active
July 7, 2020 16:22
-
-
Save teklordz/1851b5693b338d4365d8 to your computer and use it in GitHub Desktop.
Bitcoin prices in real time from the coindesk website api (bash script)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!