Single Blog

Effortless Crypto Data in Pandas: Introducing Crypto-Pandas

Effortless Crypto Data in Pandas: Introducing crypto-pandas

Working with crypto exchange data can be messy. APIs return raw JSON, data structures vary between exchanges, and transforming everything into Pandas DataFrames becomes a repetitive chore. That’s why we built Crypto-Pandas — a Python library that makes querying crypto data from exchanges as easy as writing:

df = exchange.fetch_ohlcv(“BTC/USDT”)

Built on Pandas + CCXT

Crypto-Pandas combines the best of two worlds:

  • Pandas — the go-to Python library for data analysis
  • CCXT — the most widely used crypto exchange connector in the world.
By wrapping CCXT under the hood and returning everything as well-formatted Pandas DataFrames, Crypto-Pandas gives you an elegant, consistent, and production-ready interface to fetch market data — across dozens of exchanges.

Quick Start

Install Crypto-Pandas using pip:

pip install crypto-pandas

Let’s begin with a simple setup for Binance

from crypto_pandas import CCXTPandasExchange
import ccxt

exchange = CCXTPandasExchange(exchange=ccxt.binance())

Load Markets as DataFrame

Before querying any data, it’s a good idea to load and inspect the available markets:

markets = exchange.load_cached_markets()
print(markets.head())

This returns a clean Pandas DataFrame of available symbols, filters, and precision settings.
| id | lowercaseId | symbol | base | quote | settle | |————–|—————–|————————|——|——-|——–| | LTCUSD_250926| ltcusd_250926 | LTC/USD:LTC-250926 | LTC | USD | LTC | | BNBUSD_250926| bnbusd_250926 | BNB/USD:BNB-250926 | BNB | USD | BNB | | SOLUSD_251226| solusd_251226 | SOL/USD:SOL-251226 | SOL | USD | SOL | | XRPUSD_251226| xrpusd_251226 | XRP/USD:XRP-251226 | XRP | USD | XRP | | BNBUSD_251226| bnbusd_251226 | BNB/USD:BNB-251226 | BNB | USD | BNB |

Fetch OHLCV Data

Fetching historical candles becomes one line of code:

ohlcv = exchange.fetch_ohlcv(“BTC/USDT”, timeframe=”1h”, limit=100)
print(ohlcv.tail())

Output:

| timestamp | open | high | low | close | volume | symbol |
|:————————–|——-:|——-:|——-:|——–:|——–:|:————–|
| 2025-06-19 12:34:00+00:00 | 642.03 | 642.05 | 641.89 | 641.89 | 58.79 | BNB/USDT:USDT |
| 2025-06-19 12:35:00+00:00 | 641.89 | 642.14 | 641.88 | 642.14 | 49.52 | BNB/USDT:USDT |
| 2025-06-19 12:36:00+00:00 | 642.08 | 642.31 | 642.08 | 642.26 | 3.71 | BNB/USDT:USDT |
| 2025-06-19 12:37:00+00:00 | 642.27 | 642.28 | 641.55 | 642.07 | 101.05 | BNB/USDT:USDT |
| 2025-06-19 12:38:00+00:00 | 642.07 | 642.11 | 641.97 | 642.11 | 1.14 | BNB/USDT:USDT |
The timestamp column is already parsed to UTC-aware pd.Timestamp objects.

Fetch Trades

Want to see public trades happening on a symbol?

trades = exchange.fetch_trades(“BTC/USDT”)
print(trades.head())

Sample output:
| timestamp | datetime | symbol | id | order | type | side | takerOrMaker | price | amount | cost | fees | fee_cost | fee_currency | |:———————————|:———————————|:————–|———:|:——–|:——-|:—–|:————-|——–:|——-:|——–:|:—–|:———|:————–| | 2025-06-19 10:26:21.333000+00:00 | 2025-06-19 10:26:21.333000+00:00 | BNB/USDT:USDT | 45397270 | | | buy | | 645.16 | 10.15 | 6548.37 | [] | | | | 2025-06-19 10:26:21.333000+00:00 | 2025-06-19 10:26:21.333000+00:00 | BNB/USDT:USDT | 45397271 | | | buy | | 645.18 | 3.71 | 2393.62 | [] | | | | 2025-06-19 10:26:21.354000+00:00 | 2025-06-19 10:26:21.354000+00:00 | BNB/USDT:USDT | 45397272 | | | buy | | 645.20 | 1.71 | 1103.29 | [] | | | | 2025-06-19 10:26:21.354000+00:00 | 2025-06-19 10:26:21.354000+00:00 | BNB/USDT:USDT | 45397273 | | | buy | | 645.21 | 3.70 | 2387.28 | [] | | | | 2025-06-19 10:26:21.358000+00:00 | 2025-06-19 10:26:21.358000+00:00 | BNB/USDT:USDT | 45397274 | | | buy | | 645.218 | 0.01 | 6.45 | [] | | |

Fetch Order Book

Need to look at the bid/ask stack?

order_book = exchange.fetch_order_book(“BTC/USDT”)
print(order_book.head(5))

The output merges bids and asks in a single, multi-indexed DataFrame:
| price | qty | symbol | timestamp | datetime | nonce | side | |——–|——-|—————|———————————-|———————————-|————-|——| | 10 | 694.5 | BNB/USDT:USDT | 2025-06-19 12:38:47.051000+00:00 | 2025-06-19 12:38:47.051000+00:00 | 53658892204 | bids | | 8.2 | 2 | BNB/USDT:USDT | 2025-06-19 12:38:47.051000+00:00 | 2025-06-19 12:38:47.051000+00:00 | 53658892204 | bids | | 8.1 | 4 | BNB/USDT:USDT | 2025-06-19 12:38:47.051000+00:00 | 2025-06-19 12:38:47.051000+00:00 | 53658892204 | bids | | 8 | 22.69 | BNB/USDT:USDT | 2025-06-19 12:38:47.051000+00:00 | 2025-06-19 12:38:47.051000+00:00 | 53658892204 | bids | | 7 | 14.28 | BNB/USDT:USDT | 2025-06-19 12:38:47.051000+00:00 | 2025-06-19 12:38:47.051000+00:00 | 53658892204 | bids |
Perfect for building depth charts or liquidity heatmaps.

Fetch Bids & Asks (Snapshot)

Want a quick snapshot of top-of-book data across multiple symbols?

quotes = exchange.fetch_bids_asks()
print(quotes)

Output:

| symbol | timestamp | datetime | high | low | bid | bidVolume | ask | askVolume | vwap | open | close | last | previousClose | change | percentage | average | baseVolume | quoteVolume | markPrice | indexPrice | |————-|————-|————|——–|——-|———|———–|———|———–|——|——|——-|——|—————-|——–|————|———|————|————-|———–|————| | SOPH/USDC | NaT | NaT | | | 0.03949 | 213092 | 0.03952 | 196736 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | | SOPH/BNB | NaT | NaT | | | 6.16e-05| 260390 | 6.161e-05| 302062 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | | SOPH/FDUSD | NaT | NaT | | | 0.03957 | 192318 | 0.03965 | 225852 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | | SOPH/TRY | NaT | NaT | | | 1.563 | 10781 | 1.564 | 10058 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | | MUBARAK/TRY | NaT | NaT | | | 1.337 | 12445.8 | 1.34 | 12126.9 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan |
Fast, clean, and easy to use for building spread or arbitrage logic.

Why Use Crypto-Pandas?


✅ Combines the reliability of CCXT and the flexibility of Pandas
✅ Clean DataFrame outputs for every method in 1 line of code
✅ Timestamps are in pd.Timestamp UTC format
✅ Schema consistency across different exchanges
✅ No more JSON wrangling or timestamp parsing

Whether you’re building research notebooks, dashboards, or backtests, Crypto-Pandas helps you focus on logic, not plumbing.
Try It Yourself

💻 GitHub: https://github.com/sigma-quantiphi/crypto-pandas
🧪 Run in Binder: Launch notebook
🌐 More tools: https://sigmaquantiphi.com/