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

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.15.0.tar.gz (601.0 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.15.0-py3-none-any.whl (187.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ccxt_pandas-0.15.0.tar.gz
Algorithm Hash digest
SHA256 1d5de4da37fc247a29d2a446e62e3f24866f47c657a1790e89b986c5175e2794
MD5 9fe27bcabbb9d34c89b7c7d4a4aa4a30
BLAKE2b-256 e814ecddd0c53b9e6188f91c2bcf3cc13eebf9c0160e52cb92d1bb1015d062d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccxt_pandas-0.15.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.15.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for ccxt_pandas-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bde68847d78acec6b797d041514271f8708687404677eedf0332d5853e6146da
MD5 41e437c31d8ba088d16adc510956df2a
BLAKE2b-256 2b86db96cb320e9174303a67b580410ead92c75885573b95dc60ff75e35caa07

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccxt_pandas-0.15.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