Skip to content

Commit

Permalink
[GrapheneExchange] Skip zero balances
Browse files Browse the repository at this point in the history
  • Loading branch information
xeroc committed Jan 12, 2016
1 parent c8199bd commit 784fff9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions grapheneexchange/grapheneexchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,17 @@ 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"], [])
asset_ids = [a["asset_id"] for a in balances]
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"):
Expand Down

0 comments on commit 784fff9

Please sign in to comment.