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

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.41.1
File Size Uploaded Provenance Actions
ws_api-0.41.1.tar.gz 58.5 kB With provenance Details for ws_api-0.41.1.tar.gz

Built distribution (wheel)

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

Total release size: 106.3 kB

Release files / ws_api-0.41.1.tar.gz

Download URL ws_api-0.41.1.tar.gz
Size 58.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5e0b07388829d5a99cf9fd338c612adcc5cce8c288e8ac2fd0fb0e51cc94b496
BLAKE2b-256 checksum
How to use checksums
057b6d9c6b5af81d91a1ea1a688e2754b856561e5435f237f8d8713ace8a52b8
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 log

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

Download URL ws_api-0.41.1-py3-none-any.whl
Size 47.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fc91a9795936311865a49416364866166f8f1c0d460abf9b77ca90ed0eda523
BLAKE2b-256 checksum
How to use checksums
b41643f1e0178a8ce3db546d0999ee77928bbf77f11454cc6d31a1d8d5485146
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 log

Security for ws-api 0.41.1

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