19#include <unordered_set>
58 m_trade_callback = std::move(callback);
80 [[nodiscard]]
auto book_count() const noexcept -> std::
size_t {
return m_book_count; }
106 [[nodiscard]]
auto entry(std::uint16_t
stock_locate)
const -> BookEntry*;
110 auto emit_bbo_if_changed(BookEntry& target) -> void;
116 [[nodiscard]]
auto in_universe(std::string_view
symbol)
const -> bool;
122 template <
typename AddMessage>
123 auto handle_add_order(
const AddMessage& add) -> void;
128 auto handle_order_executed(
const OrderExecutedMessage& exec) -> void;
133 auto handle_order_executed_with_price(
const OrderExecutedWithPriceMessage& exec) -> void;
137 auto handle_order_cancel(
const OrderCancelMessage& cancel) -> void;
141 auto handle_order_delete(
const OrderDeleteMessage& del) -> void;
146 auto handle_order_replace(
const OrderReplaceMessage& replace) -> void;
151 auto handle_non_cross_trade(
const NonCrossTradeMessage& trade) -> void;
155 auto handle_cross_trade(
const CrossTradeMessage& cross) -> void;
160 auto handle_stock_directory(
const StockDirectoryMessage& directory) -> void;
162 std::vector<std::unique_ptr<BookEntry>> m_books_by_locate;
163 std::vector<std::string> m_symbol_by_locate;
164 std::unordered_set<std::string> m_universe;
167 std::size_t m_book_count {0};
Maintains a full-market set of order books from a single pass over the feed.
auto set_bbo_callback(BboCallback callback) -> void
Installs the best-bid/offer change callback (empty clears it).
auto process(const Message &message) -> void
Processes one parsed ITCH message, updating the relevant book and emitting BBO/trade events as approp...
std::function< void(const L3Book &book, const Bbo &bbo)> BboCallback
Invoked when a book's best bid or offer changes.
auto book_for_symbol(std::string_view symbol) const -> const L3Book *
The book for a symbol, or nullptr if none is tracked.
auto symbol_for_locate(std::uint16_t stock_locate) const -> std::string_view
The symbol associated with a locate code (empty if unknown).
auto book_count() const noexcept -> std::size_t
The number of books currently maintained.
BookManager()=default
Constructs an empty manager with no books tracked yet.
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).
A single-symbol, order-level (L3) limit order book with allocation-light internals.
std::uint16_t stock_locate
Single-symbol, order-level (L3) limit order book with allocation-light internals.
Defines every ITCH 5.0 message struct, the Message variant, and the stream-printing helpers used to f...
std::function< void(const Trade &)> TradeCallback
Callback invoked for each extracted trade.
std::variant< SystemEventMessage, StockDirectoryMessage, StockTradingActionMessage, RegSHOMessage, MarketParticipantPositionMessage, MWCBDeclineLevelMessage, MWCBStatusMessage, IPOQuotingPeriodUpdateMessage, LULDAuctionCollarMessage, OperationalHaltMessage, AddOrderMessage, AddOrderMPIDAttributionMessage, OrderExecutedMessage, OrderExecutedWithPriceMessage, OrderCancelMessage, OrderDeleteMessage, OrderReplaceMessage, NonCrossTradeMessage, CrossTradeMessage, BrokenTradeMessage, NOIIMessage, RetailPriceImprovementIndicatorMessage, DLCRMessage > Message
A variant able to hold any one of the ITCH 5.0 message structs.
Best bid and offer of a single book.
A normalized trade record and callback type for consuming the ITCH trade tape.