Add @staticmethod to __currency

This commit is contained in:
Nils Schweinsberg 2017-10-15 03:40:00 +02:00
parent ddf1d18a92
commit 023ac72be6

View File

@ -11,13 +11,14 @@ from . import Plugin
class Coins(Plugin):
API_URL = 'https://api.cryptowat.ch/markets/{market}/{crypto}{currency}/summary'
@staticmethod
def __currency(name, prefix=None, suffix=None):
def str(value):
def tostr(value):
return '{prefix}{value:,.2f}{suffix}'.format(
prefix=prefix or '',
suffix=suffix or ('' if (prefix or suffix) else (' ' + name)),
value=value)
return str
return tostr
CURRENCIES = {
'usd': __currency('usd', prefix='$'),