Tidy up Coins

This commit is contained in:
mrhanky 2017-05-16 14:35:54 +02:00
parent 93b97c99c4
commit 38e571000e
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -24,10 +24,9 @@ class Coins(Plugin):
%%btc
"""
data = requests.get('https://www.bitstamp.net/api/ticker').json()
return fmt('{bold}[BitStamp, 24h]{reset} '
values = {k: float(data[k]) for k in ['last', 'high', 'low', 'volume']}
return fmt('{bold}[BitStamp]{reset} '
'Current: {bold}{color}{orange}${last:,.2f}{reset} - '
'High: {bold}{color}{green}${high:,.2f}{reset} - '
'Low: {bold}{color}{maroon}${low:,.2f}{reset} - '
'Volume: {bold}฿{volume:,.2f}',
last=float(data['last']), high=float(data['high']),
low=float(data['low']), volume=float(data['volume']))
'Volume: {bold}฿{volume:,.2f}', **values)