ccxt-pandas¶

CCXT-Pandas¶

Python version GitHub PyPI version Downloads Binder Explore Data License Ruff CI Docs Medium badge

🚀 CCXT → Pandas DataFrames in One Line¶

No more JSON → DataFrame glue code. Every CCXT method returns a clean, typed pandas DataFrame.

import ccxt
from ccxt_pandas import CCXTPandasExchange

exchange = CCXTPandasExchange(exchange=ccxt.binance())
ohlcv = exchange.fetch_ohlcv("BTC/USDT", timeframe="1m", limit=1000)
plt = ohlcv.close.plot(title="BTC/USDT — 1m")
plt.show()

Why CCXT-Pandas?¶

CCXT-Pandas fuses the power of Pandas with the market-connectivity of CCXT. It turns CCXT’s nested JSONs into clean, typed DataFrames for analysis, backtests, or dashboards. It lets you place/cancel live orders using the same DataFrame-centric API.

1-liners, everywhere. Fetch OHLCV, tickers, trades, order books, balances, orders → all as DataFrames.

  • Consistent columns & dtypes. Timestamps as UTC datetime64[ns, UTC], numeric columns as proper numerics.

  • Zero boilerplate. Stop writing JSON-to-DataFrame glue for every exchange.

  • CCXT-compatible. Keep your favorite CCXT params; just get DataFrames back.

Installation¶

CCXT-Pandas can be installed on Python 3.11~3.14:

pip install ccxt-pandas

Examples¶

See the examples/ directory for 20 runnable examples covering market data, trading, analytics, and WebSocket streaming. Most ship as paired .py + .ipynb files (open the notebook in Binder for inline plots); the 4 async / WebSocket examples (10, 14, 16, 17) are .py-only because Jupyter’s running event loop breaks asyncio.run().

#

Notebook

Description

Auth?

00

Sync basics

OHLCV, order books, trades, funding rates, batch orders

Yes

01

Spot/Future/Swap Analysis

BTC spread and volume across contract types

No

02

Exchange Arbitrage

Cross-exchange spread detection

No

03

Fetch Private Data

Trades, positions, greeks

Yes

04

Plot Trades

OHLCV candlestick + trade scatter charts

No

05

Orderbook Depth

Cumulative depth chart

No

06

Orderbook VWAPs

VWAP at multiple notional depths

No

07

Market Making

LIMIT_MAKER and QUEUE orders

Yes

08

Coin-Quoted Pricing

Convert to USDT-equivalent prices

No

09

Deposits/Withdrawals

Fetch deposit/withdrawal history

Yes

10

WS Liquidations (.py)

Stream live liquidation events

No

11

Volatility History

BTC volatility from Deribit

No

12

Options Calendar Spread

Pick BTC call legs around an event date

No

13

Delta Position

Net delta across spot + derivatives

Yes

14

WS Orders (.py)

Place/edit orders via WebSocket

Yes

15

Open Interest

Historical open interest + pct change

No

16

1000 OHLCV Async (.py)

Bulk OHLCV with asyncio.gather

No

17

All Exchanges Async (.py)

Load markets from every exchange

No

18

Cheapest Withdrawal Route

Cheapest cross-exchange transfer rail per currency

Yes

19

Multi-Exchange Greeks

Aggregate option Greeks across binance/bybit/okx

No

20

Trade Caching

cache=True for incremental fetch_trades

No

Getting Started¶

CCXT-Pandas works identically to CCXT. Just add exchange = CCXTPandasExchange(exchange=exchange) and the exchange methods provided by CCXT will be exposed to CCXT-Pandas.

Sync¶

import ccxt
from ccxt_pandas import CCXTPandasExchange

# Initialize a CCXTPandasExchange object
exchange = ccxt.binance(dict(apiKey="your_api_key_here", secret="your_secret_here"))
exchange = CCXTPandasExchange(exchange=exchange)

# OHLCV
ohlcv = exchange.fetch_ohlcv("BTC/USDT", timeframe="1m", limit=100)      # -> DataFrame
# Trades
trades = exchange.fetch_trades("BTC/USDT", limit=1000)                   # -> DataFrame
# Orderbook
ob = exchange.fetch_order_book("BTC/USDT", limit=50)                 # -> DataFrame
# Tickers
tick = exchange.fetch_tickers()                               # -> DataFrame

# Fetch open orders from an exchange
open_orders = exchange.fetch_open_orders(symbol="BTC/USDT")

# Halve the amount and edit orders
open_orders["amount"] /= 2
response = exchange.edit_orders(open_orders)

# Display the transformed orders dataframe
print(response)

Async¶

import asyncio
import ccxt.pro as ccxtpro
from ccxt_pandas import AsyncCCXTPandasExchange

ex = AsyncCCXTPandasExchange(ccxtpro.okx())

async def main():
    while True:
        trades = await ex.watch_trades("BTC/USDT")
        print(trades)

if __name__ == "__main__":
    asyncio.run(main())

Explorer Dashboard¶

CCXT-Pandas ships an optional Streamlit dashboard for browsing any CCXT exchange method, copying the equivalent code snippet, and plotting the resulting DataFrame. The hosted version lives at ccxt-explorer.com.

Installation¶

pip install ccxt-pandas[explorer]

Running¶

# Via CLI
ccxt-pandas-explorer

# Via uv
uv run ccxt-pandas-explorer

MCP Server¶

CCXT-Pandas includes an optional MCP (Model Context Protocol) server that exposes exchange data and trading as tools for AI assistants like Claude.

Installation¶

pip install ccxt-pandas[mcp]

Configuration¶

Create a config file (e.g. ccxt-mcp-config.json):

{
  "accounts": {
    "binance": {
      "exchange": "binance",
      "api_key": "your_api_key",
      "secret": "your_secret",
      "sandbox_mode": true
    }
  },
  "read_only": true
}

Or use environment variables:

export CCXT_MCP_ACCOUNT_BINANCE_EXCHANGE=binance
export CCXT_MCP_ACCOUNT_BINANCE_API_KEY=your_key
export CCXT_MCP_ACCOUNT_BINANCE_SECRET=your_secret
export CCXT_MCP_READ_ONLY=true

Running¶

# Via CLI
ccxt-pandas-mcp

# Via uv
uv run ccxt-pandas-mcp

Claude Desktop / Claude Code¶

Add to your MCP client config:

{
  "mcpServers": {
    "ccxt-pandas": {
      "command": "uv",
      "args": ["run", "ccxt-pandas-mcp"],
      "env": {
        "CCXT_MCP_CONFIG": "/path/to/ccxt-mcp-config.json"
      }
    }
  }
}

Available Tools¶

Category

Tools

Exchange Info

list_exchanges, load_markets, fetch_currencies

Market Data

fetch_ohlcv, fetch_trades, fetch_order_book, fetch_ticker, fetch_tickers, fetch_funding_rates

Account

fetch_balance, fetch_positions, fetch_open_orders, fetch_closed_orders, fetch_my_trades

Trading

create_order, create_orders, cancel_order, cancel_all_orders

Analytics

get_delta_exposure, get_orderbook_analytics

Safety¶

  • Read-only by default — trading tools require explicit read_only: false

  • Sandbox by default — prevents accidental mainnet trades

  • Symbol whitelist/blacklist — restrict tradeable pairs via config

  • Cost caps — inherited from ccxt-pandas order validation

Claude Code Integration¶

CCXT-Pandas includes a Claude Code skill to accelerate your development workflow!

The skill provides:

  • Quick reference for sync/async usage patterns

  • Common DataFrame structures for all methods

  • Batch operation examples and best practices

  • Troubleshooting tips and testing setup

Using the Skill¶

In this repository: The skill is automatically available. Invoke with /ccxt-pandas-helper

In your projects: Copy to your global skills directory:

# Windows
cp .claude/skills/ccxt-pandas-helper.md %USERPROFILE%\.claude\skills\

# macOS/Linux
cp .claude/skills/ccxt-pandas-helper.md ~/.claude/skills/

After copying, use /ccxt-pandas-helper in any project for instant access to ccxt-pandas patterns and documentation.

See .claude/skills/README.md for more details.

About Sigma Quantiphi¶

Sigma Quantiphi is a quantitative-engineering firm that builds end-to-end algorithmic-trading systems for the cryptocurrency markets. We create open-source, Python-first tools—like ccxt-pandas—and deliver turnkey execution, data, and research pipelines that emphasize simplicity, transparency, and rapid deployment.

License¶

This project is licensed under the Apache License. See the LICENSE file for more details.

Contributing¶

Contributions are welcome! If you’d like to contribute, please fork the repository, create a new branch for your feature or fix, and send a pull request.

  1. Fork the repository.

  2. Create your feature/fix branch: git checkout -b my-new-feature.

  3. Commit your changes: git commit -am 'Add some feature'.

  4. Push to the branch: git push origin my-new-feature.

  5. Submit a pull request.

Support¶

If you encounter any issues or have questions, feel free to open an issue on the GitHub repository or contact us via email at contact@sqphi.com. Happy trading! 🚀

Indices and tables¶