From 784fff9c2075eff2a792ef64233e0c80d072d686 Mon Sep 17 00:00:00 2001 From: Fabian Schuh Date: Tue, 12 Jan 2016 11:02:33 +0100 Subject: [PATCH] [GrapheneExchange] Skip zero balances --- grapheneexchange/grapheneexchange.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/grapheneexchange/grapheneexchange.py b/grapheneexchange/grapheneexchange.py index 0626acde..14807508 100644 --- a/grapheneexchange/grapheneexchange.py +++ b/grapheneexchange/grapheneexchange.py @@ -457,8 +457,6 @@ def returnBalances(self): "GREENPOINT": 0.0 } - .. note:: Zero balance assets are included! - """ account = self.rpc.get_account(self.config.account) balances = self.ws.get_account_balances(account["id"], []) @@ -466,7 +464,10 @@ def returnBalances(self): assets = self.ws.get_objects(asset_ids) data = {} for i, asset in enumerate(assets) : - data[asset["symbol"]] = float(balances[i]["amount"]) / 10 ** asset["precision"] + amount = float(balances[i]["amount"]) / 10 ** asset["precision"] + if amount == 0.0: + continue + data[asset["symbol"]] = amount return data def returnOpenOrders(self, currencyPair="all"):