OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.0.3
API documentation
EobiBookSnapshot.cpp
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 #include "EobiBookSnapshot.h"
21 #include "EobiBookImpl.h"
22 
23 
24 namespace OnixS {
25 namespace Eurex {
26 namespace MarketData {
27 namespace EOBI {
28 namespace Implementation {
29 
30 
32  OrderBook()
33 {
34  asks_ = snapshotee.asks();
35  bids_ = snapshotee.bids();
36 
37  bestAskAvailable_ = snapshotee.bestAsk(bestAskPrice_, bestAskQuantity_);
38  bestBidAvailable_ = snapshotee.bestAsk(bestBidPrice_, bestBidQuantity_);
39 
40  depth_ = snapshotee.depth();
41 
42  id_ = snapshotee.securityId();
43 }
44 
46  OrderBook(),
47  asks_(other.asks()),
48  bids_(other.bids()),
49  bestAskAvailable_(other.bestAsk(bestAskPrice_, bestAskQuantity_)),
50  bestBidAvailable_(other.bestAsk(bestBidPrice_, bestBidQuantity_)),
51  depth_(other.depth()),
52  id_(other.securityId())
53 {
54 }
55 
57 {
58 }
59 
60 size_t OrderBookSnapshot::doDepth() const
61 {
62  return depth_;
63 }
64 
65 SecurityId OrderBookSnapshot::doSecurityId() const
66 {
67  return id_;
68 }
69 
70 const PriceLevels& OrderBookSnapshot::doAsks() const
71 {
72  return asks_;
73 }
74 
75 const PriceLevels& OrderBookSnapshot::doBids() const
76 {
77  return bids_;
78 }
79 
80 bool OrderBookSnapshot::doBestAsk(Decimal& price, QuantityType& quantity) const
81 {
82  if(!bestAskAvailable_)
83  return false;
84 
85  price = bestAskPrice_;
86  quantity = bestAskQuantity_;
87 
88  return bestAskAvailable_;
89 }
90 
91 bool OrderBookSnapshot::doBestBid(Decimal& price, QuantityType& quantity) const
92 {
93  if(!bestBidAvailable_)
94  return false;
95 
96  price = bestBidPrice_;
97  quantity = bestBidQuantity_;
98 
99  return bestBidAvailable_;
100 }
101 /*
102 boost::scoped_ptr<OrderBook> OrderBookSnapshot::doSnapshot() const
103 {
104  boost::scoped_ptr<OrderBook> ptr(new OrderBookSnapshot(*this));
105  return ptr;
106 }
107 */
108 void* OrderBookSnapshot::operator new (size_t bookSize)
109 {
110  return ::new unsigned char[bookSize];
111 }
112 
113 void OrderBookSnapshot::operator delete (void* book)
114 {
115  BOOST_ASSERT(book != NULL);
116  ::delete[] (unsigned char*)book;
117 }
118 
119 
120 
121 }}}}}
bool bestAsk(Decimal &price, QuantityType &quantity) const
Definition: EobiBook.cpp:235
size_t depth() const
Returns the maximum book depth.
Definition: EobiBook.cpp:245
Definition: Group.h:25
Decimal type for better precision.
Definition: Numeric.h:63
Int64 SecurityId
Alias for Security Id type.
Definition: Defines.h:51
PriceLevelCollections::Array PriceLevels
Sequence of price levels.
Definition: EobiBook.h:129
const PriceLevels & asks() const
Returns a set of descending bid prices for the given security.
Definition: EobiBook.cpp:260
SecurityId securityId() const
Unique instrument Id as qualified.
Definition: EobiBook.cpp:250
const PriceLevels & bids() const
Returns a set of ascending ask prices for the given security.
Definition: EobiBook.cpp:265