Creating Native Rust Adapters
Relevant Rust source files
crates/common/src/factories/client.rscrates/data/src/client.rscrates/execution/src/client/mod.rscrates/network/src/websocket/client.rscrates/network/src/http/client.rscrates/adapters/databento/src/factories.rscrates/adapters/interactive_brokers/src/factories.rs
Create a new adapter only after confirming that an accepted requirement is not satisfied by the selected Databento or Interactive Brokers crates. Upstream also requires discussion and approval for new integrations because maintenance extends far beyond initial connectivity.
Start with semantics
Inventory provider instruments, schemas, timestamps, sequences, correction rules, entitlements, rate limits, authentication, and recovery behavior. Map each provider value to a canonical Nautilus type. Record unsupported provider features instead of inventing approximate model semantics.
Implement inward
Build pure parsers and converters first. Then add transport, authentication, and request/stream clients. Implement the Nautilus data-client or execution-client contract only after fixtures prove the mappings. Finally provide the corresponding factory and register it with LiveNodeBuilder.
For market data, cover instrument discovery, quotes, trades, bars, books, snapshots, subscription lifecycle, historical requests, and gap handling as required. For execution, cover accounts, order commands, acknowledgements, rejects, fills, cancels, reconciliation, and stable external/internal identifier mapping.
Lifecycle and failure policy
Use bounded retry/backoff, explicit timeouts, rate limiting, and cancellation. Reconnect must restore only acknowledged subscriptions, suppress duplicates, and surface unrecoverable gaps. Partial construction or login failure must release tasks and sockets; shutdown must stop producers before dropping engine consumers.
Evidence
- codec fixtures for every supported message family;
- symbology and numeric-precision round trips;
- deterministic client-state tests;
- malformed, reordered, duplicate, and gap cases;
- factory plus
LiveNodecomposition test; - bounded provider sandbox/paper smoke test;
- benchmarks for any latency or throughput claim.
Keep SDK, transport, and provider configuration types private to the adapter. The public inward result is a Nautilus client emitting and consuming nautilus-model values.