CCXT

CCXT vs the BloFin API and official SDK

BloFin's official SDK is Python-only and installs from source. Compared with CCXT on languages, streaming, demo trading, rate limits and raw endpoints.

BloFin is a perpetual-futures venue with a documented REST and WebSocket API at docs.blofin.com and a demo-trading environment at demo-trading-openapi.blofin.com. It publishes one first-party client library: blofin-sdk-python, Apache-2.0, covering REST and WebSockets including BloFin's copy-trading and affiliate APIs.

Two things narrow the choice. That SDK exists in Python only — BloFin's other public repositories are a UI library, a CLI, an MCP server and a skills hub, not SDKs. And it is installed from source (pip install -e .), not from a package index; the blofin name on PyPI belongs to a separate community project.

So the deciding question is: is Python the only language you need, and is copy trading part of what you are building?

TL;DR

  • Pick blofin-sdk-python if you are on Python and you need BloFin's copy-trading or affiliate APIs as typed methods, and you do not mind vendoring the repository.
  • Pick CCXT for anything else: 54 unified capabilities, 26 of them fetch*, 13 watch* streaming methods and all 79 BloFin endpoints — copy trading and affiliate routes included — as implicit methods, in TypeScript, JavaScript, Python, PHP, C#/.NET, Go and Java.
  • Demo trading works in both. BloFin's SDK gives you a DemoClient; CCXT gives you set_sandbox_mode(True), which swaps the REST and both WebSocket URLs in one call.

At a glance

CCXTblofin-sdk-python (official)
Exchanges covered104 (BloFin is one of them)BloFin only
LanguagesTypeScript, JavaScript, Python, PHP, C#/.NET, Go, Java — one APIPython
Installpip install ccxt and equivalentspip install -e . from a clone
Unified market data + trading APIyes — same method names across every exchangeno — BloFin's own request/response shapes
BloFin capabilities implemented54 unified methods, 26 of them fetch*REST plus WebSocket across trading, market, copytrading, affiliate
Raw endpoint accessyes — 79 BloFin endpoints as implicit methodsyes, it is the whole product
WebSocketsyes — 13 watch* methods, same shapes as fetch*yes — public, private and copytrading clients
Copy tradingvia implicit methods (copytrading/* routes)first-class CopyTradingAPI
Built-in rate limiteryes, on by default (rateLimit 100 ms)not provided
Unified error typesyes — 41 typed exceptions in one hierarchyBloFin error codes
Demo tradingset_sandbox_mode(True) swaps REST and WebSocket URLsDemoClient, or isDemo=True
Latest repository update readcontinuous30 January 2025
Popularity43.8k GitHub stars · 4.8M PyPI + 494k npm installs/month (one package, every venue)4 GitHub stars; the community blofin PyPI package — a separate project — has about 1k installs/month
LicenceMITApache-2.0
SupportDiscord, Telegram, GitHub issues — usually same-dayGitHub issues

Figures verified September 2026 against CCXT v4.5.77, the blofin GitHub organisation's repository listing, the blofin-sdk-python README and examples, BloFin's published API documentation, and install counts from PyPI.

The same job, written both ways

Fetch a ticker

import ccxt

exchange = ccxt.blofin()
ticker = exchange.fetch_ticker('BTC/USDT:USDT')
print(ticker['last'], ticker['baseVolume'])

BloFin instruments are BTC-USDT; CCXT normalises the linear perpetual to 'BTC/USDT:USDT' — the unified notation that says "BTC against USDT, settled in USDT" and reads identically on Bybit, OKX or Hyperliquid. The CCXT call returns a unified ticker structure; the SDK returns BloFin's payload for you to parse.

Place a limit order

import ccxt

exchange = ccxt.blofin({'apiKey': '...', 'secret': '...', 'password': '...'})
order = exchange.create_order('BTC/USDT:USDT', 'limit', 'buy', 0.001, 60000)
print(order['id'], order['status'])

marginMode and positionSide are BloFin's terms, and every venue spells them differently. CCXT reads sensible defaults from the market and lets you override them through unified helpers — set_margin_mode, set_position_mode, set_leverage — that have the same names on every derivatives venue it supports.

Stream an order book

import ccxt.pro
import asyncio

async def main():
    exchange = ccxt.pro.blofin()
    while True:
        orderbook = await exchange.watch_order_book('BTC/USDT:USDT')
        print(orderbook['bids'][0], orderbook['asks'][0])

asyncio.run(main())

CCXT returns a live, merged order book as a value you await; the SDK gives you a socket client you subscribe on and handle in callbacks. Underneath, CCXT does the parts that are easy to get wrong: applying the snapshot, merging updates, detecting drops, reconnecting and re-subscribing, and keeping bounded caches for trades and candles.

Where the differences actually bite

One language versus seven

BloFin's SDK is Python-only. CCXT is written once in TypeScript and transpiled to JavaScript, Python, PHP, C#/.NET, Go and Java with identical method names and return structures, so research in a Python notebook ports to a Go or C# execution service without a second data model:

import ccxt from 'ccxt';
const exchange = new ccxt.blofin ();
const ticker = await exchange.fetchTicker ('BTC/USDT:USDT');

Signing five headers, correctly, every time

BloFin private requests carry ACCESS-KEY, ACCESS-SIGN, ACCESS-TIMESTAMP, ACCESS-NONCE and ACCESS-PASSPHRASE, where the signature is a base64-encoded HMAC-SHA256 over the request path, method, timestamp, nonce and body concatenated in that order. Both the SDK and CCXT build that for you — the difference is that CCXT builds it in all seven languages, and applies it to the implicit methods too.

Rate limits you do not have to model

BloFin documents up to 500 requests per minute per IP, 1500 per five minutes, and a tighter 30 requests per 10 seconds on trading endpoints, with timed suspensions when you exceed them. The official SDK does not ship a throttler. CCXT's token-bucket limiter is on by default, with rateLimit set to 100 ms for BloFin, so a loop paces itself.

Demo trading without a second code path

exchange = ccxt.blofin({'apiKey': '...', 'secret': '...', 'password': '...'})
exchange.set_sandbox_mode(True)   # swaps REST and both WebSocket URLs

One flag moves REST to demo-trading-openapi.blofin.com and both socket URLs with it. The SDK's equivalent is a different client class (DemoClient) or an isDemo=True argument on each client you construct.

One error hierarchy

CCXT maps BloFin's numeric error codes onto a typed exception treeInsufficientFunds, InvalidOrder, OrderNotFound, RateLimitExceeded, AuthenticationError, NetworkError and 35 more, all descending from BaseError. You write except ccxt.InsufficientFunds once and it survives adding a second venue, instead of matching on codes like 152007.

Derivatives features, unified

BloFin is a perpetuals venue, and CCXT models the parts that matter as unified methods: fetch_positions, fetch_funding_rate, fetch_funding_rate_history, fetch_funding_history, set_leverage, set_margin_mode, set_position_mode, close_position, fetch_leverages, fetch_positions_adl_rank, plus create_order_with_take_profit_and_stop_loss, create_trigger_order, create_stop_loss_order and create_take_profit_order. The same method names work on Bybit, OKX and the rest.

Nothing is hidden — the implicit API

Alongside the 54 unified capabilities, all 79 BloFin endpoints are generated as callable implicit methods, with the five-header signing, rate limiting and error mapping applied — and that includes the copy-trading and affiliate routes the official SDK wraps:

# GET /api/v1/copytrading/account/balance
balance = exchange.private_get_copytrading_account_balance()

# GET /api/v1/affiliate/invitees
invitees = exchange.private_get_affiliate_invitees()

Browse them all on the blofin implicit API page.

What the official BloFin SDK does better

An honest list, because these are real:

  • Copy trading and affiliate APIs as typed methods. CopyTradingAPI and AffiliateAPI wrap those endpoints with named parameters. CCXT reaches the same routes through implicit methods, but has no unified copy-trading abstraction — those are BloFin-specific products, so there is nothing to unify them against.
  • One-to-one naming with BloFin's docs. instId, marginMode, positionSide, orderType are BloFin's own field names, so debugging against the API reference has no translation step. CCXT's unified names are a deliberate abstraction.
  • A dedicated copy-trading WebSocket client. BlofinWsCopytradingClient connects to wss://openapi.blofin.com/ws/copytrading/private, a channel CCXT does not expose as a watch* method.
  • New BloFin features land there first. A new endpoint appears in BloFin's own SDK before it is modelled as a unified CCXT method; CCXT's implicit API closes most of that gap on day one, but a unified wrapper can lag.
  • BloFin also ships developer tooling around it. The same organisation publishes an MCP server and a CLI for the exchange, which are useful if you are building agent- or terminal-driven workflows against BloFin specifically.

If you are writing Python, trading only BloFin, and copy trading is central to what you are building, the official SDK is a defensible choice.

Migrating from blofin-sdk-python to CCXT

What you are doingblofin-sdk-pythonCCXT
Symbols'BTC-USDT''BTC/USDT:USDT'
ClientClient(...) / DemoClient(...)ccxt.blofin({'apiKey', 'secret', 'password'}) + set_sandbox_mode()
InstrumentsMarketAPI.getInstruments()load_markets()
TickerMarketAPI.getTickers()fetch_ticker() / fetch_tickers()
Order bookMarketAPI books endpointfetch_order_book()
CandlesMarketAPI candles endpointfetch_ohlcv()
New orderTradingAPI.placeOrder()create_order()
Batch ordersTradingAPI.placeBatchOrders()create_orders()
Cancel orderTradingAPI cancel endpointcancel_order()
Open ordersTradingAPI pending-orders endpointfetch_open_orders()
PositionsTradingAPI positions endpointfetch_positions() / fetch_position()
LeverageTradingAPI set-leverage endpointset_leverage()
BalanceTradingAPI balance endpointfetch_balance()
StreamsBlofinWsPublicClient / BlofinWsPrivateClientwatch_* on ccxt.pro.blofin
Copy tradingCopyTradingAPIcopytrading/* implicit methods
Anything not listednative methodthe same endpoint as an implicit method

FAQ

Does BloFin have an official SDK? Yes, one: blofin-sdk-python, Apache-2.0, covering REST and WebSockets including copy trading and the affiliate API. Its README installs it from a clone with pip install -e . rather than from PyPI, and the repository was last updated on 30 January 2025. There is no official SDK for any other language.

Is the blofin package on PyPI the official SDK? No. That package points at nomeida/blofin-python, a separate MIT-licensed community project. If you want BloFin's own code, clone the blofin/blofin-sdk-python repository.

Does CCXT support BloFin WebSockets? Yes — 13 watch* methods via ccxt.pro.blofin, covering tickers, bids/asks, trades, candles, order books, orders, positions, balance and funding rates, plus the *ForSymbols multi-symbol variants. Reconnect, re-subscribe and book merging are handled by the library.

Can I use BloFin demo trading through CCXT? Yes. exchange.set_sandbox_mode(True) switches the REST base URL and both public and private WebSocket URLs to demo-trading-openapi.blofin.com. Use API keys issued for the demo environment.

Does CCXT support BloFin spot trading? CCXT models BloFin as a swap venue — perpetual futures — which is what the exchange's API is built around. Unified symbols are of the form 'BTC/USDT:USDT'.

Is CCXT free? Yes. MIT-licensed, including the WebSocket support.

Next steps

On this page