ITCHCPP 1.6.1
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
Loading...
Searching...
No Matches
itch::io::CsvSink Class Reference

Writes parsed ITCH messages to a CSV stream as a flat, normalized table. More...

#include <csv_sink.hpp>

+ Inheritance diagram for itch::io::CsvSink:

Public Member Functions

 CsvSink (std::ostream &out, bool write_header=true)
 Constructs a sink writing to out, emitting the header row unless write_header is false (useful when appending to an existing file).
 
auto write (const Message &message) -> void override
 Writes one message as a CSV row.
 
auto flush () -> void override
 Flushes the underlying stream.
 
auto rows_written () const noexcept -> std::uint64_t
 The number of rows written so far.
 
- Public Member Functions inherited from itch::io::MessageSink
 MessageSink ()=default
 Default-constructs an empty sink.
 
 MessageSink (const MessageSink &)=default
 Copy-constructs a sink.
 
 MessageSink (MessageSink &&) noexcept=default
 Move-constructs a sink.
 
auto operator= (const MessageSink &) -> MessageSink &=default
 Copy-assigns a sink.
 
auto operator= (MessageSink &&) noexcept -> MessageSink &=default
 Move-assigns a sink.
 
virtual ~MessageSink ()=default
 Virtual destructor for safe polymorphic destruction.
 

Detailed Description

Writes parsed ITCH messages to a CSV stream as a flat, normalized table.

ITCH messages are heterogeneous, so the sink flattens them into one wide row schema sharing the common header plus the most frequently used per-type fields. Fields a given message does not carry are left blank. This is the universal, dependency-free output for quick inspection and legacy tooling; for columnar analytics use the Arrow/Parquet exporter instead.

Columns: message_type,timestamp,stock_locate,tracking_number,symbol, reference_number,side,shares,price,match_number,printable,extra.

Definition at line 30 of file csv_sink.hpp.

Constructor & Destructor Documentation

◆ CsvSink()

itch::io::CsvSink::CsvSink ( std::ostream &  out,
bool  write_header = true 
)
explicit

Constructs a sink writing to out, emitting the header row unless write_header is false (useful when appending to an existing file).

Parameters
outOutput stream the CSV rows are written to.
write_headerWhether to emit the CSV header row on construction.

Definition at line 115 of file csv_sink.cpp.

Member Function Documentation

◆ write()

auto itch::io::CsvSink::write ( const Message message) -> void
overridevirtual

Writes one message as a CSV row.

Parameters
messageThe parsed message to write.

Implements itch::io::MessageSink.

Definition at line 122 of file csv_sink.cpp.

◆ flush()

auto itch::io::CsvSink::flush ( ) -> void
overridevirtual

Flushes the underlying stream.

Reimplemented from itch::io::MessageSink.

Definition at line 142 of file csv_sink.cpp.

◆ rows_written()

auto itch::io::CsvSink::rows_written ( ) const -> std::uint64_t
inlinenoexcept

The number of rows written so far.

Returns
The count of rows written since construction.

Definition at line 50 of file csv_sink.hpp.


The documentation for this class was generated from the following files: