OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.0.3
API documentation
EmdiProductDataRepository.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 
24 
25 #include "MessageQueue.h"
26 #include "EditableOrderBook.h"
27 #include "ListenerHolder.h"
28 #include "InternalDefines.h"
29 
30 namespace OnixS {
31 namespace Eurex {
32 namespace MarketData {
33 namespace Implementation {
34 
35 
36 class EmdiProductDataRepository : public Logging::LogFacility
37 {
38  typedef OnixS::Logging::LogFacility base;
39  typedef boost::function<bool(SecurityId)> SecurityIdFilter;
40 
41 public:
46  LogFacility* parent,
47  HandlerCore::Common::HandlerLogger* logger,
48  ListenerHolder* listenerHolder,
49  const HandlerSettings& settings,
50  SecurityIdFilter filterSecurityId);
51 
53 
54  void processDepthSnapshot(const CORE::Message& msg, const DataSource& dataSource);
55 
56  void processIncremental(const CORE::Message&, const CORE::FieldValue&, TemplateId, const DataSource&, bool*);
57  void processIncremental(const CORE::Message&, TemplateId, const DataSource&, bool*);
58 
60  void processBeacon(const CORE::Message &msg, bool *gapDetected);
61 
62  void reset();
63 
65 
66  bool hasCashedItems() const;
67  bool buildInternalOrderBooks() const;
68  bool syncronized() const;
69  MarketDepth marketDepth() const;
70 
72 
73 private:
74  EditableOrderBook* getOrCreateBook(SecurityId securityId);
75  void updateBook(const DepthSnapshot& snapshot);
76  void updateBook(const DepthIncremental& incremental);
77 
78  void dispatchIncremental(const CORE::Message& msg, TemplateId templateId, const DataSource& dataSource, bool* gapDetected);
79 
80  template<typename MessageType>
81  bool applyDepth(const MessageType& wrapper);
82 
83  // Log helper.
84  template<typename TMsg>
85  void log (const TMsg & msg)
86  {
87  if (logger_)
88  logger_->log (msg);
89  }
90 
91 private:
92  HandlerCore::Common::HandlerLogger* const logger_;
93  ListenerHolder* const listenerHolder_;
94  const HandlerSettings& settings_;
95  const MarketSegmentId marketSegmentId_;
96  const MarketDepth marketDepth_;
97  const bool buildInternalOrderBooks_;
98  const SecurityIdFilter filterSecurityId_;
99 
100  SequenceNumber nextMsgSeqNum_;
101  bool synchronized_;
102 
103  MessageQueue cachedIncremetalQueue_;
104 
105  typedef boost::shared_ptr<EditableOrderBook> EditableOrderBookPtr;
106  typedef std::map<SecurityId, EditableOrderBookPtr> Books;
107  typedef Books::const_iterator BooksEntry;
108  Books books_;
109 };
110 
111 
112 }}}}
113 
unsigned int SequenceNumber
Alias for sequence numbers.
UInt32 MarketDepth
Alias for Market depth type.
Definition: Defines.h:43
Handler base configuration settings.
void processIncremental(const CORE::Message &, const CORE::FieldValue &, TemplateId, const DataSource &, bool *)
Definition: Group.h:25
Int64 SecurityId
Alias for Security Id type.
Definition: Defines.h:51
EmdiProductDataRepository(MarketSegmentId marketSegmentId, MarketDepth marketDepth, bool buildInternalOrderBooks, LogFacility *parent, HandlerCore::Common::HandlerLogger *logger, ListenerHolder *listenerHolder, const HandlerSettings &settings, SecurityIdFilter filterSecurityId)
UInt32 MarketSegmentId
Alias for Market Segment ID type.
Definition: Defines.h:40
void processDepthSnapshot(const CORE::Message &msg, const DataSource &dataSource)
OnixS::FIX::Core::FAST::TemplateId TemplateId