NAUTILUS / RUST source 3eb18933
Pages

Native Rust Adapter Framework

Relevant Rust source files

  • crates/common/src/factories/client.rs
  • crates/common/src/clients/mod.rs
  • crates/data/src/client.rs
  • crates/execution/src/client/mod.rs
  • crates/live/src/node/builder.rs
  • crates/network/src/http/client.rs
  • crates/network/src/websocket/client.rs
  • crates/network/src/socket/client.rs
  • crates/network/src/retry.rs

The adapter framework separates transport/protocol concerns from domain clients and node composition. The stable inward boundary is the Nautilus data or execution client contract; provider-specific SDK values must not cross it.

Layers

  1. Network clients own HTTP, WebSocket, sockets, TLS, rate limits, proxying, retries, and connection lifecycle.
  2. Provider modules own authentication, request/response schemas, stream decoding, symbology, and external identifiers.
  3. Nautilus clients translate provider messages into model data or execution reports and translate commands outward.
  4. DataClientFactory and ExecutionClientFactory construct clients from typed configuration.
  5. LiveNodeBuilder registers the factories and assembles clients before the node starts.

Networking primitives

nautilus-network supplies HttpClient, WebSocketClient, SocketClient, RetryManager, ExponentialBackoff, rate limiting, transport backends, subscriptions, authentication tracking, and proxy support. An adapter may use these primitives but remains responsible for provider-specific resume and duplicate-suppression semantics.

Automatic reconnect is not sufficient recovery. The adapter must know which subscriptions were acknowledged, whether a provider sequence can resume, how gaps are detected, and when the data engine needs an explicit reset or snapshot.

Factory ownership

Factories validate configuration and create all required provider objects. Construction errors should fail node build before connectivity starts. The node builder owns registration and prevents accidental ambiguity between clients. Identifiers used for routing must be stable and explicit.

Data and execution responsibilities

A data client manages connection, subscription and request commands, instruments, market-data normalization, timestamps, and health. An execution client manages accounts, order submission/modification/cancel, reports, reconciliation, and broker-specific recovery. Risk and portfolio logic remain in their engine crates.

Testing

Test codecs and symbology from immutable fixtures; test client state transitions with deterministic transport doubles; test factory composition through a node; then run bounded credentialed smoke tests. Include malformed frames, rate limits, reconnect, replay gaps, duplicate events, partial startup, and shutdown.