Conky Python Mt.Gox Ticker

The python script is as follows (or see attached source):

#! /usr/bin/env python
#coding: utf-8
#Adercon Consulting ( This code may be reused at will but please leave this attribution intact.

import urllib2,datetime
import json as simplejson

data_source = ''
date_format = '%Y-%m-%d %H:%M:%S'
out_sep = ' | '
app_name = 'MT.GOX Ticker'
app_version = '1.0.0'
req = urllib2.Request(data_source, None, {'user-agent':'text/json'})
opener = urllib2.build_opener()
f =
data = simplejson.load(f)   #deserialize
price = data['data']['last_all']['display_short']
high = data['data']['high']['display_short']
low = data['data']['low']['display_short']
volume = data['data']['vol']['display_short'].replace(u'\xa0',' ')   #re-encode space character for utf-8
asof = datetime.datetime.fromtimestamp(int(data['data']['now'][:10])).strftime(date_format)
print app_name+' @'+asof+ \
    '\n Now: '+price+' (vol: '+volume+')'+ \
    '\n   high: '+high+out_sep+'low: '+low

This script can be called from conky as follows:

${texeci 60 ~/scripts/}

The above uses threaded execi to call the script every 60 seconds.

The results will be similar to the following:

MT.Gox Ticker Example