This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
CloudBot/plugins/bitcoin.py

17 lines
588 B
Python
Raw Normal View History

2011-11-20 10:23:31 +01:00
from util import http, hook
@hook.command(autohelp=False)
def bitcoin(inp, say=None):
2013-04-18 06:32:52 +02:00
"bitcoin -- gets current exchange rate for bitcoins from mtgox"
data = http.get_json("https://data.mtgox.com/api/2/BTCUSD/money/ticker")
data = data['data']
ticker = {
'buy': data['buy']['display_short'],
'high': data['high']['display_short'],
'low': data['low']['display_short'],
'vol': data['vol']['display_short'],
}
say("Current: \x0307%(buy)s\x0f - High: \x0307%(high)s\x0f"
" - Low: \x0307%(low)s\x0f - Volume: %(vol)s" % ticker)