OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers 18.2.0
API documentation
Loading...
Searching...
No Matches
EobiBook.h
Go to the documentation of this file.
1/*
2* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3*
4* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5* and international copyright treaties.
6*
7* Access to and use of the software is governed by the terms of the applicable ONIXS Software
8* Services Agreement (the Agreement) and Customer end user license agreements granting
9* a non-assignable, non-transferable and non-exclusive license to use the software
10* for it's own data processing purposes under the terms defined in the Agreement.
11*
12* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13* of this source code or associated reference material to any other location for further reproduction
14* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15*
16* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17* the terms of the Agreement is a violation of copyright law.
18*/
19
20#pragma once
21
22#include <vector>
23#include <memory>
24
27
28namespace OnixS
29{
30 namespace Eurex
31 {
32 namespace MarketData
33 {
34 namespace EOBI
35 {
36 namespace Implementation
37 {
38 struct Order;
39 }
40
41 typedef UInt64 OrderId;
42
43 struct ONIXS_EUREX_EMDI_API OrderInfo
44 {
46 OrderInfo (OrderId orderId, QuantityType quantity);
47
50 };
51
52 typedef std::vector<OrderInfo> OrderInfos;
53
55 struct ONIXS_EUREX_EMDI_API PriceLevel
56 {
60
62
64 const Decimal& price() const;
65
68
71
73 const OrderInfos& orders() const;
74
76 void swap (PriceLevel&) throw();
77
79 std::string toString() const;
80
82 void toString (std::string&) const;
83
84 private:
86 void price (const Decimal& value);
87
89 void quantity (QuantityType value);
90
92 void addOrderId (OrderId id, QuantityType quantity);
93
95 void removeOrderId (OrderId id);
96
97 private:
98 Decimal price_;
99 Quantity qty_;
100 OrderInfos orders_;
101
102 friend struct Implementation::Order;
103 };
104
105 const Decimal& getPrice (const PriceLevel& level);
106
107 bool isValid (const PriceLevel& level);
108
109 ONIXS_EUREX_EMDI_API
110 std::ostream& operator << (std::ostream& stream, const PriceLevel& value);
111
113 struct ONIXS_EUREX_EMDI_API PriceLevelCollections
114 {
116 typedef std::vector<PriceLevel> Array;
117
119 typedef Array::iterator ArrayEntry;
120
122 typedef Array::const_iterator ArrayConstEntry;
123 };
124
127
130
133
134 class ONIXS_EUREX_EMDI_API OrderBook
135 {
136 public:
138
141
143 virtual ~OrderBook();
144
147
149 bool empty() const;
150
152 const PriceLevels& asks() const;
153
155 const PriceLevels& bids() const;
156
158 size_t depth() const;
159
161 std::string toString() const;
162
164 void toString (std::string&) const;
165
167 std::string toShortString() const;
168
170 void toShortString (std::string&) const;
171
173 std::string toFormattedString() const;
174
176 void toFormattedString (std::string&) const;
177
179 bool bestAsk (Decimal& price, QuantityType& quantity) const;
180
182 bool bestBid (Decimal& price, QuantityType& quantity) const;
183
185 void setUserPointer (void* pointer);
186
188 void* getUserPointer() const;
189
190 private:
191 virtual const PriceLevels& doAsks() const = 0;
192 virtual const PriceLevels& doBids() const = 0;
193 virtual SecurityId doSecurityId() const = 0;
194 virtual size_t doDepth() const = 0;
195 virtual bool doBestAsk (Decimal& price, QuantityType& quantity) const = 0;
196 virtual bool doBestBid (Decimal& price, QuantityType& quantity) const = 0;
197
198 private:
199
200 void* userPointer_;
201 };
202
203
204 ONIXS_EUREX_EMDI_API
205 std::ostream& operator << (std::ostream& stream, const OrderBook& book);
206
208 void checkSanity (const OrderBook& book);
209 }
210 }
211 }
212}
Decimal type for better precision.
Definition Numeric.h:66
std::string toString() const
String presentation of the book.
void setUserPointer(void *pointer)
sets user data pointer
virtual ~OrderBook()
Destruction interface.
std::string toFormattedString() const
Returns formatted presentation of the book.
const PriceLevels & bids() const
Returns a set of ascending ask prices for the given security.
bool empty() const
Indicates whether book has no bids & asks.
size_t depth() const
Returns the maximum book depth.
void toFormattedString(std::string &) const
Appends Formatted presentation of the book.
const PriceLevels & asks() const
Returns a set of descending bid prices for the given security.
bool bestAsk(Decimal &price, QuantityType &quantity) const
void toString(std::string &) const
String presentation of the book.
SecurityId securityId() const
Unique instrument Id as qualified.
void toShortString(std::string &) const
Appends brief book info to the string.
bool bestBid(Decimal &price, QuantityType &quantity) const
std::string toShortString() const
Returns brief book info.
void * getUserPointer() const
returns kept user data pointer
PriceLevelCollections::Array PriceLevels
Sequence of price levels.
Definition EobiBook.h:126
const Decimal & getPrice(const PriceLevel &level)
bool isValid(const PriceLevel &level)
std::vector< OrderInfo > OrderInfos
Definition EobiBook.h:52
PriceLevelCollections::ArrayEntry PriceLevelsEntry
Iterator to access price levels with write permissions.
Definition EobiBook.h:129
std::ostream & operator<<(std::ostream &stream, const EobiHandlerSettings &settings)
PriceLevelCollections::ArrayConstEntry PriceLevelsConstEntry
Iterator over read-only collection of price levels.
Definition EobiBook.h:132
void checkSanity(const OrderBook &book)
checks whether the given book is properly built
UInt64 Quantity
Alias for Quantity type.
Definition Defines.h:54
Int64 SecurityId
Alias for Security Id type.
Definition Defines.h:51
OrderInfo(OrderId orderId, QuantityType quantity)
Miscellaneous traits for PriceLevel class.
Definition EobiBook.h:114
Array::iterator ArrayEntry
Mutable entry iterator.
Definition EobiBook.h:119
std::vector< PriceLevel > Array
Sequential collection of price levels.
Definition EobiBook.h:116
Array::const_iterator ArrayConstEntry
Iterator for read-only access.
Definition EobiBook.h:122
Encapsulates price level concept.
Definition EobiBook.h:56
std::string toString() const
Returns string representation of the instance.
const OrderInfos & orders() const
orders ids for a given level
const Decimal & price() const
Price value.
QuantityType numberOfOrders() const
Total number of orders of given price.
void toString(std::string &) const
Appends representation of the instance to the string.
PriceLevel(const Decimal &price, QuantityType quantity=0, QuantityType numberOfOrders=0, const OrderInfos &orders=OrderInfos())
Initializes the instances according to specified attributes.
QuantityType quantity() const
Quantify for the given price.
void swap(PriceLevel &)
swap values