11Unofficial Wealthsimple API Library for Python
22==============================================
33
4- This library allows you to access your own account using the Wealthsimple (GraphQL) API using Python.
4+ This library allows you to access your own Wealthsimple account using the Wealthsimple (GraphQL) API.
5+
6+ > ** Python 3.10+ required**
7+
8+ Features
9+ --------
10+
11+ - Retrieve all accounts (RRSP, TFSA, FHSA, cash, margin, crypto, credit card)
12+ - Get account balances and positions
13+ - Fetch historical performance (net value, deposits, gains)
14+ - Access transaction/activity history
15+ - Search securities and get market data
16+ - Historical price quotes
17+ - Handle 2FA (TOTP) authentication
18+ - Automatic session refresh
19+ - Optional security data caching
520
621Installation
722------------
@@ -12,8 +27,22 @@ uv add ws-api
1227pip install ws-api
1328```
1429
15- Usage
16- -----
30+ ### Basic Example
31+
32+ ``` python
33+ from ws_api import WealthsimpleAPI
34+
35+ # Login (will prompt for username/password/TOTP)
36+ session = WealthsimpleAPI.login(username = " you@example.com" , password = " yourpassword" )
37+ ws = WealthsimpleAPI.from_token(session)
38+
39+ # Get your accounts
40+ accounts = ws.get_accounts()
41+ for account in accounts:
42+ print (f " { account[' description' ]} : { account[' number' ]} " )
43+ ```
44+
45+ ### Full Example
1746
1847Note: You'll need the keyring package to run the code below. Install with: ` uv add keyring ` (or ` pip install keyring ` )
1948
@@ -159,3 +188,8 @@ if __name__ == "__main__":
159188 WSApiTest().main()
160189
161190```
191+
192+ Projects Using It
193+ -----------------
194+
195+ - [ wealthgrabber] ( https://github.com/ebastos/wealthgrabber ) - Wealthsimple portfolio analytics
0 commit comments