# jkuwalek/l3-order-book architecture

> Architecture diagram of the GitHub repository jkuwalek/l3-order-book, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jkuwalek/l3-order-book
- Repository: https://github.com/jkuwalek/l3-order-book

## Overview

This is a Qt desktop L3 order-book simulator. The user starts a simulated market or enters orders manually; the matching engine processes orders, maintains the book and produces trades, while the GUI presents the ladder, depth chart and market-maker performance. The market maker is a separate quoting and position-management capability. The README documents the main capabilities and threading model; some implementation details were not excerpted, so those links are omitted or marked unverified.

Main entry points: [`src/ui/MainWindow.cpp`](https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/MainWindow.cpp) (Main window), [`src/core/MatchingEngine.cpp`](https://github.com/jkuwalek/l3-order-book/blob/main/src/core/MatchingEngine.cpp) (Matching engine), [`src/core/OrderBook.cpp`](https://github.com/jkuwalek/l3-order-book/blob/main/src/core/OrderBook.cpp) (L3 order book), [`src/bot/MarketMaker.cpp`](https://github.com/jkuwalek/l3-order-book/blob/main/src/bot/MarketMaker.cpp) (Market maker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_app["Application entry<br/>[main.cpp]"]
  node_window["Main window<br/>[MainWindow.cpp]"]
end

subgraph group_market["Order processing"]
  node_engine["Matching engine<br/>[MatchingEngine.cpp]"]
  node_book[("L3 order book<br/>[OrderBook.cpp]")]
  node_order["Order model<br/>[Order.h]"]
  node_types["Trading types<br/>[Types.h]"]
end

subgraph group_automation["Market activity"]
  node_feed["Mock market feed"]
  node_maker["Market maker<br/>[MarketMaker.cpp]"]
end

subgraph group_presentation["Desktop views"]
  node_ladder["Order book view"]
  node_depth["Depth chart"]
  node_makerui["Maker statistics"]
end

node_user(("User"))

node_user -->|"operates"| node_window
node_app -->|"opens"| node_window
node_window -->|"controls"| node_engine
node_window -->|"starts"| node_feed
node_window -->|"configures"| node_maker
node_feed -->|"submits orders"| node_engine
node_maker -.->|"submits quotes"| node_engine
node_engine -->|"matches and updates"| node_book
node_engine -->|"reads snapshots"| node_book
node_book -->|"stores orders"| node_order
node_window -->|"shows"| node_ladder
node_window -->|"shows"| node_depth
node_window -->|"shows"| node_makerui
node_ladder -->|"reads snapshots"| node_book
node_depth -->|"reads depth"| node_book
node_makerui -->|"displays stats"| node_maker
node_engine -->|"uses trade types"| node_types
node_order -->|"uses shared types"| node_types

click node_app "https://github.com/jkuwalek/l3-order-book/blob/main/src/main.cpp"
click node_window "https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/MainWindow.cpp"
click node_engine "https://github.com/jkuwalek/l3-order-book/blob/main/src/core/MatchingEngine.cpp"
click node_book "https://github.com/jkuwalek/l3-order-book/blob/main/src/core/OrderBook.cpp"
click node_order "https://github.com/jkuwalek/l3-order-book/blob/main/src/core/Order.h"
click node_types "https://github.com/jkuwalek/l3-order-book/blob/main/src/core/Types.h"
click node_feed "https://github.com/jkuwalek/l3-order-book/blob/main/src/feed/MockMarketDataFeed.cpp"
click node_maker "https://github.com/jkuwalek/l3-order-book/blob/main/src/bot/MarketMaker.cpp"
click node_ladder "https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/OrderBookWidget.cpp"
click node_depth "https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/DepthChartWidget.cpp"
click node_makerui "https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/MarketMakerWidget.cpp"

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_app,node_window,node_user toneBlue
class node_engine,node_book,node_order,node_types toneAmber
class node_feed,node_maker toneMint
class node_ladder,node_depth,node_makerui toneRose
```

## Components

### Application runtime

- [Application entry](https://github.com/jkuwalek/l3-order-book/blob/main/src/main.cpp): `src/main.cpp`
- [Main window](https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/MainWindow.cpp): `src/ui/MainWindow.cpp`

### Order processing

- [Matching engine](https://github.com/jkuwalek/l3-order-book/blob/main/src/core/MatchingEngine.cpp): `src/core/MatchingEngine.cpp`
- [L3 order book](https://github.com/jkuwalek/l3-order-book/blob/main/src/core/OrderBook.cpp): `src/core/OrderBook.cpp`
- [Order model](https://github.com/jkuwalek/l3-order-book/blob/main/src/core/Order.h): `src/core/Order.h`
- [Trading types](https://github.com/jkuwalek/l3-order-book/blob/main/src/core/Types.h): `src/core/Types.h`

### Market activity

- [Mock market feed](https://github.com/jkuwalek/l3-order-book/blob/main/src/feed/MockMarketDataFeed.cpp): `src/feed/MockMarketDataFeed.cpp`
- [Market maker](https://github.com/jkuwalek/l3-order-book/blob/main/src/bot/MarketMaker.cpp): `src/bot/MarketMaker.cpp`

### Desktop views

- [Order book view](https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/OrderBookWidget.cpp): `src/ui/OrderBookWidget.cpp`
- [Depth chart](https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/DepthChartWidget.cpp): `src/ui/DepthChartWidget.cpp`
- [Maker statistics](https://github.com/jkuwalek/l3-order-book/blob/main/src/ui/MarketMakerWidget.cpp): `src/ui/MarketMakerWidget.cpp`

### Other components

- **User**

## Connections

- User → Main window: operates (evidence: `README.md`)
- Application entry → Main window: opens (evidence: `src/main.cpp`)
- Main window → Matching engine: controls (evidence: `README.md`)
- Main window → Mock market feed: starts (evidence: `README.md`)
- Main window → Market maker: configures (evidence: `README.md`)
- Mock market feed → Matching engine: submits orders (evidence: `README.md`)
- Market maker → Matching engine: submits quotes
- Matching engine → L3 order book: matches and updates (evidence: `src/core/MatchingEngine.cpp`)
- Matching engine → L3 order book: reads snapshots (evidence: `src/core/MatchingEngine.cpp`)
- L3 order book → Order model: stores orders
- Main window → Order book view: shows (evidence: `README.md`)
- Main window → Depth chart: shows (evidence: `README.md`)
- Main window → Maker statistics: shows (evidence: `README.md`)
- Order book view → L3 order book: reads snapshots (evidence: `README.md`)
- Depth chart → L3 order book: reads depth (evidence: `README.md`)
- Maker statistics → Market maker: displays stats (evidence: `README.md`)
- Matching engine → Trading types: uses trade types
- Order model → Trading types: uses shared types (evidence: `src/core/Order.h`)
