a3nm's blog

Quick plot of the mtgox bitcoin exchange rate

— updated

I thought I would share the following snippet to display a graph of the current BTC-USD exchange rate on mtgox (with a resolution of one second and a range of one minute; adapting to other values is trivial).

while true; do
  curl -s https://mtgox.com/code/data/ticker.php | jshon -e ticker -e last;
  sleep 1;
done | feedGnuplot --lines --stream --xlen 60 --xlabel "s" --ylabel "USD/BTC"

The aim isn't to sing the praises of Bitcoin (or of mtgox), but to advertise two useful tools which weren't so easy to find: jshon (take a JSON stream on stdin and extract information to stdout), and feedGnuplot (take data points on stdin and produce a plot using gnuplot).

comments welcome at a3nm<REMOVETHIS>@a3nm.net