OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
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
26
27#include <string>
28
30
33
36
39
42{
46 static constexpr OrderId nullId() noexcept
47 {
48 return 18446744073709551615ul;
49 }
50
54 static constexpr OrderPriority nullPriority() noexcept
55 {
56 return 18446744073709551615ul;
57 }
58
62 static constexpr Messaging::Int64 nullPriceMantissa() noexcept
63 {
64 return 9223372036854775807l;
65 }
66
73 static bool nullPrice(const Messaging::Decimal& price) noexcept
74 {
75 return (price.mantissa() == nullPriceMantissa());
76 }
77
81 static constexpr DisplayQuantity nullQuantity() noexcept
82 {
83 return 2147483647;
84 }
85};
86
92{
93public:
95 constexpr Order() noexcept = default;
96
102 constexpr Order(OrderId id, OrderPriority priority, const Messaging::Decimal& price, DisplayQuantity quantity) noexcept
103 : id_(id)
105 , price_(price)
107 {
108 }
109
113 constexpr OrderId id() const noexcept
114 {
115 return id_;
116 }
117
120 void id(OrderId id) noexcept
121 {
122 id_ = id;
123 }
124
128 constexpr OrderPriority priority() const noexcept
129 {
130 return priority_;
131 }
132
136 {
138 }
139
143 constexpr const Messaging::Decimal& price() const noexcept
144 {
145 return price_;
146 }
147
150 void price(const Messaging::Decimal& price) noexcept
151 {
152 price_ = price;
153 }
154
158 constexpr DisplayQuantity quantity() const noexcept
159 {
160 return quantity_;
161 }
162
166 {
168 }
169
170protected:
173
176};
177
186void toStr(std::string& str, const Order& order);
187
193inline ONIXS_CMEMDH_NODISCARD std::string toStr(const Order& order)
194{
195 std::string str;
196
197 toStr(str, order);
198
199 return str;
200}
201
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:69
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:61
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:73
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:163
#define ONIXS_CMEMDH_NODISCARD
Definition Compiler.h:165
Represents an order in a Market By Order (MBO) book.
Definition Order.h:92
DisplayQuantity quantity_
Definition Order.h:175
void quantity(DisplayQuantity quantity) noexcept
Sets the displayed quantity.
Definition Order.h:165
OrderPriority priority_
Definition Order.h:172
constexpr OrderId id() const noexcept
Gets the order identifier.
Definition Order.h:113
void price(const Messaging::Decimal &price) noexcept
Sets the order price.
Definition Order.h:150
constexpr Order() noexcept=default
Constructs an order with all attributes set to their null values.
constexpr OrderPriority priority() const noexcept
Gets the matching priority.
Definition Order.h:128
void id(OrderId id) noexcept
Sets the order identifier.
Definition Order.h:120
void priority(OrderPriority priority) noexcept
Sets the matching priority.
Definition Order.h:135
Messaging::Decimal price_
Definition Order.h:174
constexpr const Messaging::Decimal & price() const noexcept
Gets the order price.
Definition Order.h:143
constexpr DisplayQuantity quantity() const noexcept
Gets the displayed quantity.
Definition Order.h:158
std::int32_t Int32
int32.
Definition Integral.h:34
FloatingPointDecimal< DecimalMantissa, DecimalExponent > Decimal
Universal decimal type.
std::uint64_t UInt64
uInt64.
Definition Integral.h:37
Messaging::UInt64 OrderPriority
Represents an order's matching priority.
Definition Order.h:35
Messaging::UInt64 OrderId
Identifies an order in a Market By Order book.
Definition Order.h:32
void toStr(std::string &str, BookState::Enum bookState)
Appends a string representation of a book state.
Messaging::Int32 DisplayQuantity
Represents the displayed quantity of an order.
Definition Order.h:38
Provides the null values used for absent order attributes.
Definition Order.h:42
static constexpr OrderPriority nullPriority() noexcept
Gets the null order priority.
Definition Order.h:54
static constexpr DisplayQuantity nullQuantity() noexcept
Gets the null displayed quantity.
Definition Order.h:81
static constexpr OrderId nullId() noexcept
Gets the null order identifier.
Definition Order.h:46
static bool nullPrice(const Messaging::Decimal &price) noexcept
Checks whether a price has the null-price mantissa.
Definition Order.h:73
static constexpr Messaging::Int64 nullPriceMantissa() noexcept
Gets the mantissa used to represent a null price.
Definition Order.h:62