Coinbase Advanced Trade Python SDK

1.8.2 · active · verified Wed Mar 25

Official Coinbase Advanced Trade API Python SDK. Current version: 1.8.2 (Mar 2026). TWO deprecated packages to avoid: 'coinbase' (old Coinbase Commerce SDK, EOL) and 'cbpro' (Coinbase Pro, discontinued). The correct package is 'coinbase-advanced-py'. Uses CDP (Coinbase Developer Platform) API keys with EC private key format — NOT the old HMAC API key format. Import is 'from coinbase.rest import RESTClient'.

Warnings

Install

Imports

Quickstart

Coinbase Advanced Trade Python SDK — accounts, product info, and market order.

# pip install coinbase-advanced-py
from coinbase.rest import RESTClient

# From CDP dashboard: Advanced Trade API key
client = RESTClient(key_file='cdp_api_key.json')

# Get accounts
accounts = client.get_accounts()
for acct in accounts['accounts']:
    print(acct['name'], acct['available_balance']['value'])

# Get BTC-USD product info
product = client.get_product(product_id='BTC-USD')
print(product['price'])

# Place market buy ($10 of BTC)
order = client.market_order_buy(
    client_order_id='',  # auto-generate
    product_id='BTC-USD',
    quote_size='10'
)
print(order['success'])

view raw JSON →