CCXT — Rust
A Rust port of CCXT, the CryptoCurrency eXchange
Trading library. Like the other CCXT targets, the Rust sources are transpiled
from the TypeScript source of truth (ts/src); the hand-written parts are the
runtime (Value, HTTP, crypto, rate limiter) and the typed wrapper layer.
Status: work in progress. The offline conformance suites pass (base, static request/response, id, prediction), but not every exchange method is exercised end-to-end and some signing primitives are intentionally unimplemented (see Known limitations). Treat this as a preview, not a stable release. The crate is still
0.1.0.
Installation
[]
# The generated REST exchanges are behind a feature flag (see below).
= { = "https://github.com/ccxt/ccxt", = "ccxt", = ["transpiled-base"] }
= { = "1", = ["full"] }
Quick start
Each exchange has a typed wrapper (Binance, Kraken, …) analogous to Go's
typed exchange structs. Typed methods return Result<T, ExchangeError>.
use ;
async
The typed wrapper Derefs to the underlying core, so the full dynamic surface
(Value-typed methods) is also reachable when a typed method isn't available.
Feature flags
| feature | what it enables |
|---|---|
| (default) | the base runtime + hand-written base methods only (no venues) |
engine |
the transpiled base method surface (exchange_generated, prediction base) without any venue |
<id> (binance, kraken, …) |
one transpiled REST Core; a derived venue's feature enables its parent (binanceus → binance) |
prediction-<id> |
one prediction-market Core (prefixed because ids overlap the REST venues) |
all-exchanges / all-prediction |
every REST / prediction Core |
transpiled-base |
engine + all-exchanges + all-prediction — the whole surface |
The base Exchange methods are always compiled; the features gate only the generated
modules. The crate builds with --no-default-features and with --all-features. The
typed crates (ccxt, ccxt-pro, ccxt-prediction) enable engine plus one <id>
feature per venue the user selected, which is what keeps a single-exchange build small;
the per-venue feature lists are generated by build/generateRustWrappers.ts.
The transpiled WebSocket (pro) venues live in the sibling ccxt-pro crate
and the typed unified-method wrappers (ccxt_typed::Binance, …) in ccxt-typed.
They were split out of ccxt so no single rustc invocation compiles the whole
generated surface at once. Add those crates as dependencies to use them.
Error handling
Expected failures surface as Result<T, ExchangeError> from the typed wrappers.
ExchangeError::is() / is_a() understand the CCXT class hierarchy, so you can
match on a base class:
match ex.fetch_ticker.await
Rate limiting
enableRateLimit (on by default) drives a leaky-bucket limiter: requests are
spaced by rateLimit ms (weighted per endpoint). Disable it only if you throttle
externally.
Prediction markets
Prediction venues (kalshi, myriad, limitless, polymarket, and the
prediction flavour of hyperliquid) live in the ccxt::prediction module and
share the PredictionExchange base (events → markets → outcomes).
Known limitations
- Unimplemented signing — some exchange-specific signers (StarkNet/
paradex,lighterzk-proofs,dydxprotobuf tx,apexStarkEx, curve25519/axolotl) are not yet ported. They fail loudly withNotSupportedrather than emitting an invalid signature, so those exchanges' private/trading endpoints are not usable yet. Public endpoints work. - Integer precision — JSON integers above
u64::MAXstill fall back tof64; values up tou64::MAXare preserved losslessly (as strings when they exceedi64). - The transpiler and dispatch layer are still being hardened; see the repo's Rust review notes for the current architectural roadmap.
License
MIT — same as CCXT.