Trade from the terminal
Market and limit orders, portfolio management, and USDC/USD conversions from the command line.
AI-native
JSON output by default, an MCP server for agent tool-calling, and a bundled skill file for agent self-onboarding.
Preview before you execute
Every write operation supports
--dry-run and order preview. See fees, slippage, and estimated fill price before committing.Zero dependencies
A single ESM bundle on Node.js 22+. No runtime dependencies.
Get started
The fastest way to get started is to point your AI agent at the setup instructions. Copy this into Claude Code, Cursor, Codex, or any coding agent:The skill file is a machine-readable guide that teaches agents how to install, authenticate, and use the CLI. It covers every command and common workflows.
Manual install
If you prefer to set things up yourself:1. Install the CLI
Node.js 22 or later is required.
2. Create a CDP API key
- Go to API Keys in the CDP Portal (a project is auto-created on first sign-in)
- Click Create API Key and give it a name (e.g.,
my-trading-agent) - Under API restrictions, enable Trade and Transfer (View is enabled by default)
- Under Advanced settings, change the key type to ECDSA
- Click Create & Download and save the JSON key file
3. Configure and verify
4. Check a price and place a trade
client_order_id makes the order idempotent. If your connection drops and you retry with the same ID, the API returns the existing order instead of creating a duplicate. Always include one.Commands
Market data
Orders
Market order: executes immediately at the best available price.
Market buys use
quote_size (the amount to spend in USD). Market sells use base_size (the amount of the asset to sell). When switching between buy and sell, explicitly clear the other field (e.g., add quote_size= to clear a stale value).Portfolios and balances
Conversions
Info and session
Global flags
These flags work on any command:Field syntax
MCP server
The CLI includes an MCP server that exposes every command as a typed tool. When your agent needs to check prices, preview orders, or manage portfolios, it calls the corresponding tool. The CLI handles auth, request formatting, and JSON parsing. Claude Code:npx:
The MCP server runs on stdio (no network ports opened) and uses the same credentials configured with
coinbase env.