Connect to a user's investment accounts via SnapTrade SDK and generate portfolio reports (e.g., daily total value). Use when the user wants SnapTrade-based brokerage connectivity (Webull, E*TRADE, etc.), connection portal links, account registration, or automated portfolio summaries.
Connect brokerage accounts through SnapTrade and generate a daily total-value report. This skill uses the official SnapTrade Python SDK (snaptrade_client) with request signing handled automatically.
Run:
python3 scripts/snaptrade_order.py buy|sell TICKER UNITS --account-id <ACCOUNT_ID> [--order-type market|limit] [--limit-price <PRICE>] [--tif Day|GTC|IOC|FOK]
Defaults:
Optional monitoring (poll recent orders):
python3 scripts/snaptrade_order.py buy|sell TICKER UNITS --account-id <ACCOUNT_ID> --watch
--watch-interval and --watch-secondsWatch an existing order by ID:
python3 scripts/snaptrade_watch_order.py --account-id <ACCOUNT_ID> --order-id <BROKERAGE_ORDER_ID>
--watch-interval and --watch-secondsUse account orders endpoint to confirm fills and report open orders to the user when asked.
You need a SnapTrade account to connect brokerages. Create a free account at https://snaptrade.com, generate your Client ID and Consumer Key, then add them to the skill config.
pip3 install -r requirements.txt
Store credentials in a local config file (not committed). user_id is generated automatically on first run:
/home/openclaw/.openclaw/workspace/secrets/snaptrade.json
Example:
{
"client_id": "YOUR_CLIENT_ID",
"consumer_key": "YOUR_CONSUMER_KEY",
"user_id": "<auto-generated-uuid>"
}
Run:
python3 scripts/snaptrade_portal.py
This will:
user_secret is missinguser_secret back into the config fileRun:
python3 scripts/snaptrade_reconnect.py [brokerage-name]
This will:
Run:
python3 scripts/snaptrade_brokers.py
This calls /snaptrade/partners and returns the allowed_brokerages list (display names).
Run:
python3 scripts/snaptrade_total.py
Output is JSON like:
{"total_value": 123456.78, "currency": "CAD"}
Run:
python3 scripts/snaptrade_broker_totals.py --currency CAD
Output JSON includes per-broker totals in the chosen currency and the FX rates used.
Implementation notes: Avoid get_user_holdings when possible. Prefer get_user_account_positions (positions endpoint) for holdings/positions data. Only use balances/cash from holdings if explicitly required by the user; otherwise do not call holdings.
Use cron to call snaptrade_total.py, format a concise WhatsApp message, then send it to the user. Only the total value is required.
scripts/snaptrade_common.py — config load/save + client creationscripts/snaptrade_portal.py — register user + generate connection portal linkscripts/snaptrade_reconnect.py — generate reconnect link for disabled connectionsscripts/snaptrade_brokers.py — list allowed brokerages for this clientscripts/snaptrade_order.py — place buy/sell orders (market/limit) with optional monitoringscripts/snaptrade_watch_order.py — watch an existing order by ID for fillsscripts/snaptrade_total.py — compute total value across all accountsscripts/snaptrade_broker_totals.py — per-broker totals with FX conversionrequest_after_hook using consumer_key.account.balance.total from holdings; this avoids errors when accounts are added or removed.chmod 600 permissions.