check if balance list is empty (fixes #105)

This commit is contained in:
gcarq 2017-11-16 00:01:47 +01:00
parent b5f58724a0
commit 4e05691cab
1 changed files with 8 additions and 5 deletions

View File

@ -273,18 +273,21 @@ def _balance(bot: Bot, update: Update) -> None:
Handler for /balance
Returns current account balance per crypto
"""
output = ""
balances = exchange.get_balances()
output = ''
balances = [
c for c in exchange.get_balances()
if c['Balance'] or c['Available'] or c['Pending']
]
if not balances:
output = '`All balances are zero.`'
for currency in balances:
if not currency['Balance'] and not currency['Available'] and not currency['Pending']:
continue
output += """*Currency*: {Currency}
*Available*: {Available}
*Balance*: {Balance}
*Pending*: {Pending}
""".format(**currency)
send_msg(output)