OnixS C++ CME MDP Conflated UDP Handler  1.1.2
API documentation
DirectPriceLevel.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 
24 
26 
27 /// Encapsulates price level concept.
30 {
31  // Indicates whether data is available.
32  bool exist_;
33 
34  // Price value for the level.
35  Decimal price_;
36 
37  // Quantity component.
38  Int64 qty_;
39 
40  // Number of orders.
41  Int32 ordersQty_;
42 
43 public:
44  /// Initializes undefined level.
46  : exist_(false)
47  , price_()
48  , qty_(0)
49  , ordersQty_(0)
50  {
51  }
52 
53  /// Initializes as copy of other level.
55  const DirectPriceLevel& other)
56  : exist_(other.exist_)
57  , price_(other.price_)
58  , qty_(other.qty_)
59  , ordersQty_(other.ordersQty_)
60  {
61  }
62 
63  /// Initializes defined level
64  /// according to specified attributes.
66  const Decimal& price,
67  Int32 qty,
68  Int32 ordersQty)
69  : exist_(true),
70  price_(price),
71  qty_(qty)
72  , ordersQty_(ordersQty)
73  {
74  }
75 
76  // Actually, does nothing.
78  {
79  }
80 
81  /// Identifies whether price level exist.
82  bool exist() const
83  {
84  return exist_;
85  }
86 
87  /// Updates existence status.
88  bool& exist()
89  {
90  return exist_;
91  }
92 
93  /// Price value.
94  ///
95  /// @note For CME Globex channels (market data groups)
96  /// value presents if price level exists. However, for
97  /// CME Partner Exchanges channels like BVMF price value
98  /// may be NULL in a valid (existent) price level.
99  ///
100  /// @see NullPRICE.
101  const Decimal& price() const
102  {
103  return price_;
104  }
105 
106  /// Price value.
108  {
109  return price_;
110  }
111 
112  /// Quantify for the given price.
113  Int64 quantity() const
114  {
115  return qty_;
116  }
117 
118  /// Quantify for the given price.
119  Int64& quantity()
120  {
121  return qty_;
122  }
123 
124  /// Updates total number of orders.
126  {
127  return ordersQty_;
128  }
129 
130  /// Total number of orders of given price.
132  {
133  return ordersQty_;
134  }
135 
136  /// Re-initializes as copy of other instance.
138  operator =(
139  const DirectPriceLevel& other)
140  {
141  price_ = other.price_;
142  qty_ = other.qty_;
143  exist_ = other.exist_;
144  ordersQty_ = other.ordersQty_;
145 
146  return *this;
147  }
148 };
149 
150 /// Serializes price level attributes into a string.
151 ONIXS_CONFLATEDUDP_EXPORTED
152 void
153 toStr(
154  std::string&,
155  const DirectPriceLevel&);
156 
157 /// Serializes price level attributes into a string.
158 inline
159 std::string
161  const DirectPriceLevel& priceLevel)
162 {
163  std::string str;
164 
165  toStr(str, priceLevel);
166 
167  return str;
168 }
169 
Int32 numberOfOrders() const
Total number of orders of given price.
A real number with floating exponent.
Definition: Decimal.h:231
DirectPriceLevel(const Decimal &price, Int32 qty, Int32 ordersQty)
Int32 & numberOfOrders()
Updates total number of orders.
Int32 Int32
int32.
Definition: Fields.h:69
bool & exist()
Updates existence status.
Encapsulates price level concept.
DirectPriceLevel(const DirectPriceLevel &other)
Initializes as copy of other level.
Int64 quantity() const
Quantify for the given price.
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition: Bootstrap.h:157
DirectPriceLevel()
Initializes undefined level.
bool exist() const
Identifies whether price level exist.
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition: Bootstrap.h:95
std::string toStr(const DirectPriceLevel &priceLevel)
Serializes price level attributes into a string.
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition: Bootstrap.h:153
Int64 & quantity()
Quantify for the given price.