Estimated BTC and fiat value for balance
This commit is contained in:
parent
5a50b88f52
commit
dd9ab5264d
@ -382,13 +382,31 @@ def _balance(bot: Bot, update: Update) -> None:
|
||||
if not balances:
|
||||
output = '`All balances are zero.`'
|
||||
|
||||
total = 0.0
|
||||
for currency in balances:
|
||||
output += """*Currency*: {Currency}
|
||||
coin = currency['Currency']
|
||||
if coin == 'BTC':
|
||||
currency["Rate"] = 1.0
|
||||
else:
|
||||
currency["Rate"] = exchange.get_ticker('BTC_' + coin, False)['bid']
|
||||
currency['BTC'] = currency["Rate"] * currency["Balance"]
|
||||
total = total + currency['BTC']
|
||||
output += """{Currency}:
|
||||
*Available*: {Available}
|
||||
*Balance*: {Balance}
|
||||
*Pending*: {Pending}
|
||||
*Est. BTC*: {BTC: .8f}
|
||||
|
||||
""".format(**currency)
|
||||
|
||||
symbol = _CONF['fiat_display_currency']
|
||||
value = _FIAT_CONVERT.convert_amount(
|
||||
total, 'BTC', symbol
|
||||
)
|
||||
output += """*Estimated Value*:
|
||||
*BTC*: {0: .8f}
|
||||
*{1}*: {2: .2f}
|
||||
""".format(total, symbol, value)
|
||||
send_msg(output)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user