Expand description
Live trading node built on a single-threaded tokio event loop.
LiveNode::run() drives the system through a tokio::select! loop that
multiplexes data events, execution events, trading commands, timers, and
periodic maintenance tasks (reconciliation, purge, prune, audit).
§Threading model
The core types (ExecutionManager, ExecutionEngine, Cache) use
Rc<RefCell<..>> and are !Send. All access happens on the same thread.
The select! macro runs one branch to completion (including inner awaits)
before polling the next, so RefCell borrows held across .await points
within a single branch cannot conflict with borrows in other branches.
§Startup sequencing
Startup connects clients in two phases so that instruments are in the cache before execution clients read them:
- Connect data clients (instruments arrive as buffered
DataEvents). - Flush all pending data events and commands into the cache via
flush_pending_data, which loopstry_recvon the channel receivers until no items remain. - Connect execution clients (
load_instruments_from_cachenow finds populated instruments). - Drain remaining events, then run reconciliation.
Both run() (integrated event loop) and start() (manual lifecycle)
follow this sequence.
§Reconciliation
Three sub-checks run on independent intervals: inflight orders, open order consistency, and position consistency. A single reconciliation timer fires at the minimum enabled interval. Each tick, the handler checks which sub-checks are due based on elapsed nanoseconds and runs them in sequence. The open order and position checks query venues via async HTTP calls, blocking the select loop for the duration of each query.
Structs§
- Live
Node - High-level abstraction for a live Nautilus system node.
- Live
Node Handle - A thread-safe handle to control a
LiveNodefrom other threads.
Enums§
- Node
State - Lifecycle state of the
LiveNoderunner.