Documentation Index
Fetch the complete documentation index at: https://mathematicalcompany.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Partially verified. As of v0.8.7+, Coinbase Advanced Trade now uses
the correct ES256 JWT bearer authentication with PEM-encoded EC P-256
keys (the format from cloud.coinbase.com/access/api). Pass the key ID as
api_key and the PEM private key as api_secret. The fixed /orders/historical/batch
endpoint is also corrected. Has not been tested against a live Coinbase
account, so verify behavior matches expectations before going live with
significant size.Quick Setup
Credentials
- Explicit
- Environment variables
Coinbase Configuration
| Field | Default | Description |
|---|---|---|
api_key | None | Coinbase API key (env: COINBASE_API_KEY) |
api_secret | None | Coinbase API secret (env: COINBASE_API_SECRET) |
api_url | https://api.coinbase.com/api/v3/brokerage | Override API base URL |
Authentication
Coinbase uses HMAC-SHA256 signature auth. Three headers are sent on every request:CB-ACCESS-KEY: {api_key}CB-ACCESS-SIGN: HMAC-SHA256(timestamp + method + path + body)CB-ACCESS-TIMESTAMP: {unix_timestamp}
Market Data Feed
Real-time crypto ticker via WebSocket:wss://advanced-trade-ws.coinbase.com and subscribes to the ticker channel with authenticated messages.
Each product gets its own snapshot entry keyed by {feed_name}:{PRODUCT_ID} (e.g., btc:BTC-USD), plus a feed-level entry with the latest update.
| Field | Type | Default | Description |
|---|---|---|---|
product_ids | list[str] | required | Trading pairs to subscribe (e.g., ["BTC-USD", "ETH-USD"]) |
api_key | str | None | Override API key (defaults to env vars) |
api_secret | str | None | Override API secret (defaults to env vars) |
Symbol Mapping
Coinbase uses product IDs inBASE-QUOTE format:
| Horizon Field | Coinbase Field | Notes |
|---|---|---|
OrderRequest.market_id | product_id | e.g., “BTC-USD”, “ETH-USD” |
OrderRequest.order_side | side | "BUY" or "SELL" |
OrderRequest.price | limit_price | Limit order price |
OrderRequest.size | base_size | Base currency amount |
Coinbase uses
Side.Long for all positions. Prediction market concepts like Side.Yes / Side.No do not apply to crypto orders.Multi-Exchange
Use Coinbase alongside prediction markets for crypto-correlated hedging:Getting API Keys
- Sign in at coinbase.com/advanced-trade
- Go to Settings > API
- Create a new API key with Trade permissions
- Save both the API key and secret securely