ccxt-pandas¶
CCXT-Pandas¶
🚀 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 |
OHLCV, order books, trades, funding rates, batch orders |
Yes |
|
01 |
BTC spread and volume across contract types |
No |
|
02 |
Cross-exchange spread detection |
No |
|
03 |
Trades, positions, greeks |
Yes |
|
04 |
OHLCV candlestick + trade scatter charts |
No |
|
05 |
Cumulative depth chart |
No |
|
06 |
VWAP at multiple notional depths |
No |
|
07 |
LIMIT_MAKER and QUEUE orders |
Yes |
|
08 |
Convert to USDT-equivalent prices |
No |
|
09 |
Fetch deposit/withdrawal history |
Yes |
|
10 |
WS Liquidations ( |
Stream live liquidation events |
No |
11 |
BTC volatility from Deribit |
No |
|
12 |
Pick BTC call legs around an event date |
No |
|
13 |
Net delta across spot + derivatives |
Yes |
|
14 |
WS Orders ( |
Place/edit orders via WebSocket |
Yes |
15 |
Historical open interest + pct change |
No |
|
16 |
1000 OHLCV Async ( |
Bulk OHLCV with |
No |
17 |
All Exchanges Async ( |
Load markets from every exchange |
No |
18 |
Cheapest cross-exchange transfer rail per currency |
Yes |
|
19 |
Aggregate option Greeks across binance/bybit/okx |
No |
|
20 |
|
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 |
|
Market Data |
|
Account |
|
Trading |
|
Analytics |
|
Safety¶
Read-only by default — trading tools require explicit
read_only: falseSandbox 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.
Fork the repository.
Create your feature/fix branch:
git checkout -b my-new-feature.Commit your changes:
git commit -am 'Add some feature'.Push to the branch:
git push origin my-new-feature.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! 🚀