495inline auto to_string(
const char* source,
size_t size) -> std::string {
497 while (len > 0 && (source[len - 1] ==
' ' || source[len - 1] ==
'\0')) {
500 return std::string {source, len};
513auto print_impl(std::ostream& out,
const SystemEventMessage& msg) -> void;
514auto print_impl(std::ostream& out,
const StockDirectoryMessage& msg) -> void;
515auto print_impl(std::ostream& out,
const StockTradingActionMessage& msg) -> void;
516auto print_impl(std::ostream& out,
const RegSHOMessage& msg) -> void;
517auto print_impl(std::ostream& out,
const MarketParticipantPositionMessage& msg) -> void;
518auto print_impl(std::ostream& out,
const MWCBDeclineLevelMessage& msg) -> void;
519auto print_impl(std::ostream& out,
const MWCBStatusMessage& msg) -> void;
520auto print_impl(std::ostream& out,
const IPOQuotingPeriodUpdateMessage& msg) -> void;
521auto print_impl(std::ostream& out,
const LULDAuctionCollarMessage& msg) -> void;
522auto print_impl(std::ostream& out,
const OperationalHaltMessage& msg) -> void;
523auto print_impl(std::ostream& out,
const AddOrderMessage& msg) -> void;
524auto print_impl(std::ostream& out,
const AddOrderMPIDAttributionMessage& msg) -> void;
525auto print_impl(std::ostream& out,
const OrderExecutedMessage& msg) -> void;
526auto print_impl(std::ostream& out,
const OrderExecutedWithPriceMessage& msg) -> void;
527auto print_impl(std::ostream& out,
const OrderCancelMessage& msg) -> void;
528auto print_impl(std::ostream& out,
const OrderDeleteMessage& msg) -> void;
529auto print_impl(std::ostream& out,
const OrderReplaceMessage& msg) -> void;
530auto print_impl(std::ostream& out,
const NonCrossTradeMessage& msg) -> void;
531auto print_impl(std::ostream& out,
const CrossTradeMessage& msg) -> void;
532auto print_impl(std::ostream& out,
const BrokenTradeMessage& msg) -> void;
533auto print_impl(std::ostream& out,
const NOIIMessage& msg) -> void;
534auto print_impl(std::ostream& out,
const RetailPriceImprovementIndicatorMessage& msg) -> void;
535auto print_impl(std::ostream& out,
const DLCRMessage& msg) -> void;
constexpr double PRICE_DIVISOR
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 print_message(std::ostream &out, const Message &msg) -> void
Dispatches to the print_impl overload matching the active alternative of msg and writes its formatted...
auto operator<<(std::ostream &out, const Message &msg) -> std::ostream &
Streams a formatted representation of msg to out.
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.
constexpr double MWCB_PRICE_DIVISOR
auto print_impl(std::ostream &out, const SystemEventMessage &msg) -> void
Per-message-type stream formatter family, used internally by print_message to dispatch to the correct...
Add Order, With MPID Attribution (F): like Add Order, but attributed to a market participant.
uint16_t stock_locate
Locate code identifying the security.
char buy_sell_indicator
'B' buy, 'S' sell.
uint32_t shares
Displayed share quantity.
char stock[8]
Stock symbol, right padded with spaces.
uint64_t order_reference_number
Day-unique reference number for the order.
uint64_t timestamp
Nanoseconds past midnight.
uint16_t tracking_number
Nasdaq internal tracking number.
uint32_t price
Display price (4 implied decimals).
char message_type
Always 'F'.
char attribution[4]
Market participant identifier (MPID).
Add Order, No MPID Attribution (A): a new displayable order has been accepted and placed on the book.
uint16_t tracking_number
Nasdaq internal tracking number.
uint16_t stock_locate
Locate code identifying the security.
uint64_t order_reference_number
Day-unique reference number for the order.
uint32_t shares
Displayed share quantity.
char message_type
Always 'A'.
uint32_t price
Display price (4 implied decimals).
uint64_t timestamp
Nanoseconds past midnight.
char stock[8]
Stock symbol, right padded with spaces.
char buy_sell_indicator
'B' buy, 'S' sell.
Broken Trade (B): a previously disseminated execution has been broken and should be removed from any ...
uint16_t stock_locate
Locate code identifying the security.
char message_type
Always 'B'.
uint64_t timestamp
Nanoseconds past midnight.
uint64_t match_number
Match number of the execution being broken.
uint16_t tracking_number
Nasdaq internal tracking number.
Cross Trade (Q): the result of a cross (opening, closing, halt/IPO cross) for a security.
char cross_type
'O' open, 'C' close, 'H' halt/IPO, 'I' intraday.
uint16_t stock_locate
Locate code identifying the security.
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t timestamp
Nanoseconds past midnight.
uint64_t shares
Number of shares matched in the cross.
char stock[8]
Stock symbol, right padded with spaces.
uint64_t match_number
Day-unique match number for the cross.
uint32_t cross_price
Price at which the cross executed (4 decimals).
char message_type
Always 'Q'.
Direct Listing with Capital Raise Price Discovery (O): price-discovery data for a Direct Listing with...
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t near_execution_time
Time of the anticipated cross (ns past midnight).
uint32_t minimum_allowable_price
Lowest allowable cross price (4 decimals).
char open_eligibility_status
Whether the security is eligible to open.
uint32_t lower_price_range_collar
Lower price range collar (4 decimals).
char stock[8]
Stock symbol, right padded with spaces.
uint32_t near_execution_price
Anticipated cross price (4 decimals).
uint32_t maximum_allowable_price
Highest allowable cross price (4 decimals).
uint32_t upper_price_range_collar
Upper price range collar (4 decimals).
uint64_t timestamp
Nanoseconds past midnight.
uint16_t stock_locate
Locate code identifying the security.
char message_type
Always 'O'.
IPO Quoting Period Update (K): the anticipated IPO quotation release time and price for a security.
char ipo_quotation_release_qualifier
'A' anticipated, 'C' cancelled/postponed.
char message_type
Always 'K'.
uint64_t timestamp
Nanoseconds past midnight.
uint32_t ipo_price
IPO price (4 implied decimals).
uint16_t tracking_number
Nasdaq internal tracking number.
uint32_t ipo_quotation_release_time
Seconds past midnight of the anticipated release.
char stock[8]
Stock symbol, right padded with spaces.
uint16_t stock_locate
Locate code identifying the security.
LULD Auction Collar (J): the auction collar thresholds for a security in a Limit-Up Limit-Down tradin...
uint32_t auction_collar_extension
Number of collar extensions so far.
uint64_t timestamp
Nanoseconds past midnight.
char message_type
Always 'J'.
uint16_t tracking_number
Nasdaq internal tracking number.
uint32_t lower_auction_collar_price
Lower auction collar price (4 decimals).
uint16_t stock_locate
Locate code identifying the security.
uint32_t auction_collar_reference_price
Reference price for the collars (4 decimals).
char stock[8]
Stock symbol, right padded with spaces.
uint32_t upper_auction_collar_price
Upper auction collar price (4 decimals).
MWCB Decline Level (V): the Market-Wide Circuit Breaker breach points for the day.
uint16_t stock_locate
Locate code; 0 for this market-wide message.
uint64_t level2
Level 2 (13%) breach value, 8 implied decimals.
uint64_t level1
Level 1 (5%) breach value, 8 implied decimals.
char message_type
Always 'V'.
uint64_t level3
Level 3 (20%) breach value, 8 implied decimals.
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t timestamp
Nanoseconds past midnight.
MWCB Status (W): notification that a Market-Wide Circuit Breaker level has been breached.
uint64_t timestamp
Nanoseconds past midnight.
uint16_t tracking_number
Nasdaq internal tracking number.
uint16_t stock_locate
Locate code; 0 for this market-wide message.
char message_type
Always 'W'.
char breached_level
'1', '2', or '3' for the level breached.
Market Participant Position (L): a market participant's (market maker's) status in a security.
char stock[8]
Stock symbol, right padded with spaces.
char primary_market_maker
'Y' if the primary market maker, else 'N'.
char market_maker_mode
Quotation mode (see indicators::MARKET_MAKER_MODE).
uint64_t timestamp
Nanoseconds past midnight.
uint16_t tracking_number
Nasdaq internal tracking number.
char message_type
Always 'L'.
char mpid[4]
Market participant identifier.
char market_participant_state
State (see indicators::MARKET_PARTICIPANT_STATE).
uint16_t stock_locate
Locate code identifying the security.
Net Order Imbalance Indicator (I): the imbalance and price-discovery data disseminated during the ope...
uint64_t imbalance_shares
Shares not paired (the imbalance).
char imbalance_direction
'B' buy, 'S' sell, 'N' none, 'O' insufficient, 'P' paused.
char cross_type
'O' open, 'C' close, 'H' halt/IPO cross.
char stock[8]
Stock symbol, right padded with spaces.
uint32_t current_reference_price
Price the cross would occur at now (4 decimals).
uint64_t timestamp
Nanoseconds past midnight.
uint16_t tracking_number
Nasdaq internal tracking number.
uint16_t stock_locate
Locate code identifying the security.
char price_variation_indicator
Variation band (see indicators::PRICE_VARIATION_INDICATOR).
char message_type
Always 'I'.
uint32_t far_price
Cross price using only eligible interest (4 decimals).
uint32_t near_price
Cross price using all interest (4 decimals).
uint64_t paired_shares
Shares paired at the current reference price.
Trade, Non-Cross (P): an execution of a non-displayable order.
uint16_t stock_locate
Locate code identifying the security.
uint32_t shares
Number of shares traded.
uint64_t order_reference_number
Reference number of the non-displayed order.
uint32_t price
Trade price (4 implied decimals).
char buy_sell_indicator
'B' buy, 'S' sell.
uint64_t timestamp
Nanoseconds past midnight.
char message_type
Always 'P'.
char stock[8]
Stock symbol, right padded with spaces.
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t match_number
Day-unique match number for the trade.
Operational Halt (h): an operational halt or resumption for a security on a specific market center.
char message_type
Always 'h'.
char operational_halt_action
'H' halted, 'T' resumed.
uint64_t timestamp
Nanoseconds past midnight.
uint16_t stock_locate
Locate code identifying the security.
char stock[8]
Stock symbol, right padded with spaces.
uint16_t tracking_number
Nasdaq internal tracking number.
char market_code
'Q' Nasdaq, 'B' BX, 'X' PSX.
Order Cancel (X): a partial cancellation reduced the shares of a resting order.
char message_type
Always 'X'.
uint16_t tracking_number
Nasdaq internal tracking number.
uint32_t cancelled_shares
Number of shares cancelled.
uint64_t timestamp
Nanoseconds past midnight.
uint16_t stock_locate
Locate code identifying the security.
uint64_t order_reference_number
Reference number of the cancelled order.
Order Delete (D): a resting order was cancelled in its entirety and removed from the book.
uint64_t order_reference_number
Reference number of the deleted order.
uint16_t tracking_number
Nasdaq internal tracking number.
uint16_t stock_locate
Locate code identifying the security.
uint64_t timestamp
Nanoseconds past midnight.
char message_type
Always 'D'.
Order Executed (E): a resting order was executed in whole or in part at its display price.
uint64_t match_number
Day-unique match number for the execution.
char message_type
Always 'E'.
uint16_t stock_locate
Locate code identifying the security.
uint32_t executed_shares
Number of shares executed.
uint64_t timestamp
Nanoseconds past midnight.
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t order_reference_number
Reference number of the executed order.
Order Executed With Price (C): a resting order was executed at a price different from its display pri...
uint16_t stock_locate
Locate code identifying the security.
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t timestamp
Nanoseconds past midnight.
uint64_t match_number
Day-unique match number for the execution.
char printable
'Y' if the trade is printable to the tape, else 'N'.
uint32_t execution_price
Price at which the order executed (4 decimals).
uint32_t executed_shares
Number of shares executed.
uint64_t order_reference_number
Reference number of the executed order.
char message_type
Always 'C'.
Order Replace (U): a resting order was replaced with a new order at a new reference number,...
uint64_t original_order_reference_number
Reference number being replaced.
uint32_t shares
New displayed share quantity.
char message_type
Always 'U'.
uint32_t price
New display price (4 implied decimals).
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t new_order_reference_number
New reference number for the order.
uint64_t timestamp
Nanoseconds past midnight.
uint16_t stock_locate
Locate code identifying the security.
Reg SHO Short Sale Price Test Restriction (Y): the Reg SHO short-sale restriction state for a securit...
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t timestamp
Nanoseconds past midnight.
char stock[8]
Stock symbol, right padded with spaces.
char reg_sho_action
'0' no restriction, '1' restriction in effect, '2' remains.
char message_type
Always 'Y'.
uint16_t stock_locate
Locate code identifying the security.
Retail Price Improvement Indicator (N): the presence of retail price improvement interest on the bid,...
char stock[8]
Stock symbol, right padded with spaces.
uint64_t timestamp
Nanoseconds past midnight.
uint16_t tracking_number
Nasdaq internal tracking number.
char interest_flag
'B' bid, 'A' ask, 'C' both, 'N' none.
char message_type
Always 'N'.
uint16_t stock_locate
Locate code identifying the security.
Stock Directory (R): the trading and listing reference data for a security, disseminated at the start...
char etp_flag
'Y' if an exchange-traded product, else 'N'.
uint64_t timestamp
Nanoseconds past midnight.
char stock[8]
Stock symbol, right padded with spaces.
char issue_classification
Security class (see indicators::ISSUE_CLASSIFICATION_VALUES).
char message_type
Always 'R'.
uint16_t tracking_number
Nasdaq internal tracking number.
uint32_t etp_leverage_factor
Leverage factor of the ETP (if applicable).
char issue_sub_type[2]
Security sub-type (see indicators::ISSUE_SUB_TYPE_VALUES).
char short_sale_threshold_indicator
Reg SHO threshold: 'Y','N',' '.
char ipo_flag
'Y' if a new IPO, 'N' if not, ' ' if not available.
char authenticity
'P' production / 'T' test security.
char financial_status_indicator
Financial status of the issuer.
char market_category
Listing market (see indicators::MARKET_CATEGORY).
char inverse_indicator
'Y' if the ETP is an inverse product.
char luld_ref
LULD reference price tier.
char round_lots_only
'Y' if only round lots may be entered, else 'N'.
uint16_t stock_locate
Locate code identifying the security.
uint32_t round_lot_size
Number of shares in a round lot.
Stock Trading Action (H): a change in the trading status of a security (halted, paused,...
uint64_t timestamp
Nanoseconds past midnight.
char reason[4]
Trading-action reason code (see indicators::TRADING_ACTION_REASON_CODES).
char trading_state
'H','P','Q','T' (see indicators::TRADING_STATES).
uint16_t tracking_number
Nasdaq internal tracking number.
uint16_t stock_locate
Locate code identifying the security.
char message_type
Always 'H'.
char stock[8]
Stock symbol, right padded with spaces.
System Event (S): signals a market or data-feed handler event.
char event_code
'O','S','Q','M','E','C' (see indicators::SYSTEM_EVENT_CODES).
uint16_t tracking_number
Nasdaq internal tracking number.
uint64_t timestamp
Nanoseconds past midnight.
char message_type
Always 'S'.
uint16_t stock_locate
Locate code; 0 for system-wide events.