Skip to main content

Library combining the power of CCXT with Pandas.

Project description

CCXT-Pandas

Python version GitHub PyPI version Downloads Binder Explore Data License Code style: black 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 17 runnable scripts covering market data, trading, analytics, and WebSocket streaming:

# Script Description Auth?
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 Stream live liquidation events No
11 Volatility History BTC volatility from Deribit No
13 Delta Position Net delta across spot + derivatives Yes
14 WS Orders Place/edit orders via WebSocket Yes
15 Open Interest Historical open interest + pct change No
16 1000 OHLCV Async Bulk OHLCV with asyncio.gather No
17 All Exchanges Async Load markets from every exchange 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())

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! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccxt_pandas-0.14.0.tar.gz (452.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccxt_pandas-0.14.0-py3-none-any.whl (118.3 kB view details)

Uploaded Python 3

File details

Details for the file ccxt_pandas-0.14.0.tar.gz.

File metadata

  • Download URL: ccxt_pandas-0.14.0.tar.gz
  • Upload date:
  • Size: 452.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ccxt_pandas-0.14.0.tar.gz
Algorithm Hash digest
SHA256 8c0aed709f9328a90cf916535cf3b75908ad05e57c9c06a293c3694c106b3a88
MD5 7f0bc0425ceb0fccf329d570d5f92aae
BLAKE2b-256 db3230c4bb88fa7815626939a4106954f296d6a1b303482329b682471db37a08

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccxt_pandas-0.14.0.tar.gz:

Publisher: publish.yml on sigma-quantiphi/ccxt-pandas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ccxt_pandas-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: ccxt_pandas-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 118.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ccxt_pandas-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96c93cc4a5d2817c46bc86cb3d2624eed62e43e61e044e867495541bb8e33f74
MD5 2bafebc29b75340e7329033d7c7ffdb2
BLAKE2b-256 0a5a37853082328e324d2120ed980bc01ac1f3b91b252f26f530d5237d632ab5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccxt_pandas-0.14.0-py3-none-any.whl:

Publisher: publish.yml on sigma-quantiphi/ccxt-pandas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page