Skip to main content
Skip to main content

Data Connectors overview

A Data Connector is a bridge between a market data provider (Binance, Bybit, OKX, Kraken, KuCoin, Coinbase, Twelve Data, Finage, CCXT-backed exchanges, CoinGecko, your broker) and your Exeria chart. You install a package, pass it to createChart, and call loadData — the connector handles HTTP, WebSockets, and retries.

Loading chart…

Why bother with a connector?​

Without one you write:

  • REST calls to download history
  • WebSocket code for live prices
  • Parsing into { stamp, o, h, l, c, v }
  • Reconnect logic when the network drops

A connector bundles that into a few method calls. Switch from Binance to another source later by swapping the package — your chart code stays similar. For many exchanges on a backend, use the CCXT connector and change only exchangeId.

BenefitPlain meaning
ModularChart package stays small; install only the feed you need
SecureAPI keys live in your env vars, not in our library
ConsistentSame loadData / subscribeToUpdates for every provider

Dedicated vs universal (CCXT)​

Dedicated (adapter-binance, …)Universal (CCXT)
ExchangesOne per package100+ via exchangeId
RuntimeBrowser + Node.jsNode.js (recommended)
Live updatesNative WebSocketREST polling
BundleSmallLarge — keep on server

Use dedicated connectors for production browser charts on a single exchange. Use CCXT when you need many exchanges on a backend or want to prototype quickly without shipping a new adapter per exchange.

Forex and multi-asset (Twelve Data, Finage)​

Crypto connectorsTwelve DataFinage
Asset classCrypto spotForex, stocks, crypto, ETFsForex, stocks, crypto
API keyNot required (public)RequiredRequired
Symbol styleBTCUSDTEUR/USDEURUSD
Live transportWebSocketWebSocketWebSocket or REST polling
Best forCrypto terminalsQuick multi-asset demoFinage customers, UK vendor

Both forex vendors fit when you need FX alongside traditional assets. Run the adapter on your server and proxy requests to the chart — same pattern as CCXT.

Connector lifecycle​

Think of five steps every time:

StepWhat you do
1. Installnpm install @efixdata/connector-binance (or another connector)
2. Createnew BinanceAdapter() (or factory from that connector's docs)
3. WirecreateChart({ container, dataAdapter: connector }) then init()
4. Loadawait chart.loadData("BTCUSDT", { interval: "1h", limit: 1000 })
5. Streamchart.subscribeToUpdates("BTCUSDT", callback)

When the user leaves:

chart.unsubscribeFromUpdates();
await connector.disconnect();
sequenceDiagram
participant App
participant Chart
participant Connector
participant Provider

App->>Chart: loadData("BTCUSDT")
Chart->>Connector: getHistoricalData
Connector->>Provider: REST API
Provider-->>Connector: candles
Connector-->>Chart: Candle[]
App->>Chart: subscribeToUpdates
Connector->>Provider: WebSocket
Provider-->>Connector: ticks
Connector-->>Chart: appendTick

Quick start (Binance)​

npm install @efixdata/exeria-chart @efixdata/connector-binance
import { createChart } from "@efixdata/exeria-chart";
import { BinanceAdapter } from "@efixdata/connector-binance";

const connector = new BinanceAdapter();

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

chart.init();

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

chart.subscribeToUpdates("BTCUSDT", (tick) => {
console.log(tick.price ?? tick.c, new Date(tick.stamp));
});

Optional date range instead of “latest N bars”:

await chart.loadData("BTCUSDT", {
interval: "1d",
from: new Date("2024-01-01"),
to: new Date("2024-12-31"),
});

Full loadData options: Loading data.

Switch symbol or timeframe​

Always unsubscribe before loading a new symbol:

chart.unsubscribeFromUpdates();

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

chart.subscribeToUpdates("ETHUSDT");

Same chart instance, new feed — no remount required.

Handle errors​

Wrap loadData in try/catch and show something friendly in your UI:

try {
await chart.loadData("BTCUSDT", { interval: "1h", limit: 1000 });
} catch (error) {
console.error("Could not load market data:", error);
// show retry button, fallback message, etc.
}

The chart does not emit connector-specific error events today — your app owns user feedback.

Build your own connector​

Proprietary feed? Implement the DataAdapter interface from @efixdata/exeria-chart:

import type { Candle, DataAdapter, LoadDataOptions, Tick } from "@efixdata/exeria-chart";

class MyConnector implements DataAdapter {
async initialize(_config: Record<string, unknown>): Promise<void> {}

async getHistoricalData(symbol: string, options: LoadDataOptions): Promise<Candle[]> {
// fetch from your API, return { stamp, o, h, l, c, v }[]
return [];
}

async getCurrentPrice(symbol: string): Promise<Tick> {
return { stamp: Date.now(), price: 0 };
}

subscribeToUpdates(symbol: string, callback: (update: Tick) => void): () => void {
// open WebSocket, call callback on each tick
return () => {}; // unsubscribe function
}

async disconnect(): Promise<void> {}
}

Pass it the same way: createChart({ dataAdapter: new MyConnector() }).

Method-by-method reference: API Reference.

Best practices (short list)​

API keys

  • Store in environment variables, never in source control
  • Use separate keys for dev and production

Performance

  • Use limit to avoid downloading more history than you need
  • unsubscribeFromUpdates() when the chart is hidden
  • disconnect() on page unload

Security

  • Never log API keys
  • Validate symbol strings from user input before passing to connectors

Troubleshooting​

No candles on screen​

  1. Is the symbol valid on that exchange? (BTCUSDT not BTC-USD)
  2. Is the interval supported? (see connector docs)
  3. Did you call init() before loadData?
  4. Log the error from try/catch around loadData

Live price frozen​

  1. Did you call subscribeToUpdates after loadData?
  2. Check WebSocket in browser DevTools → Network
  3. Firewall or corporate proxy blocking WSS?

Rate limits​

  1. Use limit instead of huge date ranges
  2. Cache history in your backend for popular symbols
  3. Upgrade API tier if the provider offers one

What is next?​

  • Binance — crypto today, no API key
  • Bybit — crypto today, no API key
  • OKX — crypto today, no API key
  • Kraken — USD spot, no API key
  • KuCoin — USDT spot, no API key
  • Coinbase — USD / USDC spot, no API key
  • Gate.io — USDT spot, no API key
  • CCXT — 100+ exchanges via one package (Node.js)
  • Twelve Data — forex and multi-asset OHLCV (API key)
  • Finage — forex OHLCV via Finage (API key)
  • Finnhub — US stocks, forex, and crypto via Finnhub (API token)
  • EODHD — global EOD + intraday via EODHD (API token)
  • CoinGecko — wide asset coverage via coin ids
  • Massive — US stocks, forex, and crypto (API key)
  • Data Connectors catalog — compare providers and licenses