使用 snaptrade-python-sdk 通过 SnapTrade API 执行交易并获取账户数据。当 OpenClaw 需要下单买入或卖出时调用此技能。
SnapTrade connects OpenClaw to the user's brokerage (IBKR, Questrade, Alpaca,
and more) through a unified API. This skill handles all account data retrieval
and order execution. For market price data and OHLCV bars, use the
massive-data-feed skill — SnapTrade does not provide chart data.
Run once before first use:
bash
bash scripts/setup.sh
source .venv-snaptrade/bin/activate
See README.md for full onboarding — how to get credentials, register a user,
and connect a brokerage account.
Always run this first before any other call:
python
import os
from snaptrade_client import SnapTrade
snaptrade = SnapTrade(
consumer_key=os.environ["SNAPTRADE_CONSUMER_KEY"],
client_id=os.environ["SNAPTRADE_CLIENT_ID"],
)
user_id = os.environ["SNAPTRADE_USER_ID"]
user_secret = os.environ["SNAPTRADE_USER_SECRET"]
Each reference file covers one domain. Read only what you need.
TaskReference fileGet accounts, balances, positions, orders, historical valuereferences/account-data.mdResolve a ticker to a symbol ID + get quotesreferences/symbol-resolution.mdPlace an equity trade (limit, market, bracket)references/place-orders.mdPlace an options order (single or multi-leg)references/options-trading.mdPlace a crypto orderreferences/crypto-trading.mdCancel an order or refresh holdingsreferences/cancel-refresh.mdGet historical transactions / activity logreferences/historical-data.md
trade_id from an impact check expires in 5 minutes — place the order immediately after getting it, don't do other work in betweenmassive-data-feed for thatreferences/cancel-refresh.md)