# mayur-dambale/limit-order-book architecture

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

- Interactive diagram: https://gitdiagram.com/mayur-dambale/limit-order-book
- Repository: https://github.com/mayur-dambale/limit-order-book

## Overview

This repository is a C++ limit-order-book matching engine with companion sample-order generation and processing-time analysis. The main workflow creates a Book, feeds it order commands through OrderPipeline, dispatches market, limit, stop, and stop-limit operations to the book, and records timing data for visualization. The book uses price-level limits and FIFO orders, with AVL-based price trees and stop-order handling. The README documents these capabilities; several implementation details are unsampled, so the graph omits uncertain internal call relationships.

Main entry points: [`Limit_Order_Book/Book.cpp`](https://github.com/mayur-dambale/limit-order-book/blob/main/Limit_Order_Book/Book.cpp) (Matching book), [`Process_Orders/OrderPipeline.cpp`](https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/OrderPipeline.cpp) (Order command pipeline), [`main.cpp`](https://github.com/mayur-dambale/limit-order-book/blob/main/main.cpp) (Application entry), [`Generate_Orders/GenerateOrders.cpp`](https://github.com/mayur-dambale/limit-order-book/blob/main/Generate_Orders/GenerateOrders.cpp) (Order data generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Matching runtime"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_pipeline["Order command pipeline<br/>[OrderPipeline.cpp]"]
  node_book["Matching book<br/>[Book.cpp]"]
  node_limits["Price levels and trees<br/>[Limit.cpp]"]
  node_orders["FIFO order records<br/>[Order.cpp]"]
end

subgraph group_data["Order data"]
  node_generator["Order data generator<br/>[GenerateOrders.cpp]"]
  node_initial["Initial order sample<br/>[initialOrders.txt]"]
end

subgraph group_analysis["Performance analysis"]
  node_processing["Processing measurements<br/>[OrderPipeline.cpp]"]
  node_csv["Timing CSV"]
  node_visualizer["Performance charts"]
end

node_user(("Run application"))

node_user -->|"starts"| node_entry
node_entry -->|"creates"| node_book
node_entry -->|"processes orders"| node_pipeline
node_pipeline -->|"dispatches commands"| node_book
node_book -->|"manages levels"| node_limits
node_book -->|"creates orders"| node_orders
node_limits -->|"links FIFO orders"| node_orders
node_generator -->|"generates against"| node_book
node_generator -.->|"writes sample"| node_initial
node_pipeline -.->|"reads commands"| node_initial
node_pipeline -->|"writes timings"| node_csv
node_visualizer -->|"reads timings"| node_csv

click node_entry "https://github.com/mayur-dambale/limit-order-book/blob/main/main.cpp"
click node_pipeline "https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/OrderPipeline.cpp"
click node_book "https://github.com/mayur-dambale/limit-order-book/blob/main/Limit_Order_Book/Book.cpp"
click node_limits "https://github.com/mayur-dambale/limit-order-book/blob/main/Limit_Order_Book/Limit.cpp"
click node_orders "https://github.com/mayur-dambale/limit-order-book/blob/main/Limit_Order_Book/Order.cpp"
click node_generator "https://github.com/mayur-dambale/limit-order-book/blob/main/Generate_Orders/GenerateOrders.cpp"
click node_initial "https://github.com/mayur-dambale/limit-order-book/blob/main/Generate_Orders/initialOrders.txt"
click node_processing "https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/OrderPipeline.cpp"
click node_csv "https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/order_processing_times.csv"
click node_visualizer "https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/data_visualisation.py"

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_entry,node_pipeline,node_book,node_limits,node_orders toneBlue
class node_generator,node_initial toneAmber
class node_processing,node_csv,node_visualizer toneMint
class node_user toneIndigo
```

## Components

### Matching runtime

- [Application entry](https://github.com/mayur-dambale/limit-order-book/blob/main/main.cpp): `main.cpp`
- [Order command pipeline](https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/OrderPipeline.cpp): `Process_Orders/OrderPipeline.cpp`
- [Matching book](https://github.com/mayur-dambale/limit-order-book/blob/main/Limit_Order_Book/Book.cpp): `Limit_Order_Book/Book.cpp`
- [Price levels and trees](https://github.com/mayur-dambale/limit-order-book/blob/main/Limit_Order_Book/Limit.cpp): `Limit_Order_Book/Limit.cpp`
- [FIFO order records](https://github.com/mayur-dambale/limit-order-book/blob/main/Limit_Order_Book/Order.cpp): `Limit_Order_Book/Order.cpp`

### Order data

- [Order data generator](https://github.com/mayur-dambale/limit-order-book/blob/main/Generate_Orders/GenerateOrders.cpp): `Generate_Orders/GenerateOrders.cpp`
- [Initial order sample](https://github.com/mayur-dambale/limit-order-book/blob/main/Generate_Orders/initialOrders.txt): `Generate_Orders/initialOrders.txt`

### Performance analysis

- [Processing measurements](https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/OrderPipeline.cpp): `Process_Orders/OrderPipeline.cpp`
- [Timing CSV](https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/order_processing_times.csv): `Process_Orders/order_processing_times.csv`
- [Performance charts](https://github.com/mayur-dambale/limit-order-book/blob/main/Process_Orders/data_visualisation.py): `Process_Orders/data_visualisation.py`

### Other components

- **Run application**

## Connections

- Run application → Application entry: starts (evidence: `README.md`)
- Application entry → Matching book: creates (evidence: `main.cpp`)
- Application entry → Order command pipeline: processes orders (evidence: `main.cpp`)
- Order command pipeline → Matching book: dispatches commands (evidence: `Process_Orders/OrderPipeline.cpp`)
- Matching book → Price levels and trees: manages levels (evidence: `Limit_Order_Book/Book.cpp`)
- Matching book → FIFO order records: creates orders (evidence: `Limit_Order_Book/Book.cpp`)
- Price levels and trees → FIFO order records: links FIFO orders (evidence: `Limit_Order_Book/Limit.cpp`)
- Order data generator → Matching book: generates against (evidence: `Generate_Orders/GenerateOrders.cpp`)
- Order data generator → Initial order sample: writes sample
- Order command pipeline → Initial order sample: reads commands
- Order command pipeline → Timing CSV: writes timings (evidence: `Process_Orders/OrderPipeline.cpp`)
- Performance charts → Timing CSV: reads timings (evidence: `Process_Orders/data_visualisation.py`)
