17#include <unordered_map>
53 {
'O',
"Opening Cross"},
54 {
'C',
"Closing Cross"},
55 {
'H',
"Cross for halted/paused security"},
56 {
'I',
"Intraday/IPO Cross"},
58 return types.
at_or(cross_type,
"Unknown");
75 m_callback = std::move(callback);
83 if (
const auto* noii = std::get_if<NOIIMessage>(&message)) {
87 if (
const auto* cross = std::get_if<CrossTradeMessage>(&message)) {
90 auction.stock_locate = cross->stock_locate;
92 auction.cross_type = cross->cross_type;
94 auction.cross_shares = cross->shares;
96 const auto iter = m_latest_imbalance.find(cross->stock_locate);
97 if (iter != m_latest_imbalance.end()) {
98 auction.paired_shares = iter->second.paired_shares;
99 auction.imbalance_shares = iter->second.imbalance_shares;
100 auction.imbalance_direction = iter->second.imbalance_direction;
101 auction.had_imbalance =
true;
111 std::unordered_map<std::uint16_t, ImbalanceInfo> m_latest_imbalance;
Reconstructs auctions from the NOII and Cross Trade message stream.
auto process(const Message &message) -> void
Processes one ITCH message, emitting an auction on each cross.
auto set_auction_callback(AuctionCallback callback) -> void
Installs the callback invoked for each reconstructed auction.
std::function< void(const Auction &)> AuctionCallback
An immutable, compile-time lookup table from a key to a description.
constexpr auto at_or(const KeyType &key, std::string_view fallback) const noexcept -> std::string_view
Returns the description for a key, or a fallback if absent.
Decoded view of Net Order Imbalance Indicator (NOII) messages.
Compile-time lookup tables translating ITCH single- and multi-character indicator codes into human-re...
Defines every ITCH 5.0 message struct, the Message variant, and the stream-printing helpers used to f...
auto cross_type_name(char cross_type) -> std::string_view
A human-readable description of a cross type code.
auto make_imbalance_info(const NOIIMessage &msg) -> ImbalanceInfo
Builds an ImbalanceInfo from a raw NOII message.
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.
auto to_string(const char *source, size_t size) -> std::string
Converts a fixed-width character array to a string, trimming trailing spaces and NUL characters.
Strongly typed, fixed-point price representation for ITCH price fields.
A reconstructed auction (cross) event.
std::uint16_t stock_locate
std::uint64_t cross_shares
Shares executed in the cross.
std::uint64_t paired_shares
Paired shares from the latest NOII.
std::uint64_t imbalance_shares
Imbalance shares from the latest NOII.
bool had_imbalance
Whether NOII context was available.
StandardPrice cross_price
The cross execution price.
char cross_type
'O' open, 'C' close, 'H' halt/pause, 'I' IPO.