Manual for CCXT Library

·

Overview

The CCXT library is a collection of available crypto exchanges or exchange classes. Each class implements the public and private API for a particular crypto exchange. All exchanges are derived from the base Exchange class and share a set of common methods.

The library structure consists of:

Full public and private HTTP REST APIs for all exchanges are implemented. WebSocket implementations are available in CCXT Pro.

Key Features

Exchanges

Supported Exchange Markets

The CCXT library currently supports the following cryptocurrency exchanges:

Exchange IDExchange Name
binanceBinance
coinbaseCoinbase
krakenKraken
bitfinexBitfinex
huobiHuobi
okxOKX
kucoinKuCoin

View full list of supported exchanges

Instantiation

To connect to an exchange:

const ccxt = require('ccxt');
const exchange = new ccxt.binance();

Rate Limit

All exchanges enforce rate limits. The CCXT library includes a built-in rate limiter enabled by default:

exchange.enableRateLimit = true; // Enable rate limiting

Markets

Markets represent trading pairs. Each market has:

const markets = await exchange.loadMarkets();
console.log(markets['BTC/USD']);

Unified API

The CCXT library provides a consistent interface across all exchanges:

// Fetch order book
const orderbook = await exchange.fetchOrderBook('BTC/USDT');

// Fetch ticker
const ticker = await exchange.fetchTicker('ETH/BTC');

// Create order
await exchange.createLimitBuyOrder('BTC/USDT', 1, 50000);

FAQ

How do I handle pagination?

Use the since and limit parameters:

const trades = await exchange.fetchTrades('BTC/USDT', since, 100);

What if my API call fails?

CCXT throws specific exceptions:

How do I get historical data?

const ohlcv = await exchange.fetchOHLCV('BTC/USDT', '1d', since, limit);

👉 Learn more about CCXT Pro features

👉 Advanced trading examples