Use Tokio for long-running Rust services. The SDK's async model is introduced once in Overview.
Process lifecycle
- Create one client per process (or per logical bot) and reuse it.
- Drop the client on shutdown so HTTP and WebSocket resources release cleanly.
- Cancel surrounding work by aborting or cancelling the owning Tokio task.
Configuration
Prefer explicit credentials from your secret store. Use Client::from_env only for local scripts.
Wait for catalogs before decimal writes. Disable catalog hydration only if you exclusively use pre-scaled integers and understand the tradeoff.
Wire format
Binary Protobuf is the default Connect codec. JSON wire formats are for debugging, not hot
paths. With WireFormat::Json, API-key signatures hash the JSON body bytes that are actually
sent, not protobuf. A body/signature mismatch fails auth.
See Client configuration.
Related Topics
Authentication Configure Ed25519 API keys, Account ID, and env-based wiring for bots. Market data Read candles, public trades, order books, and market overview, no credentials required. Trading Place, modify, cancel, and batch spot orders; use triggers with the Rust SDK. Streaming Subscribe with observable errors, handshake-before-return, fail-closed overflow, and private Account ID requirements. Accounts & balances Funding vs trading balances, holds, subaccounts, policies, and transfer history. Deposits & withdrawals Deposit addresses, trading withdraws, internal transfers, and funding flows. Error handling Classify errors with is_retryable and mutation_outcome_unknown, then retry with stable identities. Production trading operations Operate, test, troubleshoot, and upgrade an automated Rust trading system safely.