Registry / http-networking / schwab-py

schwab-py

JSON →
library1.5.1pypypi✓ verified 79d ago

An unofficial Python API wrapper for the Schwab HTTP API, providing access to trading, account data, market data, and streaming. Current version is 1.5.1, requires Python >=3.10. Active development with frequent releases.

pip install schwab-py
INSTALL
IMPORT
SIG · SCHWAB-PY
S
schwab-py
http-networkingpythonv1.5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

auth
from schwab import auth
from schwab import auth; client = auth.client_from_token_file('/path/to/token.json', 'your-app-key', 'your-app-secret')
client
from schwab import client
orders
from schwab import orders

Initialize client and fetch account numbers and a stock quote.

import os from schwab import auth from schwab.client import Client # Set up authentication (first time will open browser for OAuth) token_path = '/path/to/token.json' app_key = os.environ.get('SCHWAB_APP_KEY', 'your-app-key') app_secret = os.environ.get('SCHWAB_APP_SECRET', 'your-app-secret') # On first run, this will prompt for login via browser try: client = auth.client_from_token_file(token_path, app_key, app_secret) except FileNotFoundError: # Token file doesn't exist yet; perform initial login client = auth.easy_client(app_key, app_secret, token_path) # Get account info accounts = client.get_account_numbers() print(accounts) # Get a quote quote = client.get_quote('AAPL') print(quote)
Debug
Known issues
breakingThe easy_client utility logs you out of all other Schwab API sessions in the browser. Use only on a dedicated browser or incognito window.
fix
Use a separate browser profile or incognito window when running easy_client.
affects: all
deprecatedImporting from schwab.auth (e.g., from schwab.auth import client_from_token_file) is deprecated in favor of from schwab import auth; auth.client_from_token_file(...).
fix
Use 'from schwab import auth' and then auth.client_from_token_file().
affects: >=1.0.0
gotchaThe token file is a JSON file that must be kept secret. The library automatically refreshes tokens, but if the file is deleted or corrupted, you must re-authenticate.
fix
Store token file securely and back it up. If lost, delete token file and re-run easy_client.
affects: all
gotchaSchwab's API has rate limits. The library does not handle rate limiting automatically; you may get 429 errors.
fix
Implement your own retry logic with exponential backoff for 429 responses.
affects: all
Upgrade
Version history
1.5.1latest on PyPI · released Jun 30, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources