OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  8.1.0
API documentation
EobiDataRepository.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 "../DataRepository.hpp"
23 #include "EobiListenerHolder.h"
24 #include "MessageDataStructures.h"
27 #include <boost/unordered_map.hpp>
28 #include <boost/unordered_set.hpp>
29 
30 namespace OnixS {
31 namespace Eurex {
32 namespace MarketData {
33 namespace EOBI {
34 namespace Implementation {
35 
36 class EobiProductDataRepository;
38 
40 
41 class EobiDataRepository : public MarketData::Implementation::DataRepository<EobiDataRepositoryConfig>
42 {
44 
45 public:
47  const EobiDataRepositoryConfig &config,
48  bool buildInternalOrderBooks,
49  OrderBookAllocator* orderBookAllocator);
50 
51  virtual ~EobiDataRepository();
52 
53 public:
54  void setPartitionIdFilters(const PartitionIdFilters& filters);
58  void setSecurityIdFilters(const SecurityIdFilters &filters);
60 
61 public:
62  void onIncrementalMessage(const DataSource& dataSource, const BaseMsgData &msgData);
64 
65  void onSnapshotMessage(const DataSource& dataSource, const BaseMsgData &msgData);
67 
68  void onApplSeqReset();
69 
70 private:
71  enum State { RecoveryPending, RecoveryInProgress, Synchronized };
72 
73 private:
74  typedef boost::unordered_map<MarketSegmentId, EobiProductDataRepository*> ProductDataRepositories;
75 
76  typedef boost::unordered_set<PartitionId> PartitionFilters;
77  typedef boost::unordered_set<MarketSegmentId> ProductFilters;
78 
79 private:
80  void processRecoveryCycleStart(const DataSource& dataSource, const BaseMsgData &msgData);
81  bool processRecoveryCycleEntry(const DataSource& dataSource, const BaseMsgData &msgData);
82  void startRecovery();
83  void restartRecovery();
84  bool completeRecovery();
85 
86  EobiProductDataRepository* getOrCreateProductDataRepository(MarketSegmentId product);
87  void clearProductDataRepositories();
88 
89  MarketDepth getMarketDepth(MarketSegmentId product) const;
90 
91  bool shouldSkipMessage(const DataSource &dataSource) const;
92 
93  bool shouldBuildInternalOrderBooks () const { return config_.settings.buildInternalOrderBooks; }
94  bool shouldStartRecoveryOnPacketGap() const { return config_.settings.startRecoveryOnPacketGap; }
95 
96 
97 private:
98  State state_;
99  ProductDataRepositories repositories_;
100  PartitionFilters partitionFilters_;
101  ProductFilters productFilters_;
102  SecurityIdFilters instrumentFilters_;
103  SequenceNumber nextSnapshotMsgSeqNum_;
104  OrderBookAllocator* orderBookAllocator_;
105 };
106 
107 
108 }}}}}
109 
unsigned int SequenceNumber
Alias for sequence numbers.
EobiDataRepository(const EobiDataRepositoryConfig &config, bool buildInternalOrderBooks, OrderBookAllocator *orderBookAllocator)
void onIncrementalMessage(const DataSource &dataSource, const BaseMsgData &msgData)
UInt32 MarketDepth
Alias for Market depth type.
Definition: Defines.h:43
FilteringTraits::PartitionIdFilters PartitionIdFilters
Definition: Defines.h:30
void setMarketSegmentIdFilters(const MarketSegmentIdFilters &filters)
FilteringTraits::MarketSegmentIdFilters MarketSegmentIdFilters
MarketData::Implementation::DataRepositoryConfig< EobiListenerHolder, EobiHandlerSettings > EobiDataRepositoryConfig
FilteringTraits::SecurityIdFilters SecurityIdFilters
UInt32 MarketSegmentId
Alias for Market Segment ID type.
Definition: Defines.h:40
void onSnapshotMessage(const DataSource &dataSource, const BaseMsgData &msgData)