OnixS C++ CME MDP Premium Market Data Handler 5.9.0
API Documentation
Loading...
Searching...
No Matches
ConsolidatedPriceLevel.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
25
27
36{
37public:
41 : direct_(null())
42 , implied_(null())
43 {
44 }
45
48 : direct_(&direct)
49 , implied_(null())
50 {
51 }
52
55 : direct_(null())
56 , implied_(&implied)
57 {
58 }
59
63 : direct_(&direct)
64 , implied_(&implied)
65 {
66 }
67
70 : direct_(other.direct_)
71 , implied_(other.implied_)
72 {
73 }
74
77
80 bool exist() const
81 {
82 return (direct_->exist() || implied_->exist());
83 }
84
86 const Decimal& price() const
87 {
88 return (direct_->exist() ? direct_->price() : implied_->price());
89 }
90
93 {
94 return (direct_->quantity() + implied_->quantity());
95 }
96
105 {
106 return *direct_;
107 }
108
111 {
112 direct_ = &direct;
113 }
114
123 {
124 return *implied_;
125 }
126
129 {
130 implied_ = &implied;
131 }
132
134 operator ImpliedPriceLevel() const
135 {
136 if (direct_->exist())
137 {
138 return ImpliedPriceLevel(direct_->price(), quantity());
139 }
140 else
141 {
142 return *implied_;
143 }
144 }
145
148 {
149 direct_ = other.direct_;
150 implied_ = other.implied_;
151
152 return *this;
153 }
154
155private:
156 // Direct price level component.
157 const DirectPriceLevel* direct_;
158
159 // Implied price level component.
160 const ImpliedPriceLevel* implied_;
161
162 // Used to make all references as a valid ones.
164 static const DirectPriceLevel* null();
165};
166
169void toStr(std::string&, const ConsolidatedPriceLevel&);
170
172inline std::string toStr(const ConsolidatedPriceLevel& priceLevel)
173{
174 std::string str;
175
176 toStr(str, priceLevel);
177
178 return str;
179}
180
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_EXPORTED
Definition Bootstrap.h:47
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
Price level data attributes of bid or ask of consolidated order book.
void consolidate(const DirectPriceLevel &direct)
Consolidates direct price level data part.
ConsolidatedPriceLevel()
Initializes instance indicating absence of consolidated data.
ConsolidatedPriceLevel(const DirectPriceLevel &direct, const ImpliedPriceLevel &implied)
Initializes instance from both direct and implied price levels.
ConsolidatedPriceLevel(const DirectPriceLevel &direct)
Initializes instance from direct price level only.
bool exist() const
Indicates whether instance has a valid data and actually exists at the level accessed.
const DirectPriceLevel & direct() const
Reference to price level from direct book consolidated into given instance.
ConsolidatedPriceLevel(const ConsolidatedPriceLevel &other)
Initializes instance as copy of the other one.
const Decimal & price() const
Price component.
void consolidate(const ImpliedPriceLevel &implied)
Consolidates implied price level data part.
ConsolidatedPriceLevel & operator=(const ConsolidatedPriceLevel &other)
Re-initializes instance as copy of other one.
ConsolidatedPriceLevel(const ImpliedPriceLevel &implied)
Initializes instance from implied price level only.
MbpBookQuantity quantity() const
Quantity component.
const ImpliedPriceLevel & implied() const
Reference to price level from implied book consolidated into given instance.
A real number with floating exponent.
Definition Decimal.h:137
Encapsulates price level concept.
Encapsulates price level concept.
Int64 MbpBookQuantity
Type for order Quantity.
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.