Unofficial Wealthsimple API Library for Python
This library allows you to access your own Wealthsimple account using the Wealthsimple (GraphQL) API.
Python 3.10+ required
Features
- Retrieve all accounts (RRSP, TFSA, FHSA, cash, margin, crypto, credit card)
- Get account balances and positions
- Fetch historical performance (net value, deposits, gains)
- Access transaction/activity history
- Search securities and get market data
- Historical price quotes
- Handle 2FA (TOTP) authentication
- Automatic session refresh
- Optional security data caching
Installation
uv add ws-api
# or
pip install ws-api
Upgrading
If you are updating from 0.35 or less, to 0.36 or more, the requests dependency has been replaced with curl_cffi.
If you installed using uv or pip (and you update using either), they will take care of that for you.
Basic Example
from ws_api import WealthsimpleAPI
# Login (will prompt for username/password/TOTP); notify the user if Wealthsimple requires mobile approval.
session = WealthsimpleAPI.login(
username="you@example.com",
password="yourpassword",
approval_callback=lambda: print("Approve the login in the Wealthsimple mobile app."),
)
ws = WealthsimpleAPI.from_token(session)
# Get your accounts
accounts = ws.get_accounts()
for account in accounts:
print(f"{account['description']}: {account['number']}")
When mobile approval is required, login polls for up to two minutes and retries
automatically after approval. Without an approval callback, it emits a warning.
If a TOTP code is required, login raises OTPRequiredException; callers must
obtain the code and retry with otp_answer. See the full example below.
Full Example
Note: You'll need the keyring package to run the code below. Install with: uv add keyring (or pip install keyring)
See tests/test_full_example.py
Projects Using It
- wealthgrabber - Wealthsimple portfolio analytics
Metadata
Release files for ws-api 0.41.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ws_api-0.41.0.tar.gz | 58.0 kB | With provenance | Details for ws_api-0.41.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ws_api-0.41.0-py3-none-any.whl | Python 3 | none | any | Details for ws_api-0.41.0-py3-none-any.whl |
Total release size: 105.8 kB
Release files / ws_api-0.41.0.tar.gz
| Download URL | ws_api-0.41.0.tar.gz |
|---|---|
| Size | 58.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b357691980e0488aaaafa57badff343899da8e64ba3e08320fd1f85af2e8ad41
|
|
BLAKE2b-256 checksum How to use checksums |
91d383de6769bfd7c457e9f3bae99c0893ac85b7c618ea95b9bf997b2c02a4e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / ws_api-0.41.0-py3-none-any.whl
| Download URL | ws_api-0.41.0-py3-none-any.whl |
|---|---|
| Size | 47.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7270d2e425d79c7bcb5e1e100c00af0501596557d140c050f6705488a2ab196c
|
|
BLAKE2b-256 checksum How to use checksums |
c52b7f36f51188010216d66a73695288b877cf0bdfd56c0afe22c6e47abc9bd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for ws-api 0.41.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ws_api-0.41.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.