OnixS ICE iMpact Multicast Price Feed Handler C++ library 8.18.0
API documentation
Loading...
Searching...
No Matches
OrderBook.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Onix Solutions Limited. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited 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 "Containers.h"
23#include "Export.h"
24#include "Rational.h"
25#include "Time.h"
26#include "Types.h"
27
28namespace OnixS { namespace ICE { namespace iMpact { namespace MarketData {
29
31class OrderBookHolder;
32
34struct ONIXS_ICEMDH_EXPORT PriceLevel
35{
36 typedef Rational Price;
37
40
43
46
49
52
54 explicit PriceLevel(
55 const Rational& inPrice = Rational(),
56 int inQuantity = 0,
57 int inImpliedQuantity = 0,
58 short inOrderCount = 0,
59 short inImpliedOrderCount = 0
60 )
61 : price(inPrice)
62 , quantity(inQuantity)
63 , impliedQuantity(inImpliedQuantity)
64 , orderCount(inOrderCount)
65 , impliedOrderCount(inImpliedOrderCount)
66 {
67 }
68};
69
71struct ONIXS_ICEMDH_EXPORT Order
72{
74
77
80
83
86
89
92
95
97 bool isRFQ;
98
100 explicit Order(
101 OrderId inOrderId = OrderId(),
102 const DateTime& inEntryDateTime = DateTime(),
103 const Rational& inPrice = Rational(),
104 int inQuantity = 0,
105 int inSequenceWithinMillis = 0,
106 short inOrderSequenceId = 0,
107 bool inIsImplied = false,
108 bool inIsRFQ = false
109 )
110 : orderId(inOrderId)
111 , entryDateTime(inEntryDateTime)
112 , price(inPrice)
113 , quantity(inQuantity)
114 , sequenceWithinMillis(inSequenceWithinMillis)
115 , orderSequenceId(inOrderSequenceId)
116 , isImplied(inIsImplied)
117 , isRFQ(inIsRFQ)
118 {
119 }
120};
121
124
126class ONIXS_ICEMDH_EXPORT OrderBook
127{
128public:
131
133 std::size_t depth() const;
134
136 bool empty() const;
137
142 const PriceLevelArray& bids() const;
143
148 const PriceLevelArray& offers() const;
149
154 const OrderArray& bidOrders() const;
155
160 const OrderArray& offerOrders() const;
161
163 std::string brief() const;
164
166 void brief(std::string&) const;
167
169 std::string toString() const;
170
172 void toString(std::string&) const;
173
176 const OrderBook* snapshot() const;
177
180
181private:
182 friend class OrderBookHolder;
183 struct Impl;
184
185 OrderBook(Impl*);
186
187 // No implementation
188 OrderBook(const OrderBook&);
189 OrderBook& operator=(const OrderBook&);
190
191 Impl* impl_;
192};
193
194inline std::string OrderBook::brief() const
195{
196 std::string str;
197 brief(str);
198 return str;
199}
200
201inline std::string OrderBook::toString() const
202{
203 std::string str;
204 toString(str);
205 return str;
206}
207
208}}}} // namespace OnixS::ICE::iMpact::MarketData
std::string toString() const
String presentation of the book.
Definition OrderBook.h:201
const PriceLevelArray & bids() const
const PriceLevelArray & offers() const
const OrderBook * snapshot() const
bool empty() const
Indicates whether book has no bids & asks.
const OrderArray & bidOrders() const
MarketId marketId() const
Unique identifier of a market.
void toString(std::string &) const
String presentation of the book.
std::string brief() const
Returns brief book info.
Definition OrderBook.h:194
std::size_t depth() const
Returns the maximum book depth.
const OrderArray & offerOrders() const
void brief(std::string &) const
Appends brief book info to the string.
long long OrderId
Alias for order identifiers type.
Definition Types.h:42
ArrayRef< const Order, std::size_t > OrderArray
Definition OrderBook.h:123
int MarketId
Alias for market identifiers type.
Definition Types.h:39
ArrayRef< const PriceLevel, std::size_t > PriceLevelArray
Definition OrderBook.h:122
long long DateTime
Represents the number of nanoseconds since Jan 1st, 1970, 00:00:00 GMT.
Definition Types.h:57
short orderSequenceId
Legacy order modification count.
Definition OrderBook.h:91
OrderId orderId
Order ID unique for market.
Definition OrderBook.h:76
bool isRFQ
True if order is Request For Quote.
Definition OrderBook.h:97
Order(OrderId inOrderId=OrderId(), const DateTime &inEntryDateTime=DateTime(), const Rational &inPrice=Rational(), int inQuantity=0, int inSequenceWithinMillis=0, short inOrderSequenceId=0, bool inIsImplied=false, bool inIsRFQ=false)
Constructor.
Definition OrderBook.h:100
OnixS::ICE::iMpact::MarketData::OrderId OrderId
Definition OrderBook.h:73
bool isImplied
True if order is implied.
Definition OrderBook.h:94
Rational price
Raw exchange price (fixed point).
Definition OrderBook.h:82
int sequenceWithinMillis
Sub-milliseconds ordering sequence.
Definition OrderBook.h:88
DateTime entryDateTime
Order entry date/time (milliseconds since 01-01-1970 00:00 GMT).
Definition OrderBook.h:79
short orderCount
Order count at price.
Definition OrderBook.h:48
short impliedOrderCount
Implied order count at price.
Definition OrderBook.h:51
int impliedQuantity
Implied order quantity at price.
Definition OrderBook.h:45
PriceLevel(const Rational &inPrice=Rational(), int inQuantity=0, int inImpliedQuantity=0, short inOrderCount=0, short inImpliedOrderCount=0)
Constructor.
Definition OrderBook.h:54
Rational price
Raw exchange price (fixed point).
Definition OrderBook.h:39
int quantity
Total order quantity at price.
Definition OrderBook.h:42
Rational number representation.
Definition Rational.h:31