OnixS BME SENAF Handler C++ library 2.3.0
API documentation
Loading...
Searching...
No Matches
OrderBook.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
5 * copyright law and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable
8 * ONIXS Software Services Agreement (the Agreement) and Customer end user
9 * license agreements granting a non-assignable, non-transferable and
10 * non-exclusive license to use the software for it's own data processing
11 * purposes under the terms defined in the Agreement.
12 *
13 * Except as otherwise granted within the terms of the Agreement, copying or
14 * reproduction of any part of this source code or associated reference material
15 * to any other location for further reproduction or redistribution, and any
16 * amendments to this copyright notice, are expressly prohibited.
17 *
18 * Any reproduction or redistribution for sale or hiring of the Software not in
19 * accordance with the terms of the Agreement is a violation of copyright law.
20 */
21
22#pragma once
23
25#include <OnixS/Senaf/MarketData/Export.h>
27
28namespace OnixS { namespace Senaf { namespace MarketData {
29
30typedef unsigned int MarketId;
31
33class OrderBookImpl;
34class OrderBookProcessor;
35
37struct ONIXS_BME_SENAF_EXPORT PriceLevel
38{
41
44
47
50
52 explicit PriceLevel(
53 const Rational& inPrice = Rational(),
54 const Rational& inYield = Rational(),
55 int inQuantity = 0,
56 short inPositionCount = 0
57 )
58 : price(inPrice)
59 , yield(inYield)
60 , quantity(inQuantity)
61 , positionCount(inPositionCount)
62 {
63 }
64};
65
67
69class ONIXS_BME_SENAF_EXPORT OrderBook
70{
71 friend class OrderBookProcessor;
72
73public:
76
78 std::size_t depth() const;
79
81 bool empty() const;
82
84 const PriceLevelArray& bids() const;
85
87 const PriceLevelArray& asks() const;
88
90 std::string brief() const;
91
93 void brief(std::string&) const;
94
96 std::string toString() const;
97
99 void toString(std::string&) const;
100
103
104private:
105 OrderBook(OrderBookImpl*);
106
107 // No implementation
108 OrderBook(const OrderBook&);
109 OrderBook& operator=(const OrderBook&);
110
111 OrderBookImpl* impl_;
112};
113
114inline std::string OrderBook::brief() const
115{
116 std::string str;
117 brief(str);
118 return str;
119}
120
121inline std::string OrderBook::toString() const
122{
123 std::string str;
124 toString(str);
125 return str;
126}
127
128}}} // namespace OnixS::Senaf::MarketData
const PriceLevelArray & asks() const
Gets offer side of the price level book.
std::string toString() const
String presentation of the book.
Definition OrderBook.h:121
const PriceLevelArray & bids() const
Gets bid side of the price level book.
bool empty() const
Indicates whether book has no bids & asks.
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:114
std::size_t depth() const
Returns the maximum book depth.
void brief(std::string &) const
Appends brief book info to the string.
unsigned int MarketId
Definition OrderBook.h:30
ArrayRef< const PriceLevel, std::size_t > PriceLevelArray
Definition OrderBook.h:66
Rational yield
Raw exchange yield (fixed point).
Definition OrderBook.h:43
Rational price
Raw exchange price (fixed point).
Definition OrderBook.h:40
short positionCount
Positions count at price.
Definition OrderBook.h:49
int quantity
Total order quantity at price.
Definition OrderBook.h:46
PriceLevel(const Rational &inPrice=Rational(), const Rational &inYield=Rational(), int inQuantity=0, short inPositionCount=0)
Constructor.
Definition OrderBook.h:52
Rational number representation.
Definition Rational.h:33