18 #ifndef DATA_FEED_HANDLERS_CSV_HPP
19 #define DATA_FEED_HANDLERS_CSV_HPP
21 #include "data_feed/receiver.hpp"
37 inline void print_header() {
62 << header.sequence <<
","
86 CSV(std::ostream& stream_ = std::cout) : stream(stream_) { print_header(); }
96 stream <<
",0,0,0,0,0" << std::endl;
107 stream <<
",1,1,1,1,1" << std::endl;
116 std::cerr <<
"CSV::did_receive() - clear message" << std::endl;
131 stream <<
"," << !is_buy <<
"," << is_buy <<
",0,0,0" << std::endl;
145 stream <<
",0,0,1,0,0" << std::endl;
161 stream <<
",0,0,0," << !is_buy <<
"," << is_buy << std::endl;
169 #endif // DATA_FEED_HANDLERS_CSV_HPP
void did_receive(Receiver< CSV > *receiver, const Messages::StartOfSession &message)
Handle a start of session message.
Definition: csv.hpp:93
A multi-cast receiver for recreating a LOB::LimitOrderBook from network messages.
Definition: receiver.hpp:36
A message that indicates a market order matches with a limit order.
Definition: messages.hpp:387
Price last_best_sell() const
Return the last best sell price.
Definition: limit_order_book.hpp:262
A Receiver handler that writes LOB::LimitOrderBook event data in csv format.
Definition: csv.hpp:31
A message that indicates a limit order was added to the book.
Definition: messages.hpp:332
const LOB::LimitOrderBook & get_book()
Return the limit order book for this receiver.
Definition: receiver.hpp:214
const Header header
the message header that defines the template ID and length of message
Definition: messages.hpp:389
A message that indicates the end of a trading session.
Definition: messages.hpp:506
A message that indicates to clear all orders in the order book.
Definition: messages.hpp:213
void did_receive(Receiver< CSV > *receiver, const Messages::DeleteOrder &message)
Handle a delete order message.
Definition: csv.hpp:139
An order book for managing Limit / Order objects in a continuous double auction.
Definition: limit_order_book.hpp:41
A message that indicates the start of a trading session.
Definition: messages.hpp:460
void did_receive(Receiver< CSV > *receiver, const Messages::Clear &message)
Handle a clear book message.
Definition: csv.hpp:115
TimeStamp get_time()
Return the time in nanoseconds as a 64-bit unsigned integer (Timestamp).
Definition: clock.hpp:36
const Header header
the message header that defines the template ID and length of message
Definition: messages.hpp:261
CSV(std::ostream &stream_=std::cout)
Initialize a new data feed CSV handler.
Definition: csv.hpp:86
Logic for sending and receiving messages on a financial data feed.
Definition: heartbeat.hpp:28
constexpr bool side_to_bool(Side side)
Convert an order side character to a boolean value.
Definition: messages.hpp:71
void did_receive(Receiver< CSV > *receiver, const Messages::AddOrder &message)
Handle an add order message.
Definition: csv.hpp:124
bool is_session_active() const
Return whether the trading session is active.
Definition: receiver.hpp:220
void did_receive(Receiver< CSV > *receiver, const Messages::EndOfSession &message)
Handle an end of session message.
Definition: csv.hpp:104
const Side side
the side of the market order
Definition: messages.hpp:397
const Header header
the message header that defines the template ID and length of message
Definition: messages.hpp:508
Price last_best_buy() const
Return the last best buy price.
Definition: limit_order_book.hpp:268
Volume volume_buy(Price price) const
Return the total volume for the buy side of the book.
Definition: limit_order_book.hpp:310
void did_receive(Receiver< CSV > *receiver, const Messages::Trade &message)
Handle a trade message.
Definition: csv.hpp:154
Count count_buy() const
Return the total number of orders on the buy-side of the book.
Definition: limit_order_book.hpp:348
const Header header
the message header that defines the template ID and length of message
Definition: messages.hpp:334
Count count_sell() const
Return the total number of orders on the sell-side of the book.
Definition: limit_order_book.hpp:345
Volume volume_sell(Price price) const
Return the total volume for the sell side of the book.
Definition: limit_order_book.hpp:292
const Header header
the message header that defines the template ID and length of message
Definition: messages.hpp:462
A message that indicates a limit order was added to the book.
Definition: messages.hpp:259
const Side side
the side of the order
Definition: messages.hpp:269