Expand description
Network clients and connection policy for NautilusTrader.
The crate provides asynchronous HTTP, reconnecting WebSocket, and suffix-framed TCP clients, together with rate limiting, retry, backoff, proxy, and TLS support.
§NautilusTrader
NautilusTrader is an open-source, production-grade, Rust-native engine for multi-asset, multi-venue trading systems.
The system spans research, deterministic simulation, and live execution within a single event-driven architecture, providing research-to-live semantic parity.
§Feature flags
python: Exposes theTransportBackendenum through PyO3.extension-module: Builds the crate as a Python extension module.turmoil: Enables deterministic network simulation testing with turmoil.transport-sockudo: Adds the sockudo-ws WebSocket backend, selectable throughWebSocketConfig.backend. This feature is enabled by default; usedefault-features = falseto omit the dependency.
§Testing
The crate includes standard integration tests and deterministic failure-path tests using
turmoil.
To run standard tests:
cargo nextest run -p nautilus-networkTo run turmoil network simulation tests:
cargo nextest run -p nautilus-network --features turmoilThe turmoil tests cover reconnections, partitions, and related network failures without
relying on wall-clock timing.
Re-exports§
pub use transport::Message;pub use transport::TransportError;
Modules§
- backoff
- Exponential backoff with optional jitter for socket reconnection delays.
- dst
- Deterministic simulation testing (DST) seam for network async primitives.
- error
- Network error types.
- http
- Asynchronous HTTP requests with rate limiting, connection reuse, and bounded responses.
- mode
- Atomic connection state and controller lifecycle coordination for socket transports.
- net
- Network abstractions for dependency injection and testing.
- python
- Python bindings for network configuration.
- ratelimiter
- A rate limiter implementation heavily inspired by governor.
- retry
- Retry policy for asynchronous network operations.
- socket
- Raw TCP clients with suffix framing, optional TLS, heartbeats, and automatic reconnection.
- transport
- Transport abstraction layer for WebSocket backends.
- websocket
- WebSocket transport with runtime backend selection and adapter-facing lifecycle policy.
Structs§
- Socket
State Sink - Receives ordered semantic state changes from a single socket client.
Enums§
- Socket
State - Represents the availability state reported by a socket transport.
Constants§
- RECONNECTED
- Sentinel message indicating that a WebSocket reconnection completed.