# jaskaransingh-01/chronos architecture

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

- Interactive diagram: https://gitdiagram.com/jaskaransingh-01/chronos
- Repository: https://github.com/jaskaransingh-01/chronos

## Overview

This is a C++ market-simulation library with an application entry point. Its main workflow replays timestamped order events into a simulator, which manages orders and matching and accumulates trades; it also includes CSV replay input and ITCH decoding/normalization. The source index establishes module references, but the README is empty and the implementation excerpts are limited, so uncertain connections are omitted or marked dashed.

Main entry points: [`src/simulator/simulator.cpp`](https://github.com/jaskaransingh-01/chronos/blob/master/src/simulator/simulator.cpp) (Simulator), [`src/matching/matching_engine.cpp`](https://github.com/jaskaransingh-01/chronos/blob/master/src/matching/matching_engine.cpp) (Matching Engine), [`app/main.cpp`](https://github.com/jaskaransingh-01/chronos/blob/master/app/main.cpp) (Application Entry), [`src/orders/order_book.cpp`](https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/order_book.cpp) (Order Book)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_replay["Replay"]
  node_replay_engine["Replay Engine<br/>[replay_engine.cpp]"]
  node_replay_event["Replay Events<br/>[replay_event.hpp]"]
  node_csv_reader["Replay CSV Reader"]
end

subgraph group_itch["ITCH Input"]
  node_itch_bytes["Byte Reader<br/>[byte_reader.cpp]"]
  node_itch_messages["Message Reader"]
  node_itch_decoder["ITCH Decoder<br/>[itch_decoder.cpp]"]
  node_itch_normalizer["ITCH Normalizer"]
end

subgraph group_simulation["Simulation"]
  node_simulator["Simulator<br/>[simulator.cpp]"]
  node_clock["Simulation Clock<br/>[clock.hpp]"]
  node_event_types["Event Types<br/>[event.hpp]"]
  node_types["Core Types<br/>[enums.hpp]"]
end

subgraph group_orders["Order Management"]
  node_order_pool["Order Pool<br/>[order_pool.cpp]"]
  node_order["Order<br/>[order.cpp]"]
  node_order_book[("Order Book<br/>[order_book.cpp]")]
  node_price_level["Price Levels<br/>[price_level.cpp]"]
end

subgraph group_matching["Matching"]
  node_matching_engine["Matching Engine"]
  node_trade["Trade<br/>[trade.hpp]"]
end

node_operator(("User"))
node_app["Application Entry<br/>[main.cpp]"]

node_operator -.->|"starts"| node_app
node_app -->|"uses"| node_clock
node_app -->|"uses"| node_event_types
node_replay_engine -.->|"dispatches events"| node_simulator
node_replay_engine -.->|"reads events"| node_csv_reader
node_csv_reader -->|"produces"| node_replay_event
node_itch_messages -->|"reads bytes"| node_itch_bytes
node_itch_decoder -->|"decodes bytes"| node_itch_bytes
node_itch_normalizer -->|"normalizes to"| node_replay_event
node_simulator -.->|"advances"| node_clock
node_simulator -.->|"allocates orders"| node_order_pool
node_simulator -.->|"submits orders"| node_matching_engine
node_order_pool -->|"manages"| node_order
node_order_book -->|"tracks"| node_order
node_order_book -->|"organizes by price"| node_price_level
node_matching_engine -->|"matches against"| node_order_book
node_matching_engine -->|"records trades"| node_trade
node_order -->|"uses fields"| node_types
node_replay_event -->|"uses fields"| node_types

click node_app "https://github.com/jaskaransingh-01/chronos/blob/master/app/main.cpp"
click node_replay_engine "https://github.com/jaskaransingh-01/chronos/blob/master/src/replay/replay_engine.cpp"
click node_replay_event "https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/replay/replay_event.hpp"
click node_csv_reader "https://github.com/jaskaransingh-01/chronos/blob/master/src/replay/replay_event_reader.cpp"
click node_itch_bytes "https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/byte_reader.cpp"
click node_itch_messages "https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/itch_message_reader.cpp"
click node_itch_decoder "https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/itch_decoder.cpp"
click node_itch_normalizer "https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/itch_normalizer.cpp"
click node_simulator "https://github.com/jaskaransingh-01/chronos/blob/master/src/simulator/simulator.cpp"
click node_clock "https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/clock/clock.hpp"
click node_event_types "https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/events/event.hpp"
click node_order_pool "https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/order_pool.cpp"
click node_order "https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/order.cpp"
click node_order_book "https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/order_book.cpp"
click node_price_level "https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/price_level.cpp"
click node_matching_engine "https://github.com/jaskaransingh-01/chronos/blob/master/src/matching/matching_engine.cpp"
click node_trade "https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/matching/trade.hpp"
click node_types "https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/types/enums.hpp"

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_replay_engine,node_replay_event,node_csv_reader,node_operator toneBlue
class node_itch_bytes,node_itch_messages,node_itch_decoder,node_itch_normalizer toneAmber
class node_simulator,node_clock,node_event_types,node_types toneMint
class node_order_pool,node_order,node_order_book,node_price_level toneRose
class node_matching_engine,node_trade toneIndigo
class node_app toneTeal
```

## Components

### Replay

- [Replay Engine](https://github.com/jaskaransingh-01/chronos/blob/master/src/replay/replay_engine.cpp): `src/replay/replay_engine.cpp`
- [Replay Events](https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/replay/replay_event.hpp): `include/simulator/replay/replay_event.hpp`
- [Replay CSV Reader](https://github.com/jaskaransingh-01/chronos/blob/master/src/replay/replay_event_reader.cpp): `src/replay/replay_event_reader.cpp`

### ITCH Input

- [Byte Reader](https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/byte_reader.cpp): `src/itch/byte_reader.cpp`
- [Message Reader](https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/itch_message_reader.cpp): `src/itch/itch_message_reader.cpp`
- [ITCH Decoder](https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/itch_decoder.cpp): `src/itch/itch_decoder.cpp`
- [ITCH Normalizer](https://github.com/jaskaransingh-01/chronos/blob/master/src/itch/itch_normalizer.cpp): `src/itch/itch_normalizer.cpp`

### Simulation

- [Simulator](https://github.com/jaskaransingh-01/chronos/blob/master/src/simulator/simulator.cpp): `src/simulator/simulator.cpp`
- [Simulation Clock](https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/clock/clock.hpp): `include/simulator/clock/clock.hpp`
- [Event Types](https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/events/event.hpp): `include/simulator/events/event.hpp`
- [Core Types](https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/types/enums.hpp): `include/simulator/types/enums.hpp`

### Order Management

- [Order Pool](https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/order_pool.cpp): `src/orders/order_pool.cpp`
- [Order](https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/order.cpp): `src/orders/order.cpp`
- [Order Book](https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/order_book.cpp): `src/orders/order_book.cpp`
- [Price Levels](https://github.com/jaskaransingh-01/chronos/blob/master/src/orders/price_level.cpp): `src/orders/price_level.cpp`

### Matching

- [Matching Engine](https://github.com/jaskaransingh-01/chronos/blob/master/src/matching/matching_engine.cpp): `src/matching/matching_engine.cpp`
- [Trade](https://github.com/jaskaransingh-01/chronos/blob/master/include/simulator/matching/trade.hpp): `include/simulator/matching/trade.hpp`

### Other components

- **User**
- [Application Entry](https://github.com/jaskaransingh-01/chronos/blob/master/app/main.cpp): `app/main.cpp`

## Connections

- User → Application Entry: starts
- Application Entry → Simulation Clock: uses (evidence: `app/main.cpp`)
- Application Entry → Event Types: uses (evidence: `app/main.cpp`)
- Replay Engine → Simulator: dispatches events
- Replay Engine → Replay CSV Reader: reads events
- Replay CSV Reader → Replay Events: produces
- Message Reader → Byte Reader: reads bytes
- ITCH Decoder → Byte Reader: decodes bytes (evidence: `src/itch/itch_decoder.cpp`)
- ITCH Normalizer → Replay Events: normalizes to
- Simulator → Simulation Clock: advances
- Simulator → Order Pool: allocates orders
- Simulator → Matching Engine: submits orders
- Order Pool → Order: manages
- Order Book → Order: tracks
- Order Book → Price Levels: organizes by price
- Matching Engine → Order Book: matches against
- Matching Engine → Trade: records trades
- Order → Core Types: uses fields
- Replay Events → Core Types: uses fields (evidence: `include/simulator/replay/replay_event.hpp`)
