Wrap API calls in helper and validate response
This commit is contained in:
@@ -17,8 +17,10 @@ def get_positions(user, account_id=None):
|
||||
items = []
|
||||
accounts = Account.objects.filter(user=user)
|
||||
for account in accounts:
|
||||
positions = account.client.get_all_positions()
|
||||
print("positions", positions)
|
||||
success, positions = account.client.get_all_positions()
|
||||
if not success:
|
||||
items.append({"name": account.name, "status": "error"})
|
||||
continue
|
||||
|
||||
for item in positions:
|
||||
items.append(item)
|
||||
|
||||
Reference in New Issue
Block a user