OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.0.3
API documentation
EobiOrderBookHolder.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 <map>
23 #include <set>
24 
25 #include <boost/functional/hash.hpp>
26 #include <boost/function.hpp>
27 #include <boost/scoped_ptr.hpp>
28 
38 
40 
41 #include "EobiBookImpl.h"
42 
43 
44 
45 namespace OnixS {
46 namespace Eurex {
47 namespace MarketData {
48 namespace EOBI {
49 namespace Implementation {
50 
51 
52 class OrderAdd;
53 class OrderModify;
54 class OrderDelete;
55 class OrderMassDelete;
56 class PartialOrderExecution;
57 class FullOrderExecution;
58 class SnapshotOrder;
59 class OrderBookInternal;
60 
61 
62 using OnixS::HandlerCore::MarketData::OrderBookRegistry;
63 
64 class ListenerHolder;
65 
66 static const size_t DefaultBookDepth = 5;
67 
68 class OrderBookCreator : public OnixS::HandlerCore::MarketData::FullOrderDepthBookCreator<OrderBookInternal, false>
69 {
70 public:
71  typedef OnixS::HandlerCore::MarketData::FullOrderDepthBookCreator<OrderBookInternal, true> FullOrderDepthBookCreator;
73 
74  OrderBookCreator(size_t bookDepth, OrderBookAllocator* bookAllocator);
75  OrderBookCreator(const OrderBookCreator& other);
76  boost::shared_ptr<OrderBookInternal> operator()(const SecurityId& id) const;
77  void reset();
78 
79 private:
80  const size_t bookDepth_;
81  OrderBookAllocator* const bookAllocator_;
82 };
83 
85 {
86 public:
87  typedef OrderBookRegistry<SecurityId, OrderBookInternal, OrderBookCreator> BookRegistry;
88  typedef BookRegistry::BookPtr BookPtr;
89  typedef boost::function<void(const OrderBookInternal&)> OnOrderBookUpdatedCallback;
90 
91  OrderBookHolder(const OnOrderBookUpdatedCallback& onOrderBookUpdated, OrderBookAllocator* bookAllocator, size_t bookDepth = DefaultBookDepth);
92 
93  void orderAdd(const EOBI::OrderAdd&);
94  void onOrderModify(const EOBI::OrderModify&);
95  void onOrderModifySamePriority(const EOBI::OrderModifySamePriority&);
96  void onOrderDelete(const EOBI::OrderDelete&);
97  void onOrderMassDelete(const EOBI::OrderMassDelete&);
98  void onPartialOrderExecution(const EOBI::PartialOrderExecution&);
99  void onFullOrderExecution(const EOBI::FullOrderExecution&);
100  void onSnapshotOrder(const EOBI::SnapshotOrder&, SecurityId secId);
101 
102  void emptyBook(SecurityId securityId, bool complete);
103 
104  void onInactivity(const boost::function<void(const OrderBookInternal&)>& onOrderBookOutOfDate);
105  void reset();
106 
107 private:
108  template <typename OrderList>
109  void checkOrderExistance(const OrderList& map, UInt64 orderid, bool shouldExist);
110 
111  void updateBook(BookPtr bookPtr, bool complete);
112  void updatePendingBooks();
113 
114 private:
115  boost::scoped_ptr<BookRegistry> impl_;
116  OnOrderBookUpdatedCallback onOrderBookUpdated_;
117 
118  std::set<BookPtr> books_;
119  std::set<BookPtr> pendingChangedBooks_;
120 };
121 
122 
123 }}}}}
124 
125 
Definition: Group.h:25
Int64 SecurityId
Alias for Security Id type.
Definition: Defines.h:51
OrderBookCreator(size_t bookDepth, OrderBookAllocator *bookAllocator)
boost::shared_ptr< OrderBookInternal > operator()(const SecurityId &id) const
OrderBookRegistry< SecurityId, OrderBookInternal, OrderBookCreator > BookRegistry
OnixS::HandlerCore::MarketData::FullOrderDepthBookCreator< OrderBookInternal, true > FullOrderDepthBookCreator
boost::function< void(const OrderBookInternal &)> OnOrderBookUpdatedCallback