OnixS C++ CME MDP Premium Market Data Handler  5.9.0
API Documentation
ImpliedPriceLevel.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 <string>
24 
25 #include <OnixS/CME/MDH/Decimal.h>
27 
29 
30 /// Encapsulates price level concept.
32 {
33 public:
34  /// Initializes undefined level.
36  : exist_(false)
37  , price_()
38  , qty_(0)
39  {
40  }
41 
42  /// Initializes as copy of other level.
44  : exist_(other.exist_)
45  , price_(other.price_)
46  , qty_(other.qty_)
47  {
48  }
49 
50  /// Initializes defined level
51  /// according to specified attributes.
53  : exist_(true)
54  , price_(price)
55  , qty_(qty)
56  {
57  }
58 
59  /// Cleans everything up.
61 
62  /// Identifies whether price level exist.
63  bool exist() const
64  {
65  return exist_;
66  }
67 
68  /// Updates existence status.
69  bool& exist()
70  {
71  return exist_;
72  }
73 
74  /// Price value.
75  ///
76  /// @note For CME Globex channels (market data groups)
77  /// value presents if price level exists. However, for
78  /// CME Partner Exchanges channels like BVMF price value
79  /// may be NULL in a valid (existent) price level.
80  ///
81  /// @see NullPRICE.
82  const Decimal& price() const
83  {
84  return price_;
85  }
86 
87  /// Price value.
89  {
90  return price_;
91  }
92 
93  /// Quantity for the given price.
95  {
96  return qty_;
97  }
98 
99  /// Quantity for the given price.
101  {
102  return qty_;
103  }
104 
105  // Re-initializes as copy of other instance.
107  {
108  price_ = other.price_;
109  qty_ = other.qty_;
110  exist_ = other.exist_;
111 
112  return *this;
113  }
114 
115 private:
116  // Indicates whether data is available.
117  bool exist_;
118 
119  // Price value for the level.
120  Decimal price_;
121 
122  // Quantity component.
123  MbpBookQuantity qty_;
124 };
125 
126 /// Serializes price level attributes into a string.
128 void toStr(std::string&, const ImpliedPriceLevel&);
129 
130 /// Serializes price level attributes into a string.
131 inline std::string toStr(const ImpliedPriceLevel& priceLevel)
132 {
133  std::string str;
134 
135  toStr(str, priceLevel);
136 
137  return str;
138 }
139 
Decimal & price()
Price value.
ImpliedPriceLevel & operator=(const ImpliedPriceLevel &other)
bool & exist()
Updates existence status.
std::string toStr(const ImpliedPriceLevel &priceLevel)
Serializes price level attributes into a string.
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
MbpBookQuantity quantity() const
Quantity for the given price.
ImpliedPriceLevel(const Decimal &price, MbpBookQuantity qty)
Initializes defined level according to specified attributes.
Encapsulates price level concept.
ImpliedPriceLevel(const ImpliedPriceLevel &other)
Initializes as copy of other level.
~ImpliedPriceLevel()
Cleans everything up.
const Decimal & price() const
Price value.
A real number with floating exponent.
Definition: Decimal.h:136
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:171
MbpBookQuantity & quantity()
Quantity for the given price.
ImpliedPriceLevel()
Initializes undefined level.
Int64 MbpBookQuantity
Type for order Quantity.
Definition: MbpBookTraits.h:31
bool exist() const
Identifies whether price level exist.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68