Skip to main content

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

Metadata

Release files for ws-api 0.40.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ws-api 0.40.0
File Size Uploaded Provenance Actions
ws_api-0.40.0.tar.gz 57.8 kB With provenance Details for ws_api-0.40.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ws-api 0.40.0
File Interpreter ABI Platform Actions
ws_api-0.40.0-py3-none-any.whl Python 3 none any Details for ws_api-0.40.0-py3-none-any.whl

Total release size: 105.5 kB

Release files / ws_api-0.40.0.tar.gz

Download URL ws_api-0.40.0.tar.gz
Size 57.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1a8bee93c2cfb205ac977c1066fa8c90f61478a63c0a5d823a5aa651bc600cba
BLAKE2b-256 checksum
How to use checksums
d4ded072fbf47c62477c970f7d5c3605ac8d9cf0e10b29b6511f812617001e0d
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 Oct 30, 2026.

Transparency log

Release files / ws_api-0.40.0-py3-none-any.whl

Download URL ws_api-0.40.0-py3-none-any.whl
Size 47.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66d0da82c64fa0af0a99ff91d7fd0d6513f547205a86115f29ab833c57893b33
BLAKE2b-256 checksum
How to use checksums
84d50b982d45998f56879ad08415d4be1719b51216082ba12b0644e0c958e7fd
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 Oct 30, 2026.

Transparency log

Security for ws-api 0.40.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.

Select from 2 files

Attestation for ws_api-0.40.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 Oct 30, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.40.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page