added new command to return balance across all currencies

This commit is contained in:
Samuel Husso
2017-10-28 08:44:49 +03:00
parent 29de1645fe
commit dd78c62c3d
3 changed files with 29 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ def init(config: dict) -> None:
handles = [
CommandHandler('status', _status),
CommandHandler('profit', _profit),
CommandHandler('balance', _balance),
CommandHandler('start', _start),
CommandHandler('stop', _stop),
CommandHandler('forcesell', _forcesell),
@@ -201,6 +202,26 @@ def _profit(bot: Bot, update: Update) -> None:
)
send_msg(markdown_msg, bot=bot)
@authorized_only
def _balance(bot: Bot, update: Update) -> None:
"""
Hander for /balance
Returns current account balance per crypto
"""
filter = {'Currency', 'CryptoAddress'}
output = ""
balances = exchange.get_balances()
for c in balances:
# output[c['Currency']] = {k: c[k] for k in c.keys() & {*set(c) - set(filter)}}
output += """*Currency*: {Currency}
*Available*: {Available}
*Balance*: {Balance}
*Pending*: {Pending}
""".format(**c)
send_msg(output)
@authorized_only
def _start(bot: Bot, update: Update) -> None: