# tharun-maheswararao/itch_feed_handler architecture

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

- Interactive diagram: https://gitdiagram.com/tharun-maheswararao/itch_feed_handler
- Repository: https://github.com/tharun-maheswararao/itch_feed_handler

## Overview

This is a C++ Nasdaq TotalView-ITCH 5.0 feed-replay and order-book benchmarking tool. Its main workflow maps a feed file, parses ITCH messages, transfers decoded messages through a selectable queue, updates an order book, and reports latency and run statistics. Verification compares the optimized book with a golden model; optional live snapshots and synthetic-feed generation are additional capabilities. The graph follows documented and indexed references; unsampled implementation details are not inferred.

Main entry points: [`include/fh/pipeline.hpp`](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/pipeline.hpp) (Replay pipeline), [`src/main.cpp`](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/main.cpp) (Replay CLI), [`include/fh/book/fast_book.hpp`](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/fast_book.hpp) (Fast book), [`include/fh/book/golden_book.hpp`](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/golden_book.hpp) (Golden book)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_replay["Replay pipeline"]
  node_cli["Replay CLI<br/>[main.cpp]"]
  node_mapped["Mapped feed<br/>[mapped_file.hpp]"]
  node_parser["ITCH parser<br/>[parser.hpp]"]
  node_pipeline["Replay pipeline<br/>[pipeline.hpp]"]
end

subgraph group_books["Order books"]
  node_fast["Fast book<br/>[fast_book.hpp]"]
  node_golden["Golden book<br/>[golden_book.hpp]"]
  node_book_common["Book model types<br/>[book_common.hpp]"]
  node_comparison["Book comparison<br/>[compare.hpp]"]
end

subgraph group_observe["Metrics and view"]
  node_clock["Latency clock<br/>[clock.hpp]"]
  node_histogram["Latency histogram<br/>[histogram.hpp]"]
  node_report["Run reports<br/>[report.cpp]"]
  node_sysinfo["System information<br/>[sysinfo.cpp]"]
  node_snapshot["Book snapshot<br/>[snapshot.hpp]"]
  node_seqlock["Snapshot synchronization<br/>[seqlock.hpp]"]
  node_live_view["Live book view<br/>[live_view.cpp]"]
end

subgraph group_support["Feed and queue support"]
  node_queue_select["Queue selection<br/>[queue_kinds.hpp]"]
  node_spsc["SPSC ring<br/>[spsc_queue.hpp]"]
  node_message["Decoded message<br/>[message.hpp]"]
  node_writer["Synthetic feed writer<br/>[itch_writer.hpp]"]
end

node_operator(("Operator"))

node_operator -->|"runs commands"| node_cli
node_cli -->|"maps feed"| node_mapped
node_cli -->|"runs replay"| node_pipeline
node_pipeline -->|"parses messages"| node_parser
node_parser -->|"decodes to"| node_message
node_pipeline -.->|"selects queue"| node_queue_select
node_queue_select -->|"dispatches to"| node_spsc
node_pipeline -->|"transfers messages"| node_spsc
node_pipeline -->|"updates book"| node_fast
node_pipeline -.->|"runs reference"| node_golden
node_cli -->|"selects book"| node_fast
node_cli -->|"runs verification"| node_golden
node_cli -->|"compares books"| node_comparison
node_fast -->|"uses shared types"| node_book_common
node_golden -->|"uses shared types"| node_book_common
node_cli -->|"generates feed"| node_writer
node_pipeline -->|"stamps messages"| node_clock
node_pipeline -->|"records latency"| node_histogram
node_cli -->|"writes results"| node_report
node_report -->|"reads system data"| node_sysinfo
node_pipeline -->|"builds snapshot"| node_snapshot
node_pipeline -->|"publishes snapshot"| node_seqlock
node_live_view -->|"reads snapshots"| node_seqlock
node_live_view -->|"renders book data"| node_snapshot

click node_cli "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/main.cpp"
click node_mapped "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/parser/mapped_file.hpp"
click node_parser "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/parser/parser.hpp"
click node_pipeline "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/pipeline.hpp"
click node_queue_select "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/queue/queue_kinds.hpp"
click node_spsc "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/queue/spsc_queue.hpp"
click node_message "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/parser/message.hpp"
click node_fast "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/fast_book.hpp"
click node_golden "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/golden_book.hpp"
click node_book_common "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/book_common.hpp"
click node_comparison "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/compare.hpp"
click node_writer "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/testing/itch_writer.hpp"
click node_clock "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/stats/clock.hpp"
click node_histogram "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/stats/histogram.hpp"
click node_report "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/report.cpp"
click node_sysinfo "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/sysinfo.cpp"
click node_snapshot "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/view/snapshot.hpp"
click node_seqlock "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/view/seqlock.hpp"
click node_live_view "https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/live_view.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_cli,node_mapped,node_parser,node_pipeline toneBlue
class node_fast,node_golden,node_book_common,node_comparison toneAmber
class node_clock,node_histogram,node_report,node_sysinfo,node_snapshot,node_seqlock,node_live_view toneMint
class node_queue_select,node_spsc,node_message,node_writer toneRose
class node_operator toneIndigo
```

## Components

### Replay pipeline

- [Replay CLI](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/main.cpp): `src/main.cpp`
- [Mapped feed](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/parser/mapped_file.hpp): `include/fh/parser/mapped_file.hpp`
- [ITCH parser](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/parser/parser.hpp): `include/fh/parser/parser.hpp`
- [Replay pipeline](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/pipeline.hpp): `include/fh/pipeline.hpp`

### Order books

- [Fast book](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/fast_book.hpp): `include/fh/book/fast_book.hpp`
- [Golden book](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/golden_book.hpp): `include/fh/book/golden_book.hpp`
- [Book model types](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/book_common.hpp): `include/fh/book/book_common.hpp`
- [Book comparison](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/book/compare.hpp): `include/fh/book/compare.hpp`

### Metrics and view

- [Latency clock](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/stats/clock.hpp): `include/fh/stats/clock.hpp`
- [Latency histogram](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/stats/histogram.hpp): `include/fh/stats/histogram.hpp`
- [Run reports](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/report.cpp): `src/report.cpp`
- [System information](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/sysinfo.cpp): `src/sysinfo.cpp`
- [Book snapshot](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/view/snapshot.hpp): `include/fh/view/snapshot.hpp`
- [Snapshot synchronization](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/view/seqlock.hpp): `include/fh/view/seqlock.hpp`
- [Live book view](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/src/live_view.cpp): `src/live_view.cpp`

### Feed and queue support

- [Queue selection](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/queue/queue_kinds.hpp): `include/fh/queue/queue_kinds.hpp`
- [SPSC ring](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/queue/spsc_queue.hpp): `include/fh/queue/spsc_queue.hpp`
- [Decoded message](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/parser/message.hpp): `include/fh/parser/message.hpp`
- [Synthetic feed writer](https://github.com/tharun-maheswararao/itch_feed_handler/blob/main/include/fh/testing/itch_writer.hpp): `include/fh/testing/itch_writer.hpp`

### Other components

- **Operator**

## Connections

- Operator → Replay CLI: runs commands (evidence: `README.md`)
- Replay CLI → Mapped feed: maps feed (evidence: `src/main.cpp`)
- Replay CLI → Replay pipeline: runs replay (evidence: `src/main.cpp`)
- Replay pipeline → ITCH parser: parses messages (evidence: `include/fh/pipeline.hpp`)
- ITCH parser → Decoded message: decodes to (evidence: `include/fh/parser/parser.hpp`)
- Replay pipeline → Queue selection: selects queue
- Queue selection → SPSC ring: dispatches to (evidence: `include/fh/queue/queue_kinds.hpp`)
- Replay pipeline → SPSC ring: transfers messages (evidence: `include/fh/pipeline.hpp`)
- Replay pipeline → Fast book: updates book (evidence: `include/fh/pipeline.hpp`)
- Replay pipeline → Golden book: runs reference
- Replay CLI → Fast book: selects book (evidence: `src/main.cpp`)
- Replay CLI → Golden book: runs verification (evidence: `src/main.cpp`)
- Replay CLI → Book comparison: compares books (evidence: `src/main.cpp`)
- Fast book → Book model types: uses shared types (evidence: `include/fh/book/fast_book.hpp`)
- Golden book → Book model types: uses shared types (evidence: `include/fh/book/golden_book.hpp`)
- Replay CLI → Synthetic feed writer: generates feed (evidence: `src/main.cpp`)
- Replay pipeline → Latency clock: stamps messages (evidence: `include/fh/pipeline.hpp`)
- Replay pipeline → Latency histogram: records latency (evidence: `include/fh/pipeline.hpp`)
- Replay CLI → Run reports: writes results (evidence: `src/main.cpp`)
- Run reports → System information: reads system data (evidence: `src/report.cpp`)
- Replay pipeline → Book snapshot: builds snapshot (evidence: `include/fh/pipeline.hpp`)
- Replay pipeline → Snapshot synchronization: publishes snapshot (evidence: `include/fh/pipeline.hpp`)
- Live book view → Snapshot synchronization: reads snapshots (evidence: `src/live_view.cpp`)
- Live book view → Book snapshot: renders book data (evidence: `src/live_view.cpp`)
