Research · TRUEFIX LABS
Building a Multi-Broker Trading System in Rust
A production-oriented guide to provider adapters, canonical instruments, order lifecycles, reconciliation, risk controls, and deterministic execution in Rust.
Short answer. A multi-broker trading system should isolate provider-specific APIs behind adapters and expose canonical instruments, market data, orders, positions, and capabilities to the rest of the system. In Rust, keep the execution kernel deterministic, model unknown outcomes explicitly, and treat reconciliation as a first-class process rather than relying only on WebSocket events.
Recommended architecture
Use a layered design: provider clients at the edge, a normalization boundary for instruments and events, an order management system, a risk engine, an execution kernel, and durable audit storage. Provider selection belongs to a capability and entitlement layer, not to business logic that guesses from a broker name.
Provider API → Adapter → Canonical contracts → OMS → Risk → Execution → ReconciliationRust design choices
Use typed enums for order states, environments, sides, order types, and failure classes. Keep provider I/O asynchronous, but make the decision and risk path deterministic. Use cancellation-safe tasks, bounded channels, monotonic event sequence checks, and durable identifiers for every outbound request.
Failure modes to design first
- Timeout after the provider accepted an order.
- WebSocket disconnect or sequence gaps.
- Symbol ambiguity across venues.
- Partial fills and fee currency differences.
- Position drift between local state and an account snapshot.
Production checklist
Persist the original provider, client instance, account, environment, native symbol, client order ID, request revision, and evidence used for the decision. If an execution result is unknown, query the original identity and reconcile before considering any retry.
Sources
Last verified: 2026-09-28. Provider capabilities can change by region, account, product, environment, and entitlement; verify the linked official documentation before production use.
Last updated: 2026-09-28