Last active
December 19, 2015 10:19
-
-
Save jmdugan/5939116 to your computer and use it in GitHub Desktop.
ugly command line bitcoin latest
This file contains 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
# to print High/Low/Last price from mtgox | |
# to get json_pp: | |
# described: http://manpages.ubuntu.com/manpages/raring/man1/json_pp.1p.html | |
# or cpan: http://search.cpan.org/~makamaka/JSON-PP-2.27103/bin/json_pp | |
# sudo apt-get install libjson-perl | |
# or use cpan | |
alias mtgox='curl -s -o - http://data.mtgox.com/api/2/BTCUSD/money/ticker' | |
function btc() { echo -n "Last, High, Low: "; mtgox | json_pp | grep -A5 "high\|low\|last\"" | grep y_s | sed -e 's/[ ]*//g' | sed -e 's/\"display_short\"//g' | tr -d "\n" ; echo "" ;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for json_pp. I did not know about this. Here's a slightly more efficient sed statement: curl -s -o - http://data.mtgox.com/api/2/BTCUSD/money/ticker | json_pp 2> /dev/null | grep -A5 "high|low|last"" | grep y_s | sed 's/.$([0-9.])".*/$\1/;' | paste - - -