ITCHCPP 1.6.0
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
Loading...
Searching...
No Matches
itch::book::BookManager Class Reference

Maintains a full-market set of order books from a single pass over the feed. More...

#include <book_manager.hpp>

Public Types

using BboCallback = std::function< void(const L3Book &book, const Bbo &bbo)>
 Invoked when a book's best bid or offer changes.
 

Public Member Functions

 BookManager ()=default
 Constructs an empty manager with no books tracked yet.
 
auto process (const Message &message) -> void
 Processes one parsed ITCH message, updating the relevant book and emitting BBO/trade events as appropriate.
 
auto set_bbo_callback (BboCallback callback) -> void
 Installs the best-bid/offer change callback (empty clears it).
 
auto set_trade_callback (TradeCallback callback) -> void
 Installs the trade-tape callback (empty clears it).
 
auto track_symbol (std::string symbol) -> void
 Restricts tracking to the given symbol (call once per symbol).
 
auto book (std::uint16_t stock_locate) const -> const L3Book *
 The book for a locate code, or nullptr if none is tracked.
 
auto book_for_symbol (std::string_view symbol) const -> const L3Book *
 The book for a symbol, or nullptr if none is tracked.
 
auto book_count () const noexcept -> std::size_t
 The number of books currently maintained.
 
auto symbol_for_locate (std::uint16_t stock_locate) const -> std::string_view
 The symbol associated with a locate code (empty if unknown).
 

Detailed Description

Maintains a full-market set of order books from a single pass over the feed.

Every order, execution, cancel, delete, and replace message carries a stock locate code; the manager routes each message to that security's L3Book in O(1) through a flat, locate-indexed table, reconstructing every symbol on the feed at once rather than a single pre-selected one. It optionally restricts work to a chosen universe of symbols, emits best-bid/offer change events as they happen, and extracts the trade tape.

Definition at line 37 of file book_manager.hpp.

Member Typedef Documentation

◆ BboCallback

using itch::book::BookManager::BboCallback = std::function<void(const L3Book& book, const Bbo& bbo)>

Invoked when a book's best bid or offer changes.

Definition at line 40 of file book_manager.hpp.

Constructor & Destructor Documentation

◆ BookManager()

itch::book::BookManager::BookManager ( )
default

Constructs an empty manager with no books tracked yet.

Member Function Documentation

◆ process()

auto itch::book::BookManager::process ( const Message message) -> void

Processes one parsed ITCH message, updating the relevant book and emitting BBO/trade events as appropriate.

Parameters
messageThe parsed ITCH message to apply.

Definition at line 183 of file book_manager.cpp.

◆ set_bbo_callback()

auto itch::book::BookManager::set_bbo_callback ( BboCallback  callback) -> void
inline

Installs the best-bid/offer change callback (empty clears it).

Parameters
callbackInvoked whenever a tracked book's best bid or offer changes.

Definition at line 53 of file book_manager.hpp.

◆ set_trade_callback()

auto itch::book::BookManager::set_trade_callback ( TradeCallback  callback) -> void
inline

Installs the trade-tape callback (empty clears it).

Parameters
callbackInvoked for each trade extracted from the feed.

Definition at line 57 of file book_manager.hpp.

◆ track_symbol()

auto itch::book::BookManager::track_symbol ( std::string  symbol) -> void
inline

Restricts tracking to the given symbol (call once per symbol).

When no symbol is added, every symbol on the feed is tracked.

Parameters
symbolThe ticker symbol to add to the tracked universe.

Definition at line 64 of file book_manager.hpp.

References symbol.

◆ book()

auto itch::book::BookManager::book ( std::uint16_t  stock_locate) const -> const L3Book*

The book for a locate code, or nullptr if none is tracked.

Parameters
stock_locateThe exchange-assigned stock locate code.
Returns
Pointer to the book for stock_locate, or nullptr if it is not tracked.

Definition at line 211 of file book_manager.cpp.

References stock_locate.

◆ book_for_symbol()

auto itch::book::BookManager::book_for_symbol ( std::string_view  symbol) const -> const L3Book*

The book for a symbol, or nullptr if none is tracked.

Parameters
symbolThe ticker symbol to look up.
Returns
Pointer to the book for symbol, or nullptr if it is not tracked.

Definition at line 216 of file book_manager.cpp.

References symbol.

◆ book_count()

auto itch::book::BookManager::book_count ( ) const -> std::size_t
inlinenoexcept

The number of books currently maintained.

Returns
The count of books currently tracked.

Definition at line 80 of file book_manager.hpp.

◆ symbol_for_locate()

auto itch::book::BookManager::symbol_for_locate ( std::uint16_t  stock_locate) const -> std::string_view

The symbol associated with a locate code (empty if unknown).

Parameters
stock_locateThe exchange-assigned stock locate code.
Returns
The ticker symbol for stock_locate, or an empty view if unknown.

Definition at line 225 of file book_manager.cpp.

References stock_locate, and itch::book::L3Book::symbol().


The documentation for this class was generated from the following files: