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