CCXT Order Router
Introducing CCXT Order Router
Today we're launching the CCXT Order Router: the best price for your trade, across ~60 exchanges, in one call.
Every ccxt developer has written this script: loop over exchanges, fetch order books, compare the asks. Then you remember fees. Then depth. Then pairs that don't exist and need a bridge.
We built it properly, once, so you never have to write it again.
What it does Tell it what you want to trade and how much. In 0.22 ms it tells you where: • Keeps live order books from ~60 exchanges across 52 symbols, streamed over WebSocket • Adjusts for fees, which range from 0.05% to 1.20% across venues • Adjusts for balances: connect your accounts and it routes only on what you can actually fund • Walks each book to your real size, not top-of-book • Finds bridge routes: DOGE→TRY has no direct market, so it goes DOGE→USDT on mexc, then USDT→TRY on whitebit • Splits your order across venues when that beats any single one
See it in action On a 250,000 USDT buy of BTC, 33 venues could fill it. htx showed the lowest ask, but after its 0.20% taker fee it came fifth. woo was 12.83 bps cheaper to actually trade on, and splitting across two venues saved another 1.32 bps.
Try it right now. No account, no key:
curl "https://docs.ccxt.com/router/api/route?from=USDT&to=BTC&amountIn=50000"Available natively in ccxt
The router is available natively via ccxt, in JavaScript, TypeScript, Python, PHP, C#, Go and Rust. Two calls take you from question to execution: fetchRoute finds the best route, and execute places it on your own exchange accounts, with every order inside your slippage limit.
const venues = { binance, okx } // your ccxt instances, with your API keys
const router = new ccxt.OrderRouter ({ venues })
const route = await router.fetchRoute ('USDT', 'BTC', {
amountIn: 50000,
strategy: 'split_optimal', // or best_single, split_capped
})
const report = await router.execute (route, venues)Get started in your language
- JavaScript → https://docs.ccxt.com/docs/examples/js/order-router
- TypeScript → https://docs.ccxt.com/docs/examples/ts/order-router
- Python → https://docs.ccxt.com/docs/examples/py/order-router
- PHP → https://docs.ccxt.com/docs/examples/php/order-router
- C# → https://docs.ccxt.com/docs/examples/cs/OrderRouterExample
- Go → https://github.com/ccxt/ccxt/tree/master/examples/go/orderrouter
- Rust → https://docs.ccxt.com/docs/examples/rust/order_router
Free during beta No signup, no billing, up to 5 requests per second per IP. The router never holds your funds. Orders are placed only by your own code, on your own accounts.
Order Router → https://docs.ccxt.com/router/ API reference → https://docs.ccxt.com/router/docs/api OrderRouter docs → https://docs.ccxt.com/docs/order-router
We'd love your feedback. Tell us what you route first
Source: ccxt/ccxt