Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Commit

Permalink
Stop flooding the console with empty balances
Browse files Browse the repository at this point in the history
  • Loading branch information
petros-double-test1 committed Jan 24, 2018
1 parent 264d500 commit c82e19f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hitbtc/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ def _handle_request_response(self, request, response):
# loop over item in response['result'] for:
# getSymbols, getTrades, getTradingBalance, getOrders
for item in response['result']:
try:
text += msg.format(**item)
except KeyError as e :
print("Formatter for method {} failed on item {} with KeyError {}... item keys {}".format(method, item, e, item.keys()))
# Don't print zero balances
if method is not 'getTradingBalance' or (float(item['available']) > 0 or float(item['reserved']) > 0):
try:
text += msg.format(**item)
except KeyError as e :
print("Formatter for method {} failed on item {} with KeyError {}... item keys {}".format(method, item, e, item.keys()))
self.log.info(text)
self.echo(text)
else:
Expand Down

0 comments on commit c82e19f

Please sign in to comment.