Skip to content

Commit 10d966a

Browse files
authored
Merge pull request #58 from brianjmurrell/usd-cash-balances
Display both USD and CA available balances
2 parents d44df04 + f93a722 commit 10d966a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ class WSApiTest:
151151

152152
# Cash and positions balances
153153
balances = ws.get_account_balances(account['id'])
154-
cash_balance_key = 'sec-c-usd' if account['currency'] == 'USD' else 'sec-c-cad'
155-
cash_balance = float(balances.get(cash_balance_key, 0))
156-
print(f" Available (cash) balance: {cash_balance} {account['currency']}")
154+
for cash_balance_key in [ 'sec-c-usd', 'sec-c-cad']:
155+
cash_balance = float(balances.get(cash_balance_key, 0))
156+
print(f" Available (cash) balance: {cash_balance} {cash_balance_key.split('-')[-1].upper()}")
157157

158158
if len(balances) > 1:
159159
print(" Assets:")
@@ -199,4 +199,4 @@ if __name__ == "__main__":
199199
Projects Using It
200200
-----------------
201201

202-
- [wealthgrabber](https://github.com/ebastos/wealthgrabber) - Wealthsimple portfolio analytics
202+
- [wealthgrabber](https://github.com/ebastos/wealthgrabber) - Wealthsimple portfolio analytics

0 commit comments

Comments
 (0)