Implementation:Nautechsystems Nautilus trader TradingNode Init
| Field | Value |
|---|---|
| sources | https://github.com/nautechsystems/nautilus_trader, https://nautilustrader.io/docs/ |
| domains | algorithmic trading, live trading infrastructure, event-driven systems |
| last_updated | 2026-02-10 12:00 GMT |
Overview
Concrete tool for initializing a live trading node provided by NautilusTrader.
Description
The TradingNode class is the top-level entry point for deploying live trading strategies. Its constructor accepts a TradingNodeConfig and an optional asyncio event loop. During initialisation, it:
- Validates and stores the configuration.
- Resolves an asyncio event loop (caller-supplied, running, or newly created).
- Constructs a
NautilusKernelthat owns all core subsystems (data engine, execution engine, risk engine, portfolio, cache, message bus, clock). - Creates a
TradingNodeBuilderwired to the kernel's engines and infrastructure. - Logs whether cache and message-bus database backing are enabled.
- Initialises internal state flags (
_is_built, task references, stream processors).
The companion TradingNodeConfig is a frozen (immutable) msgspec struct inheriting from NautilusKernelConfig. It provides typed fields for trader identity, engine configs, and client mappings, with sensible defaults for every parameter.
Usage
Import and instantiate TradingNode when building a live trading application. Pair it with TradingNodeConfig to declaratively set trader identity, engine parameters, and client configurations.
Code Reference
Source Location
| Item | Path |
|---|---|
| TradingNode class | nautilus_trader/live/node.py lines 39-100
|
| TradingNodeConfig | nautilus_trader/live/config.py lines 308-342
|
Signature
class TradingNode:
def __init__(
self,
config: TradingNodeConfig | None = None,
loop: asyncio.AbstractEventLoop | None = None,
) -> None: ...
class TradingNodeConfig(NautilusKernelConfig, frozen=True):
environment: Environment = Environment.LIVE
trader_id: TraderId = "TRADER-001"
data_engine: LiveDataEngineConfig = LiveDataEngineConfig()
risk_engine: LiveRiskEngineConfig = LiveRiskEngineConfig()
exec_engine: LiveExecEngineConfig = LiveExecEngineConfig()
data_clients: dict[str, LiveDataClientConfig] = {}
exec_clients: dict[str, LiveExecClientConfig] = {}
Import
from nautilus_trader.live.node import TradingNode
from nautilus_trader.config import TradingNodeConfig
I/O Contract
Inputs
| Parameter | Type | Required | Description |
|---|---|---|---|
| config | None | No | Declarative configuration for the node. Defaults to TradingNodeConfig().
|
| loop | None | No | Event loop to use. If None, the constructor resolves one automatically.
|
Outputs / Exposed Attributes
| Attribute | Type | Description |
|---|---|---|
| kernel | NautilusKernel |
The core kernel owning all engines and infrastructure. |
| trader_id | TraderId |
The trader identifier (read-only property). |
| machine_id | str |
The host machine identifier (read-only property). |
| instance_id | UUID4 |
Unique instance identifier for this node run. |
| trader | Trader |
The internal Trader that manages strategies and actors.
|
| cache | CacheFacade |
Read-only cache facade for instruments, orders, and positions. |
| portfolio | PortfolioFacade |
Read-only portfolio facade for balances and P&L. |
Usage Examples
Minimal Live Node
import asyncio
from nautilus_trader.live.node import TradingNode
from nautilus_trader.config import TradingNodeConfig
config = TradingNodeConfig(
trader_id="TRADER-001",
)
node = TradingNode(config=config)
Custom Event Loop
import asyncio
from nautilus_trader.live.node import TradingNode
from nautilus_trader.config import TradingNodeConfig
loop = asyncio.new_event_loop()
node = TradingNode(
config=TradingNodeConfig(trader_id="TRADER-002"),
loop=loop,
)