Skip to main content

deployquant-schwab

A broker adapter that lets DQengine trade a Charles Schwab brokerage account through the Schwab Trader API.

pip install deployquant-schwab

That is the whole setup on the DQengine side. The package registers itself, and dqengine brokers then lists schwab.

The adapter talks to the Trader API directly with Python's standard library. It needs no Schwab SDK and has no optional extras.

Credentials

You use your own Schwab developer app. Register an app in the Schwab developer portal. The redirect URI has to be HTTPS and has to be registered there. After you authorize the app, you have an app key, an app secret and a refresh token.

The adapter takes them as a creds mapping with app_key, app_secret, refresh_token and an optional account_number. When it refreshes the access token or looks up the account, it gives you back an updated mapping. It does not store credentials anywhere.

dqengine_schwab.oauth does the token refresh, which is one POST to Schwab's token endpoint. Your application runs the first two steps of the OAuth flow: building the authorization URL and exchanging the code.

Schwab's refresh tokens expire after seven days. When that happens the adapter raises BrokerAuthExpired, and the account owner has to authorize again.

No paper trading

Schwab has no paper environment, so this adapter trades real money. The adapter reports short selling as unsupported until it has been checked on a real account.

What the adapter has to get right

DQengine has a conformance test for broker adapters (tests/test_adapter_conformance.py), and this plugin has to pass it. The test checks three things. The adapter declares what it supports correctly: order types, time in force, short selling and extended hours. It refuses an unsupported order before anything is sent to the broker. Every broker error comes back as one of the exception types in dqengine.adapters.base.

Schwab rejects bad orders after accepting them. The order is created first and then shows up as REJECTED. The adapter keeps such an order visible until it reaches a final state.

License

PolyForm Shield 1.0.0. You can use, change and run it for anything, including trading your own money, except building a product or service that competes with DQengine or with the products built on it. See NOTICE.

Release files for deployquant-schwab 0.1.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 deployquant-schwab 0.1.0
File Size Uploaded
deployquant_schwab-0.1.0.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deployquant-schwab 0.1.0
File Interpreter ABI Platform
deployquant_schwab-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.0 kB

Release files / deployquant_schwab-0.1.0.tar.gz

Download URL deployquant_schwab-0.1.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
73f52243fa21c31ed8e7554ed86f5a7ef74b3e706dc0ed2ed9ada2585dafacb3
BLAKE2b-256 checksum
How to use checksums
b644025b96e99fe77fa894f24005a3d9f7163e7915f03bffb10a2f0b9d028a0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / deployquant_schwab-0.1.0-py3-none-any.whl

Download URL deployquant_schwab-0.1.0-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d0375e4515a20ff1d8e5647e1f074591db3cadec329df31d6bc2e56761184b6
BLAKE2b-256 checksum
How to use checksums
97c9a7c1a4e1a512d14a6bd52018126a821546492d3953171f6c9e89fa3458b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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