JayBeams  0.1
Another project to have fun coding.
trade_message.hpp
Go to the documentation of this file.
1 #ifndef jb_itch5_trade_message_hpp
2 #define jb_itch5_trade_message_hpp
3 
8 
9 namespace jb {
10 namespace itch5 {
11 
12 /**
13  * Represent an 'Trade (non-Cross)' message in the ITCH-5.0 protocol.
14  */
15 struct trade_message {
16  constexpr static int message_type = u'P';
17 
19  std::uint64_t order_reference_number;
21  int shares;
24  std::uint64_t match_number;
25 };
26 
27 /// Specialize decoder for a jb::itch5::trade_message
28 template <bool V>
29 struct decoder<V, trade_message> {
30  /// Please see the generic documentation for jb::itch5::decoder<>::r()
31  static trade_message r(std::size_t size, void const* buf, std::size_t off) {
32  trade_message x;
33  x.header = decoder<V, message_header>::r(size, buf, off + 0);
35  decoder<V, std::uint64_t>::r(size, buf, off + 11);
37  decoder<V, buy_sell_indicator_t>::r(size, buf, off + 19);
38  x.shares = decoder<V, std::uint32_t>::r(size, buf, off + 20);
39  x.stock = decoder<V, stock_t>::r(size, buf, off + 24);
40  x.price = decoder<V, price4_t>::r(size, buf, off + 32);
41  x.match_number = decoder<V, std::uint64_t>::r(size, buf, off + 36);
42  return x;
43  }
44 };
45 
46 /// Streaming operator for jb::itch5::trade_message.
47 std::ostream& operator<<(std::ostream& os, trade_message const& x);
48 
49 } // namespace itch5
50 } // namespace jb
51 
52 #endif // jb_itch5_trade_message_hpp
Define the header common to all ITCH 5.0 messages.
static T r(std::size_t size, void const *msg, std::size_t offset)
Read a single message or field.
static constexpr int message_type
Define the interface to decode ITCH-5.0 messages and message fields.
Definition: decoder.hpp:24
std::uint64_t order_reference_number
Represent an &#39;Trade (non-Cross)&#39; message in the ITCH-5.0 protocol.
std::ostream & operator<<(std::ostream &os, add_order_message const &x)
Streaming operator for jb::itch5::add_order_message.
static trade_message r(std::size_t size, void const *buf, std::size_t off)
Please see the generic documentation for jb::itch5::decoder<>::r()
buy_sell_indicator_t buy_sell_indicator
The top-level namespace for the JayBeams library.
Definition: as_hhmmss.hpp:7