Coinbase Data Connector
Building for Coinbase users with USD or USDC spot pairs? The Coinbase connector talks to the public Advanced Trade API — history over REST, live prices over WebSocket. No API key required.
Use the controls above to change product id and timeframe. This is the same integration you will copy into your app.
Full-page version with sample code: Coinbase live demo.
What you get
| Feature | Details |
|---|---|
| No API key | Public Coinbase Advanced Trade market data |
| History | OHLCV via /market/products/{id}/candles (paginated, 350 per request) |
| Live ticks | WebSocket ticker_batch with heartbeats keep-alive |
| Pairs | BTC-USD, ETH-USDC, and other Coinbase product ids |
| Symbol helper | Accepts BTCUSD, BTC/USD, bare BTC → BTC-USD |
| Timeframes | 1m through 1d (no native 1w / 3m) |
Perfect for US-focused crypto apps and Coinbase-native trading surfaces. For Node.js multi-exchange backends, see CCXT.
Coinbase vs CCXT
| Coinbase connector | CCXT | |
|---|---|---|
| Runtime | Browser + Node | Node only |
| API key | No (public data) | No (public data) |
| Symbol format | BTC-USD | Exchange-specific via exchangeId |
| Best for | Frontend Coinbase charts | Many exchanges on your server |
Install
npm install @efixdata/exeria-chart @efixdata/connector-coinbase
Minimal example
import { createChart } from "@efixdata/exeria-chart";
import { CoinbaseAdapter } from "@efixdata/connector-coinbase";
const connector = new CoinbaseAdapter({ pageDelayMs: 300 });
const chart = createChart({
container,
dataAdapter: connector,
});
chart.init();
await chart.loadData("BTC-USD", {
interval: "1d",
limit: 500,
});
chart.subscribeToUpdates("BTC-USD", (tick) => {
console.log("Last price:", tick.price ?? tick.c);
});
Step by step
1 — Create the connector
const connector = new CoinbaseAdapter({ pageDelayMs: 300 });
Uses Coinbase public URLs by default. Optional tuning below.
2 — Attach to the chart
const chart = createChart({ container, dataAdapter: connector });
chart.init();
3 — Load history
await chart.loadData("ETH-USD", {
interval: "1h",
limit: 500,
});
4 — Subscribe to live updates
chart.subscribeToUpdates("ETH-USD", (tick) => {
console.log(tick.price ?? tick.c);
});
Call subscribeToUpdates after loadData succeeds.
Docs demo proxy
Coinbase REST does not allow browser cross-origin requests from localhost. The docs dev server exposes /api/coinbase/ohlcv and /api/coinbase/ticker through apiProxyPlugin.js so live demos work without CORS errors. In your own app, call CoinbaseAdapter from Node.js or route REST through your backend.
Configuration
const connector = new CoinbaseAdapter({
baseUrl: "https://api.coinbase.com",
wsUrl: "wss://advanced-trade-ws.coinbase.com",
requestTimeout: 10000,
maxRetries: 3,
retryDelay: 1000,
pageDelayMs: 300,
pollingIntervalMs: 5000,
useWebSocket: true,
});
Set useWebSocket: false to poll REST /ticker instead of WebSocket.
Supported symbols
| You pass | Coinbase product_id |
|---|---|
BTC-USD | BTC-USD |
BTCUSD | BTC-USD |
BTC | BTC-USD |
ETH-USDC | ETH-USDC |
Supported timeframes
1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 1d
Unsupported natively: 3m, 8h, 12h, 1w, 1M — the adapter throws a clear error.
Related
- Binance connector — global USDT spot
- Kraken connector — USD spot alternative
- CCXT connector — Coinbase via
exchangeId: "coinbase"on Node.js - Connect with a data connector — tutorial