You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of the response having all accounts in a list. It would return a single account.
Example call: print(luno.get_balances(account_id='12345678910'))
@aamustapha I think we are saying the same thing. I just created this issue to start a conversation about whether this filtering would be useful to have in this client or if the filtering should be done by some calling function.
Here is my suggestion:
def get_balances(self, assets=None, account_id=None):
"""
:param account_id: filter api response to return a specific account only
"""
req = {
'assets': assets,
}
if account_id:
response = self.do('GET', '/api/1/balance', req=req, auth=True)
for account in response["balances"]:
if account_id == account["account_id"]:
return account
else:
return self.do('GET', '/api/1/balance', req=req, auth=True)
In terms of coding design, it might be a bad idea to have this client do the filtering AND the api calls. But we could also add a "filter" argument to some functions.
Instead of the response having all accounts in a list. It would return a single account.
Example call:
print(luno.get_balances(account_id='12345678910'))
Example output:
{'account_id': '12345678910', 'asset': 'XBT', 'balance': '0.00', 'reserved': '0.00', 'unconfirmed': '0.00'}
The text was updated successfully, but these errors were encountered: