Registry / http-networking / snaptrade-python-sdk

snaptrade-python-sdk

JSON →
library11.0.207pypypi✓ verified 85d ago

The SnapTrade Python SDK provides a client library to easily interact with the SnapTrade API, enabling applications to connect brokerage accounts for live positions and trading. It abstracts away direct API calls, handling authentication and data formatting. The library is actively maintained with frequent updates, currently at version 11.0.177, and supports Python versions 3.8 and newer.

pip install snaptrade-python-sdk
INSTALL
IMPORT
SIG · SNAPTRADE-PYTHON-S
S
snaptrade-python-sdk
http-networkingpythonv11.0.207
Install
5.8s avg
Import
1930ms
Disk
59MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v11.0.207 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 2.016s · 58MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.8s · import 1.844s · 60MB
59MB installed
● package 59MB
Code
Verified usage

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

SnapTrade
from snaptrade_client import SnapTrade
from snaptrade.api_client import SnapTradeAPIClient
The primary client class changed from SnapTradeAPIClient in older SDK versions to SnapTrade in the current major version. Ensure you are importing from 'snaptrade_client'.
ApiException
from snaptrade_client import ApiException
Used for catching API-specific errors.

This quickstart demonstrates how to initialize the SnapTrade client, check the API status, and interact with user registration/listing. You will need your SnapTrade `CLIENT_ID` and `CONSUMER_KEY` (obtained from your SnapTrade Dashboard) configured as environment variables. For actual user management and connections, you would register a user with a unique `user_id` from your application, obtain a `user_secret`, and then use these credentials to generate a connection portal URL.

import os from pprint import pprint from snaptrade_client import SnapTrade, ApiException CLIENT_ID = os.environ.get('SNAPTRADE_CLIENT_ID', 'YOUR_CLIENT_ID') CONSUMER_KEY = os.environ.get('SNAPTRADE_CONSUMER_KEY', 'YOUR_CONSUMER_KEY') if not CLIENT_ID or not CONSUMER_KEY: print("Please set SNAPTRADE_CLIENT_ID and SNAPTRADE_CONSUMER_KEY environment variables.") else: try: # 1. Initialize the SnapTrade client snaptrade = SnapTrade( consumer_key=CONSUMER_KEY, client_id=CLIENT_ID, ) # 2. Check API status api_status_response = snaptrade.api_status.check() print("API Status:") pprint(api_status_response) # 3. Register a new user (or use an existing one) # In a real application, you'd associate this user_id with your own user system. # user_id = "unique-user-id-from-your-app" # register_response = snaptrade.authentication.register_snap_trade_user(user_id=user_id) # user_secret = register_response.user_secret # print(f"Registered user: {register_response.user_id}, Secret: {user_secret}") # Example: List existing users (for demonstration) list_users_response = snaptrade.authentication.list_snap_trade_users() if list_users_response and list_users_response.users: print("\nExisting SnapTrade users:") for user_info in list_users_response.users: pprint(user_info) else: print("\nNo SnapTrade users found yet. Register one to proceed with connections.") except ApiException as e: print(f"An API error occurred: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingThe import path for the main client class changed significantly in major version 11. Older versions used `from snaptrade.api_client import SnapTradeAPIClient`, while current versions use `from snaptrade_client import SnapTrade`.
fix
Update your imports from `snaptrade.api_client.SnapTradeAPIClient` to `snaptrade_client.SnapTrade`.
affects: <11.0.0
gotchaThe `consumerKey` and `userSecret` are highly sensitive. Never hardcode them directly into your application's source code, especially for public-facing deployments. Use environment variables or a secure secret management system.
fix
Store `CLIENT_ID`, `CONSUMER_KEY`, and `userSecret` securely (e.g., environment variables, AWS Secrets Manager, Google Secret Manager) and retrieve them at runtime. Do not commit these to version control.
affects: All
gotchaThe SnapTrade API implements rate limiting, typically 250 requests per minute per client. Exceeding this limit will result in HTTP 429 'Too Many Requests' errors.
fix
Implement retry logic with exponential backoff for API requests. Design your application to avoid aggressive bursts of requests, especially during data synchronization or high user signup volumes. Contact SnapTrade support if you require higher rate limits.
affects: All
gotchaThere might be confusion with an older, deprecated Python package also named 'snaptrade'. Ensure you are installing and using `snaptrade-python-sdk`, which is the actively maintained SDK.
fix
Always explicitly install `snaptrade-python-sdk` using `pip install snaptrade-python-sdk` and verify that imports reference `snaptrade_client`.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'snaptrade.api_client'
Attempting to import the client using an outdated import path from an older major version of the SDK.
fix
Change the import statement to `from snaptrade_client import SnapTrade`.
snaptrade_client.exceptions.ApiException: (401) Reason: Unauthorized HTTP response headers: {'Content-Type': 'application/json'} HTTP response body: {'error': 'Unable to verify signature sent'}
This error typically indicates incorrect `CLIENT_ID`, `CONSUMER_KEY`, or `userSecret` used in the request, or an issue with the signature generation (which the SDK handles automatically if credentials are correct).
fix
Verify that your `SNAPTRADE_CLIENT_ID` and `SNAPTRADE_CONSUMER_KEY` environment variables are correct and match the credentials from your SnapTrade Dashboard. Ensure the `user_secret` (if applicable) is also correct and not compromised. If the issue persists, contact SnapTrade support.
snaptrade_client.exceptions.ApiException: (429) Reason: Too Many Requests HTTP response headers: {'Content-Type': 'application/json', 'X-RateLimit-Limit': '250', 'X-RateLimit-Remaining': '0', 'X-RateLimit-Reset': 'X'}
The application has exceeded the API rate limit (default 250 requests per minute).
fix
Implement retry logic with exponential backoff. Distribute API calls over time, especially for bulk operations. Consider contacting SnapTrade support for an increased rate limit if your use case demands it.
Upgrade
Version history
11.0.207latest on PyPI · released Jun 12, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
40 hits · last 30 days
node
36
Resources
snaptrade-python-sdk — pip install snaptrade-python-sdk · libregistry