Library combining the power of CCXT with Pandas.
Project description
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 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.
- 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! 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c0aed709f9328a90cf916535cf3b75908ad05e57c9c06a293c3694c106b3a88
|
|
| MD5 |
7f0bc0425ceb0fccf329d570d5f92aae
|
|
| BLAKE2b-256 |
db3230c4bb88fa7815626939a4106954f296d6a1b303482329b682471db37a08
|
Provenance
The following attestation bundles were made for ccxt_pandas-0.14.0.tar.gz:
Publisher:
publish.yml on sigma-quantiphi/ccxt-pandas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ccxt_pandas-0.14.0.tar.gz -
Subject digest:
8c0aed709f9328a90cf916535cf3b75908ad05e57c9c06a293c3694c106b3a88 - Sigstore transparency entry: 1205553124
- Sigstore integration time:
-
Permalink:
sigma-quantiphi/ccxt-pandas@f7d6d6f44e1cfe293dc3a788c1f4df1e14fc53c8 -
Branch / Tag:
refs/tags/v0.14.0 - Owner: https://github.com/sigma-quantiphi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f7d6d6f44e1cfe293dc3a788c1f4df1e14fc53c8 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96c93cc4a5d2817c46bc86cb3d2624eed62e43e61e044e867495541bb8e33f74
|
|
| MD5 |
2bafebc29b75340e7329033d7c7ffdb2
|
|
| BLAKE2b-256 |
0a5a37853082328e324d2120ed980bc01ac1f3b91b252f26f530d5237d632ab5
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ccxt_pandas-0.14.0-py3-none-any.whl -
Subject digest:
96c93cc4a5d2817c46bc86cb3d2624eed62e43e61e044e867495541bb8e33f74 - Sigstore transparency entry: 1205553127
- Sigstore integration time:
-
Permalink:
sigma-quantiphi/ccxt-pandas@f7d6d6f44e1cfe293dc3a788c1f4df1e14fc53c8 -
Branch / Tag:
refs/tags/v0.14.0 - Owner: https://github.com/sigma-quantiphi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f7d6d6f44e1cfe293dc3a788c1f4df1e14fc53c8 -
Trigger Event:
release
-
Statement type: