|
ITCHCPP 1.6.0
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
|
Manages the state of a limit order book for a specific financial instrument. More...
#include <order_book.hpp>
Public Types | |
| using | BidMap = std::map< uint32_t, PriceLevel, std::greater< uint32_t > > |
| using | AskMap = std::map< uint32_t, PriceLevel, std::less< uint32_t > > |
Public Member Functions | |
| LimitOrderBook (const std::string &stock_symbol) | |
| Constructs an order book scoped to a single stock symbol. | |
| auto | process (const Message &message) -> void |
| Dispatches and processes a generic ITCH message. | |
| auto | print (std::ostream &out, unsigned int delay_ms=0) const -> void |
| Visualizes the current state of the order book to an output stream. | |
| auto | get_bids () const -> const BidMap & |
| The map of active Bids. | |
| auto | get_asks () const -> const AskMap & |
| The map of active Asks. | |
Public Attributes | |
| const std::set< char > | book_messages {'A', 'F', 'E', 'C', 'X', 'D', 'U'} |
| Set of message type characters that affect the book state. | |
Manages the state of a limit order book for a specific financial instrument.
The LimitOrderBook ingests raw Nasdaq ITCH 5.0 messages and reconstructs the full depth of market. It supports standard order lifecycle events including addition, execution, cancellation, deletion, and replacement.
std::map for price levels to ensure keys (prices) are always sorted, allowing for O(log n) insertion and deletion of price levels, and O(1) access to the best bid/ask. Definition at line 90 of file order_book.hpp.
| using itch::LimitOrderBook::BidMap = std::map<uint32_t, PriceLevel, std::greater<uint32_t> > |
Definition at line 116 of file order_book.hpp.
| using itch::LimitOrderBook::AskMap = std::map<uint32_t, PriceLevel, std::less<uint32_t> > |
Definition at line 117 of file order_book.hpp.
|
inline |
Constructs an order book scoped to a single stock symbol.
| stock_symbol | The symbol of the instrument this book tracks; only messages for this symbol affect the book state. |
Definition at line 96 of file order_book.hpp.
| auto itch::LimitOrderBook::process | ( | const Message & | message | ) | -> void |
Dispatches and processes a generic ITCH message.
Identifies the specific type within the Message variant and routes it to the appropriate internal handler to update the book state.
| message | The parsed ITCH message variant. |
Definition at line 22 of file order_book.cpp.
| auto itch::LimitOrderBook::print | ( | std::ostream & | out, |
| unsigned int | delay_ms = 0 |
||
| ) | const -> void |
Visualizes the current state of the order book to an output stream.
Prints the best Ask and Bid levels formatted in a table.
| out | The output stream (e.g., std::cout) to write to. |
| delay_ms | Optional delay in milliseconds between printing each line. Useful for slowing down output during debugging or replays to create an animation effect. Defaults to 0 (no delay). |
Definition at line 34 of file order_book.cpp.
References itch::make_price(), and side.
|
inline |
The map of active Bids.
Definition at line 122 of file order_book.hpp.
|
inline |
The map of active Asks.
Definition at line 127 of file order_book.hpp.
| const std::set<char> itch::LimitOrderBook::book_messages {'A', 'F', 'E', 'C', 'X', 'D', 'U'} |
Set of message type characters that affect the book state.
Definition at line 130 of file order_book.hpp.