|
ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
|
Fluent interface wrapper for ITCH 5.0 Session event handling. More...
Fluent interface wrapper for ITCH 5.0 Session event handling.
This class provides an object-oriented, type-safe, and fluent API for registering event handlers with an ITCH 5.0 Session. It simplifies the process of attaching listeners for various market data events such as orders, trades, and book updates.
The fluent interface allows method chaining, making it easy to register multiple handlers in a single expression. All handler methods return a reference to *this, enabling the builder pattern.
#include <nasdaq/itch50/SessionHandlers.h>
Public Types | |
| using | SystemEventHandler = std::function<void(Session*, const Instrument*, Seqnum, const SystemEvent*)> |
| Handler for system event messages (trading hours, end of day, etc.). | |
| using | OrderBookStateHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderBookState*)> |
| Handler for order book state changes (halt, resume, etc.). | |
| using | OrderbookDirectoryHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderbookDirectory*)> |
| Handler for orderbook directory messages (instrument definitions). | |
| using | AddOrderHandler = std::function<void(Session*, const Instrument*, Seqnum, const AddOrder*)> |
| Handler for new order additions to the order book. | |
| using | OrderExecutedHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderExecuted*, const Instrument::Order*)> |
| Handler for order executions (with match price from original order). | |
| using | OrderExecutedWithPriceHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderExecutedWithPrice*, const Instrument::Order*)> |
| Handler for order executions with explicit execution price. | |
| using | OrderCancelHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderCancelMessage*, const Instrument::Order*)> |
| Handler for order cancellations. | |
| using | OrderReplaceHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderReplace*, const Instrument::Order*)> |
| Handler for order replacements (ITCH 5.0 feature). | |
| using | TradeHandler = std::function<void(Session*, const Instrument*, Seqnum, const Trade*)> |
| Handler for non-displayed trade executions. | |
| using | ExecutionDoneHandler = std::function<void(Session*, const Instrument*, Seqnum, const ExecutionDone*)> |
| Handler for execution completion notifications. | |
| using | InformationHandler = std::function<void(Session*, const Instrument*, Seqnum, const Information*)> |
| Handler for informational messages (prices, yields, etc.). | |
| using | BrokenTradeHandler = std::function<void(Session*, const Instrument*, Seqnum, const BrokenTrade*)> |
| Handler for trade bust/cancellation messages. | |
| using | BookLevelUpdateHandler = std::function<void(Session*, const Instrument*, Session::Timestamp, const Instrument::BookLevelUpdate&)> |
| Handler for aggregated order book level updates. | |
| using | EndOfPacketHandler = std::function<void(Session*)> |
| Handler for end-of-packet notifications. | |
| using | DirectoryWithoutInstrumentHandler = std::function<void(Session*, Seqnum, const OrderbookDirectory*)> |
| Handler for directory messages when no instrument is created. | |
| using | SessionEventHandler = std::function<void(Session*, Event)> |
| Handler for session lifecycle events. | |
Public Member Functions | |
| SessionHandlers & | on_system_event (SystemEventHandler handler) |
| Register a handler for system event messages. | |
| SessionHandlers & | on_order_book_state (OrderBookStateHandler handler) |
| Register a handler for order book state messages. | |
| SessionHandlers & | on_orderbook_directory (OrderbookDirectoryHandler handler) |
| Register a handler for orderbook directory messages. | |
| SessionHandlers & | on_add_order (AddOrderHandler handler) |
| Register a handler for add order messages. | |
| SessionHandlers & | on_order_executed (OrderExecutedHandler handler) |
| Register a handler for order executed messages. | |
| SessionHandlers & | on_order_executed_with_price (OrderExecutedWithPriceHandler handler) |
| Register a handler for order executed with price messages. | |
| SessionHandlers & | on_order_cancel (OrderCancelHandler handler) |
| Register a handler for order cancel messages. | |
| SessionHandlers & | on_order_replace (OrderReplaceHandler handler) |
| Register a handler for order replace messages (ITCH 5.0). | |
| SessionHandlers & | on_trade (TradeHandler handler) |
| Register a handler for non-displayed trade messages. | |
| SessionHandlers & | on_execution_done (ExecutionDoneHandler handler) |
| Register a handler for execution done messages. | |
| SessionHandlers & | on_information (InformationHandler handler) |
| Register a handler for information messages. | |
| SessionHandlers & | on_broken_trade (BrokenTradeHandler handler) |
| Register a handler for broken trade messages. | |
| SessionHandlers & | on_book_update (BookLevelUpdateHandler handler) |
| Register a handler for aggregated order book level updates. | |
| SessionHandlers & | on_end_of_packet (EndOfPacketHandler handler) |
| Register a handler for end-of-packet notifications. | |
| SessionHandlers & | on_directory_without_instrument (DirectoryWithoutInstrumentHandler handler) |
| Register a handler for directory messages without instrument creation. | |
| SessionHandlers & | on_session_event (SessionEventHandler handler) |
| Register a handler for session lifecycle events. | |
| template<typename... Args> | |
| void | operator() (Args &&... args) |
| Function call operator for Delegate compatibility. | |
| using b2bits::nasdaq::itch50::SessionHandlers::AddOrderHandler = std::function<void(Session*, const Instrument*, Seqnum, const AddOrder*)> |
Handler for new order additions to the order book.
| using b2bits::nasdaq::itch50::SessionHandlers::BookLevelUpdateHandler = std::function<void(Session*, const Instrument*, Session::Timestamp, const Instrument::BookLevelUpdate&)> |
Handler for aggregated order book level updates.
| using b2bits::nasdaq::itch50::SessionHandlers::BrokenTradeHandler = std::function<void(Session*, const Instrument*, Seqnum, const BrokenTrade*)> |
Handler for trade bust/cancellation messages.
| using b2bits::nasdaq::itch50::SessionHandlers::DirectoryWithoutInstrumentHandler = std::function<void(Session*, Seqnum, const OrderbookDirectory*)> |
Handler for directory messages when no instrument is created.
| using b2bits::nasdaq::itch50::SessionHandlers::EndOfPacketHandler = std::function<void(Session*)> |
Handler for end-of-packet notifications.
| using b2bits::nasdaq::itch50::SessionHandlers::ExecutionDoneHandler = std::function<void(Session*, const Instrument*, Seqnum, const ExecutionDone*)> |
Handler for execution completion notifications.
| using b2bits::nasdaq::itch50::SessionHandlers::InformationHandler = std::function<void(Session*, const Instrument*, Seqnum, const Information*)> |
Handler for informational messages (prices, yields, etc.).
| using b2bits::nasdaq::itch50::SessionHandlers::OrderbookDirectoryHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderbookDirectory*)> |
Handler for orderbook directory messages (instrument definitions).
| using b2bits::nasdaq::itch50::SessionHandlers::OrderBookStateHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderBookState*)> |
Handler for order book state changes (halt, resume, etc.).
| using b2bits::nasdaq::itch50::SessionHandlers::OrderCancelHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderCancelMessage*, const Instrument::Order*)> |
Handler for order cancellations.
| using b2bits::nasdaq::itch50::SessionHandlers::OrderExecutedHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderExecuted*, const Instrument::Order*)> |
Handler for order executions (with match price from original order).
| using b2bits::nasdaq::itch50::SessionHandlers::OrderExecutedWithPriceHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderExecutedWithPrice*, const Instrument::Order*)> |
Handler for order executions with explicit execution price.
| using b2bits::nasdaq::itch50::SessionHandlers::OrderReplaceHandler = std::function<void(Session*, const Instrument*, Seqnum, const OrderReplace*, const Instrument::Order*)> |
Handler for order replacements (ITCH 5.0 feature).
| using b2bits::nasdaq::itch50::SessionHandlers::SessionEventHandler = std::function<void(Session*, Event)> |
Handler for session lifecycle events.
| using b2bits::nasdaq::itch50::SessionHandlers::SystemEventHandler = std::function<void(Session*, const Instrument*, Seqnum, const SystemEvent*)> |
Handler for system event messages (trading hours, end of day, etc.).
| using b2bits::nasdaq::itch50::SessionHandlers::TradeHandler = std::function<void(Session*, const Instrument*, Seqnum, const Trade*)> |
Handler for non-displayed trade executions.
|
inline |
Register a handler for add order messages.
Add order messages indicate new limit or market orders being added to the order book. Includes order reference number, side, quantity, price, and ITCH 5.0 attributes (order type, time-in-force).
| handler | Callback function to handle new orders |
|
inline |
Register a handler for aggregated order book level updates.
Book level update messages provide aggregated price level information for the order book. These are generated when aggregated mode is enabled and reflect changes to specific price levels (bid/ask depth).
| handler | Callback function to handle book updates |
|
inline |
Register a handler for broken trade messages.
Broken trade messages indicate that a previously reported trade has been cancelled or busted. This typically occurs when a trade is determined to be erroneous.
| handler | Callback function to handle broken trades |
|
inline |
Register a handler for directory messages without instrument creation.
Called when a directory message is received but no instrument object is created (typically due to filtering or configuration). Allows observing all instruments even if not actively tracking them.
| handler | Callback function to handle untracked directory messages |
|
inline |
Register a handler for end-of-packet notifications.
End-of-packet notifications mark the completion of processing a MoldUDP64 packet. Useful for batching operations or flushing buffers after processing a group of messages.
| handler | Callback function to handle end-of-packet events |
|
inline |
Register a handler for execution done messages.
Execution done messages mark the completion of a trade execution, indicating that no further messages will be sent for this transaction ID.
| handler | Callback function to handle execution completions |
|
inline |
Register a handler for information messages.
Information messages provide supplementary data about instruments such as indicative prices, yields, or other market information.
| handler | Callback function to handle information messages |
|
inline |
Register a handler for order book state messages.
Order book state messages indicate halts, resumes, and other state changes for specific instruments.
| handler | Callback function to handle order book state changes |
|
inline |
Register a handler for order cancel messages.
Order cancel messages indicate that an order has been partially or fully cancelled. The handler receives the updated order state after cancellation.
| handler | Callback function to handle order cancellations |
|
inline |
Register a handler for order executed messages.
Order executed messages indicate that an existing order has been executed. The execution price is the price from the original order. The handler also receives the updated order state.
| handler | Callback function to handle order executions |
|
inline |
Register a handler for order executed with price messages.
Similar to order executed, but includes an explicit execution price that may differ from the original order price. Used for executions at prices other than the order's limit price.
| handler | Callback function to handle executions with explicit price |
|
inline |
Register a handler for order replace messages (ITCH 5.0).
Order replace messages indicate that an existing order has been replaced with a new order (different reference number). The old order is implicitly cancelled and a new order is created with potentially different price, quantity, and attributes.
| handler | Callback function to handle order replacements |
|
inline |
Register a handler for orderbook directory messages.
Directory messages provide instrument definitions including symbol, CUSIP, product type, trading features, and other instrument characteristics.
| handler | Callback function to handle directory messages |
|
inline |
Register a handler for session lifecycle events.
Session events indicate changes in the session state such as connecting, connected, disconnecting, login accepted/rejected, recovery, etc.
| handler | Callback function to handle session events |
|
inline |
Register a handler for system event messages.
System events indicate changes in trading state such as start/end of trading hours, start/end of market maker trading, and end of day messages.
| handler | Callback function to handle system events |
|
inline |
Register a handler for non-displayed trade messages.
Trade messages indicate executions that are not associated with displayed orders in the order book. These are typically crosses or other non-displayed trading activity.
| handler | Callback function to handle trades |
|
inline |
Function call operator for Delegate compatibility.
This templated operator() enables the SessionHandlers object to be used as a listener with the Session's Delegate mechanism. It uses compile-time type matching to dispatch incoming events to the appropriate registered handler.
The dispatcher uses constexpr if to determine the argument types and route the call to the corresponding handler function. Only registered (non-null) handlers are invoked.
| Args | Variadic template for event arguments |
| args | Perfect-forwarded event arguments |