fixes percent_change formatting

This commit is contained in:
Mike Shultz 2020-03-06 16:27:33 -07:00
parent 0eb8e9bf94
commit 5c593255a7

7
bot.py
View File

@ -156,7 +156,10 @@ class TokenData:
@property @property
def percent_change(self): def percent_change(self):
self.update() self.update()
return self._percent_change pc = str(self._percent_change)
if pc and not pc.startswith('-'):
pc = '+{}'.format(pc)
return pc
@property @property
def market_cap(self): def market_cap(self):
@ -555,7 +558,7 @@ class TelegramMonitorBot:
@{}""".format( @{}""".format(
monetary_format(pdata.price), monetary_format(pdata.price),
monetary_format(pdata.percent_change), pdata.percent_change,
monetary_format(pdata.market_cap), monetary_format(pdata.market_cap),
monetary_format(pdata.volume), monetary_format(pdata.volume),
update.effective_user.username, update.effective_user.username,