OnixS C++ SGX Titan ITCH Market Data Handler  1.2.2
API documentation
TradeMsg.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
25 
26 ONIXS_SGXTITAN_ITCH_NAMESPACE_BEGIN
27 
28  /// The Trade Message is designed to provide execution
29  /// details for normal match events involving non-
30  /// displayable order types.
31  struct ONIXS_SGXTITAN_ITCH_API TradeMsg : public IncomingMessage
32  {
33  /// Nanoseconds portion of the timestamp
34  UInt32 nanoseconds() const
35  {
36  return ordinary<UInt32>(1);
37  }
38 
39  /// Assigned by the system to each match executed
40  UInt64 matchId() const
41  {
42  return ordinary<UInt64>(5);
43  }
44 
45  /// Used to group Combination Order Book executions
46  /// and the trades in the constituent Order Books
47  /// together
48  UInt32 comboGroupId() const
49  {
50  return ordinary<UInt32>(13);
51  }
52 
53  /// The type of non-display on the book being matched
56  {
57  return enumeration<TradeSide>(17);
58  }
59 
60  /// The quantity being matched in this execution
62  {
63  return ordinary<UInt64>(18);
64  }
65 
66  /// The Order Book ID
68  {
69  return ordinary<UInt32>(26);
70  }
71 
72  /// Trade Price
73  Price tradePrice() const
74  {
75  return Price(ordinary<Int32>(30));
76  }
77 
78  ///
79  StrRef reserved1() const
81  {
82  return fixedStr<7>(34);
83  }
84 
85  ///
86  StrRef reserved2() const
88  {
89  return fixedStr<7>(41);
90  }
91 
92  /// Indicates if the trade should be included in trade
93  /// tickers and volume calculations
96  {
97  return enumeration<Printable>(48);
98  }
99 
100  /// Occurred at Cross
103  {
104  return enumeration<OccurredAtCross>(49);
105  }
106 
107  /// Total message size.
109 
110  /// Check the given size.
111  static void validateSize(MessageSize size)
112  {
113  if(size < messageSize_)
114  throwIncorrectSize("TradeMsg", size, messageSize_);
115  }
116 
117  /// Initializes instance over given memory block.
118  TradeMsg(const void* data, MessageSize size)
120  : IncomingMessage(data, size)
121  {
122  }
123  };
124 
125  /// Serializes object into string.
126  ONIXS_SGXTITAN_ITCH_API void toStr(std::string&, const TradeMsg&);
127 
128  /// Serializes object into string.
129  inline std::string toStr(const TradeMsg& msg)
130  {
131  std::string str;
132  toStr(str, msg);
133  return str;
134  }
135 
136  ///
137  inline std::ostream& operator<<(std::ostream& stream, const TradeMsg& msg)
138  {
139  stream << toStr(msg);
140  return stream;
141  }
142 
143 ONIXS_SGXTITAN_ITCH_NAMESPACE_END
UInt32 nanoseconds() const
Nanoseconds portion of the timestamp.
Definition: TradeMsg.h:34
#define ONIXS_SGXTITAN_ITCH_CONST_OR_CONSTEXPR
Definition: Compiler.h:46
Price tradePrice() const
Trade Price.
Definition: TradeMsg.h:73
OccurredAtCross::Enum occurredAtCross() const
Occurred at Cross.
Definition: TradeMsg.h:101
TradeSide::Enum side() const
The type of non-display on the book being matched.
Definition: TradeMsg.h:54
#define ONIXS_SGXTITAN_ITCH_NOTHROW
Definition: Compiler.h:27
UInt64 Quantity
Alias for Quantity type.
Definition: Defines.h:46
static void validateSize(MessageSize size)
Check the given size.
Definition: TradeMsg.h:111
UInt32 OrderBookId
Alias for Security Id type.
Definition: Defines.h:43
IncomingMessage(const void *data, MessageSize size)
UInt16 MessageSize
Aliases message length type.
Definition: Defines.h:34
UInt64 matchId() const
Assigned by the system to each match executed.
Definition: TradeMsg.h:40
OrderBookId orderBookId() const
The Order Book ID.
Definition: TradeMsg.h:67
ONIXS_SGXTITAN_ITCH_API void toStr(std::string &, MessageType::Enum)
Appends string presentation of object.
TradeMsg(const void *data, MessageSize size)
Initializes instance over given memory block.
Definition: TradeMsg.h:118
ONIXS_SGXTITAN_ITCH_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
Printable::Enum printable() const
Definition: TradeMsg.h:94
ONIXS_SGXTITAN_ITCH_API void throwIncorrectSize(const std::string &messageName, MessageSize receivedSize, MessageSize expectedSize)
Quantity quantity() const
The quantity being matched in this execution.
Definition: TradeMsg.h:61
Provides efficient way of accessing text-based FIX field values.
Definition: String.h:40