Add @staticmethod to __currency
This commit is contained in:
parent
ddf1d18a92
commit
023ac72be6
|
@ -11,13 +11,14 @@ from . import Plugin
|
||||||
class Coins(Plugin):
|
class Coins(Plugin):
|
||||||
API_URL = 'https://api.cryptowat.ch/markets/{market}/{crypto}{currency}/summary'
|
API_URL = 'https://api.cryptowat.ch/markets/{market}/{crypto}{currency}/summary'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def __currency(name, prefix=None, suffix=None):
|
def __currency(name, prefix=None, suffix=None):
|
||||||
def str(value):
|
def tostr(value):
|
||||||
return '{prefix}{value:,.2f}{suffix}'.format(
|
return '{prefix}{value:,.2f}{suffix}'.format(
|
||||||
prefix=prefix or '',
|
prefix=prefix or '',
|
||||||
suffix=suffix or ('' if (prefix or suffix) else (' ' + name)),
|
suffix=suffix or ('' if (prefix or suffix) else (' ' + name)),
|
||||||
value=value)
|
value=value)
|
||||||
return str
|
return tostr
|
||||||
|
|
||||||
CURRENCIES = {
|
CURRENCIES = {
|
||||||
'usd': __currency('usd', prefix='$'),
|
'usd': __currency('usd', prefix='$'),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user