adds BTC price change
This commit is contained in:
parent
88aeaf222e
commit
dd0704844d
20
bot.py
20
bot.py
@ -109,8 +109,9 @@ class TokenData:
|
|||||||
def __init__(self, symbol, price=None, stamp=datetime.now()):
|
def __init__(self, symbol, price=None, stamp=datetime.now()):
|
||||||
self.symbol = symbol
|
self.symbol = symbol
|
||||||
self._price = price
|
self._price = price
|
||||||
self._btcPrice = 0
|
self._btc_price = 0
|
||||||
self._percent_change = 0
|
self._percent_change = 0
|
||||||
|
self._btc_percent_change = 0
|
||||||
self._volume = 0
|
self._volume = 0
|
||||||
self._market_cap = 0
|
self._market_cap = 0
|
||||||
if price is not None:
|
if price is not None:
|
||||||
@ -166,7 +167,8 @@ class TokenData:
|
|||||||
except Exception as err:
|
except Exception as err:
|
||||||
print('Error fetching data: ', str(err))
|
print('Error fetching data: ', str(err))
|
||||||
if data is not None:
|
if data is not None:
|
||||||
self._btcPrice = data.get('price')
|
self._btc_price = data.get('price')
|
||||||
|
self._btc_percent_change = data.get('percent_change')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def price(self):
|
def price(self):
|
||||||
@ -174,9 +176,14 @@ class TokenData:
|
|||||||
return self._price
|
return self._price
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def btcPrice(self):
|
def btc_price(self):
|
||||||
self.update()
|
self.update()
|
||||||
return self._btcPrice
|
return self._btc_price
|
||||||
|
|
||||||
|
@property
|
||||||
|
def btc_percent_change(self):
|
||||||
|
self.update()
|
||||||
|
return self._btc_percent_change
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def volume(self):
|
def volume(self):
|
||||||
@ -587,14 +594,15 @@ class TelegramMonitorBot:
|
|||||||
message = """
|
message = """
|
||||||
*Origin Token* (OGN)
|
*Origin Token* (OGN)
|
||||||
*USD Price*: {} ({}%)
|
*USD Price*: {} ({}%)
|
||||||
*BTC Price*: {}
|
*BTC Price*: {} ({}%)
|
||||||
*Market Cap*: {}
|
*Market Cap*: {}
|
||||||
*Volume(24h)*: {}
|
*Volume(24h)*: {}
|
||||||
|
|
||||||
@{}""".format(
|
@{}""".format(
|
||||||
monetary_format(pdata.price, decimals=5),
|
monetary_format(pdata.price, decimals=5),
|
||||||
pdata.percent_change,
|
pdata.percent_change,
|
||||||
btc_format(pdata.btcPrice),
|
btc_format(pdata.btc_price),
|
||||||
|
pdata.btc_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,
|
||||||
|
Loading…
Reference in New Issue
Block a user