Aperçu
CCXT fournit une API unifiée pour 100+ bourses de cryptomonnaies (Binance, Coinbase, Kraken, Bybit, OKX, KuCoin, Gate.io). Données de marché, gestion des ordres, streaming websocket et détection d'arbitrage via une interface unique et cohérente pour tous les échanges supportés.
Installation
uv pip install ccxt
Données de marché
import ccxt
exchange = ccxt.binance()
ticker = exchange.fetch_ticker("BTC/USDT")
print(f"Symbol: {ticker['symbol']}, Bid: {ticker['bid']}, Ask: {ticker['ask']}")
ohlcv = exchange.fetch_ohlcv("ETH/USDT", "1h", limit=100)
for candle in ohlcv:
ts, o, h, l, c, v = candle
print(f"Time: {ts}, O: {o:.2f}, H: {h:.2f}, L: {l:.2f}, C: {c:.2f}")
Trading
balance = exchange.fetch_balance()
print(f"Free USDT: {balance['free']['USDT']}")
order = exchange.create_market_buy_order("ETH/USDT", 0.1)
print(f"Order filled: {order['status']}")