Move __currency into Coins class
This commit is contained in:
parent
180825dfe1
commit
ddf1d18a92
16
bot/coins.py
16
bot/coins.py
|
@ -7,16 +7,18 @@ from irc3.utils import IrcString
|
|||
from . import Plugin
|
||||
|
||||
|
||||
def __currency(name, prefix=None, suffix=None):
|
||||
def str(value):
|
||||
return '{prefix}{value:,.2f}{suffix}'.format(
|
||||
prefix=prefix or '',
|
||||
suffix=suffix or ('' if (prefix or suffix) else (' ' + name)),
|
||||
value=value)
|
||||
return str
|
||||
|
||||
class Coins(Plugin):
|
||||
API_URL = 'https://api.cryptowat.ch/markets/{market}/{crypto}{currency}/summary'
|
||||
|
||||
def __currency(name, prefix=None, suffix=None):
|
||||
def str(value):
|
||||
return '{prefix}{value:,.2f}{suffix}'.format(
|
||||
prefix=prefix or '',
|
||||
suffix=suffix or ('' if (prefix or suffix) else (' ' + name)),
|
||||
value=value)
|
||||
return str
|
||||
|
||||
CURRENCIES = {
|
||||
'usd': __currency('usd', prefix='$'),
|
||||
'eur': __currency('eur', suffix='€'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user