OnixS C++ CME Market Data Handler  5.4.0
API documentation
Order.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <OnixS/CME/MDH/Decimal.h>
25 
27 
28 /// Type for order identification.
29 typedef UInt64 OrderId;
30 
31 /// Type for order priority.
33 
34 /// Presents display quantity.
36 
37 /// Some basic traits for the order.
40 {
41  /// Returns null order id.
42  static OrderId nullId()
43  {
44  return 18446744073709551615ul;
45  }
46 
47  /// Returns null order priority.
49  {
50  return 18446744073709551615ul;
51  }
52 
53  /// Returns mantissa of the null price.
54  static Int64 nullPriceMantissa()
55  {
56  return 9223372036854775807l;
57  }
58 
59  /// Returns mantissa of the null price.
60  static
61  bool
63  const Decimal& price)
64  {
65  return (
66  price.mantissa() ==
67  nullPriceMantissa()
68  );
69  }
70 
71  /// Returns null display quantity.
73  {
74  return 2147483647;
75  }
76 };
77 
78 /// Order as the member of the Market By Order (MBO) book.
80 {
81 protected:
84 
87 
88 public:
89  /// Initializes blank/null instance.
91  : id_(
92  OrderTraits::nullId())
93  , priority_(
94  OrderTraits::nullPriority())
95  , price_(
96  OrderTraits::nullPriceMantissa(),
97  0)
98  , quantity_(
99  OrderTraits::nullQuantity())
100  {
101  }
102 
103  /// Initializes instance according to given values.
105  OrderId id,
106  OrderPriority priority,
107  const Decimal& price,
108  DisplayQuantity quantity)
109  : id_(id)
110  , priority_(priority)
111  , price_(price)
112  , quantity_(quantity)
113  {
114  }
115 
116  /// Order identifier.
117  OrderId id() const
118  {
119  return id_;
120  }
121 
122  /// Updates order identifier.
123  void
124  id(
125  OrderId id)
126  {
127  id_ = id;
128  }
129 
130  /// Order priority.
132  {
133  return priority_;
134  }
135 
136  /// Updates order priority.
137  void
139  OrderPriority priority)
140  {
141  priority_ = priority;
142  }
143 
144  /// Order price.
145  const Decimal& price() const
146  {
147  return price_;
148  }
149 
150  /// Updates order price.
151  void
153  const Decimal& price)
154  {
155  price_ = price;
156  }
157 
158  /// Display quantity.
160  {
161  return quantity_;
162  }
163 
164  /// Updates display quantity.
165  void
167  DisplayQuantity quantity)
168  {
169  quantity_ = quantity;
170  }
171 };
172 
173 /// Appends representation of order to given string.
174 ONIXS_CMEMDH_EXPORTED
175 void
176 toStr(
177  std::string&,
178  const Order&);
179 
180 /// Returns string representation of the order.
181 inline
182 std::string
184  const Order& order)
185 {
186  std::string str;
187 
188  toStr(str, order);
189 
190  return str;
191 }
192 
void price(const Decimal &price)
Updates order price.
Definition: Order.h:152
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:94
static bool nullPrice(const Decimal &price)
Returns mantissa of the null price.
Definition: Order.h:62
Order(OrderId id, OrderPriority priority, const Decimal &price, DisplayQuantity quantity)
Initializes instance according to given values.
Definition: Order.h:104
Int32 Int32
int32.
Definition: Fields.h:69
void quantity(DisplayQuantity quantity)
Updates display quantity.
Definition: Order.h:166
Order()
Initializes blank/null instance.
Definition: Order.h:90
DisplayQuantity quantity_
Definition: Order.h:86
OrderPriority priority_
Definition: Order.h:83
Order as the member of the Market By Order (MBO) book.
Definition: Order.h:79
Some basic traits for the order.
Definition: Order.h:38
const Decimal & price() const
Order price.
Definition: Order.h:145
Int32 DisplayQuantity
Presents display quantity.
Definition: Order.h:35
Mantissa mantissa() const
Returns mantissa of given decimal.
Definition: Decimal.h:290
OrderPriority priority() const
Order priority.
Definition: Order.h:131
UInt64 UInt64
uInt64.
Definition: Fields.h:251
static OrderPriority nullPriority()
Returns null order priority.
Definition: Order.h:48
#define ONIXS_CMEMDH_LTWT_STRUCT
Definition: Bootstrap.h:98
void priority(OrderPriority priority)
Updates order priority.
Definition: Order.h:138
A real number with floating exponent.
Definition: Decimal.h:231
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
OrderId id() const
Order identifier.
Definition: Order.h:117
static OrderId nullId()
Returns null order id.
Definition: Order.h:42
std::string toStr(const Order &order)
Returns string representation of the order.
Definition: Order.h:183
static DisplayQuantity nullQuantity()
Returns null display quantity.
Definition: Order.h:72
UInt64 OrderId
Type for order identification.
Definition: Order.h:29
static Int64 nullPriceMantissa()
Returns mantissa of the null price.
Definition: Order.h:54
void id(OrderId id)
Updates order identifier.
Definition: Order.h:124
UInt64 OrderPriority
Type for order priority.
Definition: Order.h:32
DisplayQuantity quantity() const
Display quantity.
Definition: Order.h:159
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156