ccxt · git:20261115.bcd7c5c · 2026-11-15 · sha256 526f67f9c1b5883c

ccxt git:20261115.bcd7c5cA

Immutable. This exact content never changes and is served at /api/v1/blob/526f67f9c1b5883c.

No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_qqqojzuvl7gol5jw/526f67f9c1b5883c4a4d02855a6845e121d141ac6b06165e846920c2d33fb6d1.json

Then /plugin install ccxt@markdownregistry-qqqojzuvl7gol5jw in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.

---
name: ccxt
category: data-source
description: CCXT unified crypto exchange library (100+ exchanges). Free public market data. Fallback when OKX is unavailable.
---

## Overview

CCXT is a unified cryptocurrency exchange trading library supporting 100+ exchanges including Binance, Bybit, OKX, Coinbase, Kraken, and more. Public market data (OHLCV, tickers, order books) requires no API key.

- GitHub: https://github.com/ccxt/ccxt (35k+ stars)
- Install: `pip install ccxt`

## Quick Start

```python
import ccxt
from src.data_gateway.reads import managed_reader
from src.data_gateway import get_gateway

@managed_reader
def fetch_crypto_snapshot():
    exchange = ccxt.binance({
        "enableRateLimit": True,
        "timeout": int(get_gateway().config.source_timeout * 1000),
    })
    try:
        return {
            "bars": exchange.fetch_ohlcv("BTC/USDT", "1d", limit=100),
            "ticker": exchange.fetch_ticker("ETH/USDT"),
        }
    finally:
        close = getattr(exchange, "close", None)
        if callable(close):
            close()

snapshot = fetch_crypto_snapshot()
print(snapshot["ticker"]["last"])
```

## Key Methods

| Method | Description | Returns |
|--------|-------------|---------|
| `fetch_ohlcv(symbol, timeframe, since, limit)` | Historical candles | `[[ts, o, h, l, c, v], ...]` |
| `fetch_ticker(symbol)` | Latest quote | `{last, bid, ask, volume, ...}` |
| `fetch_tickers(symbols)` | Batch quotes | `{symbol: ticker}` |
| `fetch_order_book(symbol, limit)` | Order book | `{bids, asks, timestamp}` |
| `fetch_trades(symbol, since, limit)` | Recent trades | `[{price, amount, side, timestamp}, ...]` |

## Timeframes

`1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `12h`, `1d`, `1w`, `1M`

Note: not all exchanges support all timeframes. Use `exchange.timeframes` to check.

## Symbol Format

CCXT uses slash format: `BTC/USDT`, `ETH/BTC`, `SOL/USDT`

The project's DataLoader automatically converts `BTC-USDT` (hyphen) to `BTC/USDT` (slash).

## Exchange Selection

Set via environment variable: `CCXT_EXCHANGE=binance` (default)

Popular exchanges: `binance`, `bybit`, `okx`, `coinbase`, `kraken`, `bitget`, `gate`

## Built-in Loader

The project has a built-in CCXT DataLoader at `backtest/loaders/ccxt_loader.py`. It serves as a fallback when the OKX loader is unavailable.

## Pagination

For long history, CCXT paginates via the `since` parameter (millisecond timestamp). The built-in loader handles this automatically (up to 200 pages).