OnixS C++ SGX Titan ITCH Market Data Handler  1.2.2
API documentation
AddOrderMsg.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  /// An Add Order Message indicates that a new order
29  /// has been accepted by the Trading system and was
30  /// added to the displayable book.
31  struct ONIXS_SGXTITAN_ITCH_API AddOrderMsg : public IncomingMessage
32  {
33  /// Nanoseconds portion of the timestamp
34  UInt32 nanoseconds() const
35  {
36  return ordinary<UInt32>(1);
37  }
38 
39  /// The identifier assigned to the new order
40  OrderId orderId() const
41  {
42  return ordinary<UInt64>(5);
43  }
44 
45  /// The Order Book ID
47  {
48  return ordinary<UInt32>(13);
49  }
50 
51  /// The type of order being added
52  Side::Enum side() const
54  {
55  return enumeration<Side>(17);
56  }
57 
58  /// Rank within the Order Book
59  UInt32 orderBookPosition() const
60  {
61  return ordinary<UInt32>(18);
62  }
63 
64  /// The visible quantity of the order
66  {
67  return ordinary<UInt64>(22);
68  }
69 
70  /// The display price of the new order
71  Price price() const
72  {
73  return Price(ordinary<Int32>(30));
74  }
75 
76  /// Additional order attributes, values: 0 = Not
77  /// applicable, 8192 = Bait / implied order
78  UInt16 orderAttributes() const
79  {
80  return ordinary<UInt16>(34);
81  }
82 
83  /// Lot Type
86  {
87  return enumeration<LotType>(36);
88  }
89 
90  /// Total message size.
92 
93  /// Check the given size.
94  static void validateSize(MessageSize size)
95  {
96  if(size < messageSize_)
97  throwIncorrectSize("AddOrderMsg", size, messageSize_);
98  }
99 
100  /// Initializes instance over given memory block.
101  AddOrderMsg(const void* data, MessageSize size)
103  : IncomingMessage(data, size)
104  {
105  }
106  };
107 
108  /// Serializes object into string.
109  ONIXS_SGXTITAN_ITCH_API void toStr(std::string&, const AddOrderMsg&);
110 
111  /// Serializes object into string.
112  inline std::string toStr(const AddOrderMsg& msg)
113  {
114  std::string str;
115  toStr(str, msg);
116  return str;
117  }
118 
119  ///
120  inline std::ostream& operator<<(std::ostream& stream, const AddOrderMsg& msg)
121  {
122  stream << toStr(msg);
123  return stream;
124  }
125 
126 ONIXS_SGXTITAN_ITCH_NAMESPACE_END
UInt64 OrderId
Alias for OrderId type.
Definition: Defines.h:40
#define ONIXS_SGXTITAN_ITCH_CONST_OR_CONSTEXPR
Definition: Compiler.h:46
Side::Enum side() const
The type of order being added.
Definition: AddOrderMsg.h:52
UInt32 nanoseconds() const
Nanoseconds portion of the timestamp.
Definition: AddOrderMsg.h:34
Price price() const
The display price of the new order.
Definition: AddOrderMsg.h:71
#define ONIXS_SGXTITAN_ITCH_NOTHROW
Definition: Compiler.h:27
UInt64 Quantity
Alias for Quantity type.
Definition: Defines.h:46
UInt32 OrderBookId
Alias for Security Id type.
Definition: Defines.h:43
LotType::Enum lotType() const
Lot Type.
Definition: AddOrderMsg.h:84
IncomingMessage(const void *data, MessageSize size)
UInt16 MessageSize
Aliases message length type.
Definition: Defines.h:34
AddOrderMsg(const void *data, MessageSize size)
Initializes instance over given memory block.
Definition: AddOrderMsg.h:101
OrderId orderId() const
The identifier assigned to the new order.
Definition: AddOrderMsg.h:40
ONIXS_SGXTITAN_ITCH_API void toStr(std::string &, MessageType::Enum)
Appends string presentation of object.
ONIXS_SGXTITAN_ITCH_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
static void validateSize(MessageSize size)
Check the given size.
Definition: AddOrderMsg.h:94
OrderBookId orderBookId() const
The Order Book ID.
Definition: AddOrderMsg.h:46
ONIXS_SGXTITAN_ITCH_API void throwIncorrectSize(const std::string &messageName, MessageSize receivedSize, MessageSize expectedSize)
Quantity quantity() const
The visible quantity of the order.
Definition: AddOrderMsg.h:65
UInt32 orderBookPosition() const
Rank within the Order Book.
Definition: AddOrderMsg.h:59