Skip to main content
Skip to main content

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.

Loading chart…

Use the controls above to change product id and timeframe. This is the same integration you will copy into your app.

Standalone demo

Full-page version with sample code: Coinbase live demo.

What you get

FeatureDetails
No API keyPublic Coinbase Advanced Trade market data
HistoryOHLCV via /market/products/{id}/candles (paginated, 350 per request)
Live ticksWebSocket ticker_batch with heartbeats keep-alive
PairsBTC-USD, ETH-USDC, and other Coinbase product ids
Symbol helperAccepts BTCUSD, BTC/USD, bare BTCBTC-USD
Timeframes1m 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 connectorCCXT
RuntimeBrowser + NodeNode only
API keyNo (public data)No (public data)
Symbol formatBTC-USDExchange-specific via exchangeId
Best forFrontend Coinbase chartsMany 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 passCoinbase product_id
BTC-USDBTC-USD
BTCUSDBTC-USD
BTCBTC-USD
ETH-USDCETH-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.