CCXT Library Setup Guide for Beginners
What Is CCXT?
CCXT (CryptoCurrency eXchange Trading Library) supports 100+ exchanges with a single unified API. Write your trading code once and connect to any exchange without rewriting your integration.
Install
pip install ccxt
Connect to Any Exchange
import ccxt
# Public data — no API key needed
exchange = ccxt.binance()
ticker = exchange.fetch_ticker("BTC/USDT")
print(ticker["last"]) # Current BTC price
# Private data — API key required
exchange = ccxt.binance({
"apiKey": "YOUR_KEY",
"secret": "YOUR_SECRET",
})
balance = exchange.fetch_balance()
print(balance["USDT"]["free"])
Place Orders
# Market buy
order = exchange.create_market_buy_order("BTC/USDT", 0.001)
# Limit sell at $100,000
order = exchange.create_limit_sell_order("BTC/USDT", 0.001, 100000)
Switch Exchanges Instantly
exchange = ccxt.bybit({"apiKey": "...", "secret": "..."})
exchange = ccxt.okx({"apiKey": "...", "secret": "..."})
exchange = ccxt.kucoin({"apiKey": "...", "secret": "..."})
Or Use CCXT MCP for Claude
claude mcp add ccxt -- npx @ccxt/mcp-server
Then just ask Claude: "Buy 0.001 BTC on Binance at market price."