OnixS C++ CME MDP Premium Market Data Handler  5.8.9
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.
39 {
40  /// Returns null order id.
41  static OrderId nullId()
42  {
43  return 18446744073709551615ul;
44  }
45 
46  /// Returns null order priority.
48  {
49  return 18446744073709551615ul;
50  }
51 
52  /// Returns mantissa of the null price.
53  static Int64 nullPriceMantissa()
54  {
55  return 9223372036854775807l;
56  }
57 
58  /// Returns mantissa of the null price.
59  static bool nullPrice(const Decimal& price)
60  {
61  return (price.mantissa() == nullPriceMantissa());
62  }
63 
64  /// Returns null display quantity.
66  {
67  return 2147483647;
68  }
69 };
70 
71 /// Order as the member of the Market By Order (MBO) book.
73 {
74 public:
75  /// Initializes blank/null instance.
77  : id_(OrderTraits::nullId())
78  , priority_(OrderTraits::nullPriority())
79  , price_(OrderTraits::nullPriceMantissa(), 0)
80  , quantity_(OrderTraits::nullQuantity())
81  {
82  }
83 
84  /// Initializes instance according to given values.
85  Order(OrderId id, OrderPriority priority, const Decimal& price, DisplayQuantity quantity)
86  : id_(id)
87  , priority_(priority)
88  , price_(price)
89  , quantity_(quantity)
90  {
91  }
92 
93  /// Order identifier.
94  OrderId id() const
95  {
96  return id_;
97  }
98 
99  /// Updates order identifier.
100  void id(OrderId id)
101  {
102  id_ = id;
103  }
104 
105  /// Order priority.
107  {
108  return priority_;
109  }
110 
111  /// Updates order priority.
112  void priority(OrderPriority priority)
113  {
114  priority_ = priority;
115  }
116 
117  /// Order price.
118  const Decimal& price() const
119  {
120  return price_;
121  }
122 
123  /// Updates order price.
124  void price(const Decimal& price)
125  {
126  price_ = price;
127  }
128 
129  /// Display quantity.
131  {
132  return quantity_;
133  }
134 
135  /// Updates display quantity.
136  void quantity(DisplayQuantity quantity)
137  {
138  quantity_ = quantity;
139  }
140 
141 protected:
144 
147 };
148 
149 /// Appends representation of order to given string.
151 void toStr(std::string&, const Order&);
152 
153 /// Returns string representation of the order.
154 inline std::string toStr(const Order& order)
155 {
156  std::string str;
157 
158  toStr(str, order);
159 
160  return str;
161 }
162 
void price(const Decimal &price)
Updates order price.
Definition: Order.h:124
static bool nullPrice(const Decimal &price)
Returns mantissa of the null price.
Definition: Order.h:59
Order(OrderId id, OrderPriority priority, const Decimal &price, DisplayQuantity quantity)
Initializes instance according to given values.
Definition: Order.h:85
Int32 Int32
int32.
Definition: Fields.h:60
void quantity(DisplayQuantity quantity)
Updates display quantity.
Definition: Order.h:136
Order()
Initializes blank/null instance.
Definition: Order.h:76
DisplayQuantity quantity_
Definition: Order.h:146
OrderPriority priority_
Definition: Order.h:143
Order as the member of the Market By Order (MBO) book.
Definition: Order.h:72
Some basic traits for the order.
Definition: Order.h:38
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
const Decimal & price() const
Order price.
Definition: Order.h:118
Int32 DisplayQuantity
Presents display quantity.
Definition: Order.h:35
Mantissa mantissa() const
Returns mantissa of given decimal.
Definition: Decimal.h:176
OrderPriority priority() const
Order priority.
Definition: Order.h:106
UInt64 UInt64
uInt64.
Definition: Fields.h:195
static OrderPriority nullPriority()
Returns null order priority.
Definition: Order.h:47
void priority(OrderPriority priority)
Updates order priority.
Definition: Order.h:112
A real number with floating exponent.
Definition: Decimal.h:136
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
OrderId id() const
Order identifier.
Definition: Order.h:94
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:160
static OrderId nullId()
Returns null order id.
Definition: Order.h:41
std::string toStr(const Order &order)
Returns string representation of the order.
Definition: Order.h:154
static DisplayQuantity nullQuantity()
Returns null display quantity.
Definition: Order.h:65
UInt64 OrderId
Type for order identification.
Definition: Order.h:29
static Int64 nullPriceMantissa()
Returns mantissa of the null price.
Definition: Order.h:53
void id(OrderId id)
Updates order identifier.
Definition: Order.h:100
UInt64 OrderPriority
Type for order priority.
Definition: Order.h:32
DisplayQuantity quantity() const
Display quantity.
Definition: Order.h:130
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68