# rameshkumar-cmd/nautilus_trader architecture

> Architecture diagram of the GitHub repository rameshkumar-cmd/nautilus_trader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rameshkumar-cmd/nautilus_trader
- Repository: https://github.com/rameshkumar-cmd/nautilus_trader

## Overview

NautilusTrader is a Rust-native, event-driven trading system with Python as a control plane. A user configures strategies and orchestration, connects venue or data-provider adapters, and runs the system in backtest or live mode; both modes share strategy and execution semantics. The map includes market-data handling, portfolio/risk and persistence capabilities documented by the README, plus sampled internal layers. Several subsystems are represented at their source paths because their implementation was not excerpted; links are limited to documented relationships or SOURCE INDEX references.

Main entry points: [`crates/system/src/trader.rs`](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/system/src/trader.rs) (Trader), [`crates/backtest/src/python/engine.rs`](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/python/engine.rs) (Python control plane), [`crates/backtest/src/engine.rs`](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/engine.rs) (Backtest engine), [`crates/adapters`](https://github.com/rameshkumar-cmd/nautilus_trader/tree/develop/crates/adapters) (Venue adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Strategy orchestration"]
  node_python["Python control plane<br/>[engine.rs]"]
  node_controller["Controller<br/>[controller.rs]"]
  node_trader["Trader<br/>[trader.rs]"]
  node_backtest["Backtest engine<br/>[engine.rs]"]
  node_sim_config["Simulation config<br/>[config.rs]"]
  node_sim_modules["Simulation modules<br/>[mod.rs]"]
end

subgraph group_market["Market data"]
  node_data_engine["Data engine<br/>[mod.rs]"]
  node_streaming["Data streaming<br/>[streaming.rs]"]
  node_defi_data["DeFi data engine<br/>[engine.rs]"]
  node_historical["Historical data<br/>[config.rs]"]
end

subgraph group_trading["Trading runtime"]
  node_live_execution["Live execution<br/>[manager.rs]"]
  node_execution["Order management<br/>[manager.rs]"]
  node_portfolio["Portfolio<br/>[manager.rs]"]
  node_risk["Risk engine<br/>[mod.rs]"]
end

subgraph group_connectivity["Connectivity and state"]
  node_adapters["Venue adapters"]
  node_network["WebSocket transport<br/>[client.rs]"]
  node_cache[("Cache<br/>[database.rs]")]
  node_msgbus["Message bus<br/>[typed_router.rs]"]
  node_persistence[("State persistence<br/>[session.rs]")]
end

node_user(("System user"))
node_venues(("Venues and providers"))

node_user -->|"configures"| node_python
node_python -->|"controls"| node_backtest
node_python -.->|"orchestrates"| node_controller
node_controller -->|"manages"| node_trader
node_trader -->|"references"| node_controller
node_backtest -->|"uses config"| node_sim_config
node_backtest -->|"dispatches"| node_sim_modules
node_python -->|"builds config"| node_sim_config
node_python -->|"registers"| node_sim_modules
node_backtest -.->|"replays"| node_historical
node_data_engine -->|"uses"| node_streaming
node_defi_data -->|"integrates with"| node_data_engine
node_venues -->|"provides API"| node_adapters
node_adapters -.->|"normalizes data"| node_data_engine
node_adapters -.->|"connects orders"| node_live_execution
node_adapters -.->|"uses transport"| node_network
node_trader -.->|"runs live"| node_live_execution
node_live_execution -.->|"routes orders"| node_execution
node_execution -.->|"updates state"| node_portfolio
node_execution -.->|"checks orders"| node_risk
node_trader -.->|"uses shared state"| node_cache
node_trader -.->|"uses messaging"| node_msgbus
node_trader -.->|"persists state"| node_persistence

click node_python "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/python/engine.rs"
click node_controller "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/system/src/controller.rs"
click node_trader "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/system/src/trader.rs"
click node_backtest "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/engine.rs"
click node_sim_config "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/config.rs"
click node_sim_modules "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/modules/mod.rs"
click node_data_engine "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/data/src/engine/mod.rs"
click node_streaming "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/data/src/engine/streaming.rs"
click node_defi_data "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/data/src/defi/engine.rs"
click node_adapters "https://github.com/rameshkumar-cmd/nautilus_trader/tree/develop/crates/adapters"
click node_network "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/network/src/websocket/client.rs"
click node_historical "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/config.rs"
click node_live_execution "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/live/src/execution/manager.rs"
click node_execution "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/execution/src/order_manager/manager.rs"
click node_portfolio "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/portfolio/src/manager.rs"
click node_risk "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/risk/src/engine/mod.rs"
click node_cache "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/common/src/cache/database.rs"
click node_msgbus "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/common/src/msgbus/typed_router.rs"
click node_persistence "https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/persistence/src/backend/session.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_python,node_controller,node_trader,node_backtest,node_sim_config,node_sim_modules,node_user toneBlue
class node_data_engine,node_streaming,node_defi_data,node_historical toneAmber
class node_live_execution,node_execution,node_portfolio,node_risk toneMint
class node_adapters,node_network,node_cache,node_msgbus,node_persistence toneRose
class node_venues toneIndigo
```

## Components

### Strategy orchestration

- [Python control plane](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/python/engine.rs): `crates/backtest/src/python/engine.rs`
- [Controller](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/system/src/controller.rs): `crates/system/src/controller.rs`
- [Trader](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/system/src/trader.rs): `crates/system/src/trader.rs`
- [Backtest engine](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/engine.rs): `crates/backtest/src/engine.rs`
- [Simulation config](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/config.rs): `crates/backtest/src/config.rs`
- [Simulation modules](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/modules/mod.rs): `crates/backtest/src/modules/mod.rs`

### Market data

- [Data engine](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/data/src/engine/mod.rs): `crates/data/src/engine/mod.rs`
- [Data streaming](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/data/src/engine/streaming.rs): `crates/data/src/engine/streaming.rs`
- [DeFi data engine](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/data/src/defi/engine.rs): `crates/data/src/defi/engine.rs`
- [Historical data](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/backtest/src/config.rs): `crates/backtest/src/config.rs`

### Trading runtime

- [Live execution](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/live/src/execution/manager.rs): `crates/live/src/execution/manager.rs`
- [Order management](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/execution/src/order_manager/manager.rs): `crates/execution/src/order_manager/manager.rs`
- [Portfolio](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/portfolio/src/manager.rs): `crates/portfolio/src/manager.rs`
- [Risk engine](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/risk/src/engine/mod.rs): `crates/risk/src/engine/mod.rs`

### Connectivity and state

- [Venue adapters](https://github.com/rameshkumar-cmd/nautilus_trader/tree/develop/crates/adapters): `crates/adapters`
- [WebSocket transport](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/network/src/websocket/client.rs): `crates/network/src/websocket/client.rs`
- [Cache](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/common/src/cache/database.rs): `crates/common/src/cache/database.rs`
- [Message bus](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/common/src/msgbus/typed_router.rs): `crates/common/src/msgbus/typed_router.rs`
- [State persistence](https://github.com/rameshkumar-cmd/nautilus_trader/blob/develop/crates/persistence/src/backend/session.rs): `crates/persistence/src/backend/session.rs`

### Other components

- **System user**
- **Venues and providers**

## Connections

- System user → Python control plane: configures (evidence: `README.md`)
- Python control plane → Backtest engine: controls (evidence: `crates/backtest/src/python/engine.rs`)
- Python control plane → Controller: orchestrates (evidence: `README.md`)
- Controller → Trader: manages (evidence: `crates/system/src/controller.rs`)
- Trader → Controller: references (evidence: `crates/system/src/trader.rs`)
- Backtest engine → Simulation config: uses config (evidence: `crates/backtest/src/engine.rs`)
- Backtest engine → Simulation modules: dispatches (evidence: `crates/backtest/src/engine.rs`)
- Python control plane → Simulation config: builds config (evidence: `crates/backtest/src/python/engine.rs`)
- Python control plane → Simulation modules: registers
- Backtest engine → Historical data: replays (evidence: `README.md`)
- Data engine → Data streaming: uses (evidence: `crates/data/src/engine/mod.rs`)
- DeFi data engine → Data engine: integrates with (evidence: `crates/data/src/defi/engine.rs`)
- Venues and providers → Venue adapters: provides API (evidence: `README.md`)
- Venue adapters → Data engine: normalizes data (evidence: `README.md`)
- Venue adapters → Live execution: connects orders (evidence: `README.md`)
- Venue adapters → WebSocket transport: uses transport
- Trader → Live execution: runs live (evidence: `README.md`)
- Live execution → Order management: routes orders
- Order management → Portfolio: updates state
- Order management → Risk engine: checks orders
- Trader → Cache: uses shared state (evidence: `README.md`)
- Trader → Message bus: uses messaging (evidence: `README.md`)
- Trader → State persistence: persists state (evidence: `README.md`)
