Skip to main content
Skip to main content

CCXT Data Connector

Need Kraken, KuCoin, or another exchange without writing a custom adapter? The CCXT connector wraps the popular CCXT library and implements the same DataAdapter contract as Binance and Bybit.

Loading chart…

Use the controls above to switch exchange, symbol, and timeframe. Binance, Bybit, and OKX use dedicated connectors in the demo; other exchanges route through a CCXT API proxy.

Standalone demo

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

Runtime

In production, run CCXT on Node.js (backend, scripts, Next.js API routes). This docs demo uses a local /api/ccxt proxy so the chart can stay in the browser without bundling CCXT.

What you get

FeatureDetails
100+ exchangesOne package, swap exchangeId
HistoryOHLCV via fetchOHLCV
Live ticksREST polling (fetchTicker) — not WebSocket in v1
SymbolsAccepts BTCUSDT, BTC-USDT, or BTC/USDT
API keysOptional — public market data works without keys on most exchanges

Perfect for multi-exchange backends, research tools, and rapid prototyping.

CCXT vs dedicated connectors

CCXTBinance / Bybit / OKX
Exchanges100+ via one packageOne exchange per package
RuntimeNode.js (recommended)Browser + Node.js
Live updatesPolling (1–3 s)Native WebSocket
Bundle sizeLarge (full CCXT)Small
Best forMany exchanges, backendsProduction single-exchange UI

If you only ship Binance, Coinbase, or Gate.io in the browser, use @efixdata/connector-binance, @efixdata/connector-coinbase, or @efixdata/connector-gate. If you need Kraken tomorrow and KuCoin next week on your server, use CCXT.

Install

npm install @efixdata/exeria-chart @efixdata/connector-ccxt

Minimal example (Node.js)

import { createChart } from "@efixdata/exeria-chart";
import { CcxtAdapter } from "@efixdata/connector-ccxt";

const connector = new CcxtAdapter({ exchangeId: "kraken" });

const chart = createChart({
container,
dataAdapter: connector,
});

chart.init();

await chart.loadData("BTCUSDT", {
interval: "1d",
limit: 500,
});

chart.subscribeToUpdates("BTCUSDT", (tick) => {
console.log("Last price:", tick.price ?? tick.c);
});

Step by step

1 — Pick an exchange

const connector = new CcxtAdapter({ exchangeId: "kraken" });

Verified in development: binance, bybit, okx, kraken, coinbase, kucoin, gate, bitfinex, mexc. Any id from the CCXT exchange list works if CCXT supports it.

2 — Attach to the chart

const chart = createChart({ container, dataAdapter: connector });
chart.init();

3 — Load history

await chart.loadData("BTCUSDT", {
interval: "1h",
limit: 500,
});
OptionMeaning
interval"1m", "1h", "1d", "1w", "1M"
limitRecent N candles
from / toOptional date range (exchange limits apply)

4 — Go live (polling)

chart.subscribeToUpdates("BTCUSDT");

Updates arrive via REST polling (default every 2 seconds). For WebSocket-grade latency, use a dedicated connector or CCXT Pro on your backend.

5 — Clean up

chart.unsubscribeFromUpdates();
await connector.disconnect();

Next.js API route (browser-safe pattern)

Keep CCXT on the server and expose thin endpoints to your React chart:

// app/api/ccxt/ohlcv/route.ts
import { CcxtAdapter } from "@efixdata/connector-ccxt";
import { NextResponse } from "next/server";

const connector = new CcxtAdapter({ exchangeId: "kraken" });

export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const symbol = searchParams.get("symbol") ?? "BTCUSDT";
const interval = searchParams.get("interval") ?? "1h";
const limit = Number(searchParams.get("limit") ?? "500");

await connector.initialize({});
const candles = await connector.getHistoricalData(symbol, { interval, limit });

return NextResponse.json({ candles });
}

Your frontend then calls /api/ccxt/ohlcv and uses setMainSeriesData — or wraps responses in a custom DataAdapter that proxies your API.

Configuration

const connector = new CcxtAdapter({
exchangeId: "binance",
apiKey: process.env.BINANCE_API_KEY,
secret: process.env.BINANCE_API_SECRET,
enableRateLimit: true,
pollIntervalMs: 3000,
sandbox: false,
onError: (error) => console.error("CCXT error:", error),
});
OptionDefaultMeaning
exchangeIdCCXT exchange id (required)
apiKey / secretOptional credentials
enableRateLimittrueRespect exchange rate limits
pollIntervalMs2000Live update polling interval
sandboxfalseUse exchange testnet when supported

Symbol formats

The adapter normalizes common formats:

InputResolved as
BTCUSDTBTC/USDT
BTC-USDTBTC/USDT
BTC/USDTBTC/USDT

After initialize(), the adapter calls loadMarkets() and prefers exchange metadata when available.

Switch exchange or symbol

async function switchExchange(exchangeId: string, symbol: string) {
chart.unsubscribeFromUpdates();
await connector.disconnect();

const next = new CcxtAdapter({ exchangeId });
chart.setDataAdapter(next);
await next.initialize({});

await chart.loadData(symbol, { interval: "1h", limit: 500 });
chart.subscribeToUpdates(symbol);
}

Limits to know

TopicLimit
Live updatesREST polling — not sub-second
BrowserCORS blocks most direct CCXT calls — use a backend proxy
Rate limitsExchange-specific; keep enableRateLimit: true
Bundle sizeFull CCXT is large — import only on the server

What is next?