OnixS C++ B3 Binary UMDF Market Data Handler 1.10.0
Users' manual and API documentation
Loading...
Searching...
No Matches
LogPlayer.h
Go to the documentation of this file.
1// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is
4// protected by copyright law and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable
7// OnixS Software Services Agreement (the Agreement) and Customer end user license
8// agreements granting a non-assignable, non-transferable and non-exclusive license
9// to use the software for it's own data processing purposes under the terms defined
10// in the Agreement.
11//
12// Except as otherwise granted within the terms of the Agreement, copying or
13// reproduction of any part of this source code or associated reference material
14// to any other location for further reproduction or redistribution, and any
15// amendments to this copyright notice, are expressly prohibited.
16//
17// Any reproduction or redistribution for sale or hiring of the Software not in
18// accordance with the terms of the Agreement is a violation of copyright law.
19//
20
21#pragma once
22
23#include <limits>
24#include <string>
25
28
30
33
44
47{
48public:
51 {
52 }
53
56
58 const std::string& logFile() const
59 {
60 return logFile_;
61 }
62
64 LogPlayerSettings& logFile(const std::string& file)
65 {
66 logFile_ = file;
67
68 return *this;
69 }
70
73 {
74 return channel_;
75 }
76
79 {
80 channel_ = value;
81 return *this;
82 }
83
85 const std::string& connectivityConfigurationFile() const
86 {
87 return configurationFile_;
88 }
89
92 LogPlayerSettings& connectivityConfigurationFile(const std::string& configurationFile)
93 {
94 configurationFile_ = configurationFile;
95
96 return *this;
97 }
98
100 unsigned sendDelay() const
101 {
102 return sendDelay_;
103 }
104
107 {
108 sendDelay_ = delay;
109
110 return *this;
111 }
112
115 {
116 return useNaturalSendDelays_;
117 }
118
121 {
122 useNaturalSendDelays_ = value;
123
124 return *this;
125 }
126
128 bool updateSendingTime() const
129 {
130 return updateSendingTime_;
131 }
132
135 {
136 updateSendingTime_ = value;
137
138 return *this;
139 }
140
142 unsigned sourceSwitchDelay() const
143 {
144 return sourceSwitchDelay_;
145 }
146
149 {
150 sourceSwitchDelay_ = delay;
151
152 return *this;
153 }
154
156 const std::string& primaryFeed() const
157 {
158 return primaryFeed_;
159 }
160
162 LogPlayerSettings& primaryFeed(const std::string& feed)
163 {
164 primaryFeed_ = feed;
165
166 return *this;
167 }
168
170 bool simulateArbitrage() const
171 {
172 return simulateArbitrage_;
173 }
174
177 {
178 simulateArbitrage_ = value;
179
180 return *this;
181 }
182
184 const std::string& ifaceA() const
185 {
186 return ifaceA_;
187 }
188
190 LogPlayerSettings& ifaceA(const std::string& iface)
191 {
192 ifaceA_ = iface;
193
194 return *this;
195 }
196
199 const std::string& ifaceB() const
200 {
201 return ifaceA_;
202 }
203
206 LogPlayerSettings& ifaceB(const std::string& iface)
207 {
208 ifaceA_ = iface;
209
210 return *this;
211 }
212
214 unsigned long packetsCount() const
215 {
216 return packetsCount_;
217 }
218
220 LogPlayerSettings& packetsCount(unsigned long value)
221 {
222 packetsCount_ = value;
223
224 return *this;
225 }
226
227private:
228 std::string logFile_;
229 ChannelId channel_ = 80;
230 std::string configurationFile_;
231 unsigned sendDelay_ = 100;
232 bool useNaturalSendDelays_ = false;
233 bool updateSendingTime_ = false;
234 unsigned sourceSwitchDelay_ = 100000;
235 std::string primaryFeed_ = "A";
236 bool simulateArbitrage_ = false;
237 std::string ifaceA_;
238 std::string ifaceB_;
239 unsigned long packetsCount_ = 0xffffffff;
240
241};
242
244{
246 virtual bool activated() const = 0;
247};
248
254
255
257{
258 size_t incrementalCounter_ = 0;
259 size_t snapshotCounter_ = 0;
260 size_t instrumentCounter_ = 0;
261
262 size_t counter(FeedType::Enum type) const;
263
264public:
267
268 void reset();
269
271
272 void dump(std::ostream& out) const;
273};
274
275inline std::ostream& operator<<(std::ostream& out, const LogPlayerStatistics& statistics)
276{
277 statistics.dump(out);
278
279 return out;
280}
281
284{
285public:
288
290 {
291 return statistics_;
292 }
293
295 void
296 run(const LogPlayerSettings& settings, const Interrupter* interrupter = nullptr, const PacketNotifier* packetNotifier = nullptr);
297
298private:
299 LogPlayerStatistics statistics_;
300};
301
#define ONIXS_B3_UMDF_MD_TESTING_NAMESPACE_BEGIN
Definition ABI.h:144
#define ONIXS_B3_UMDF_MD_TESTING_NAMESPACE_END
Definition ABI.h:149
#define ONIXS_B3_UMDF_MD_EXPORTED
Definition ABI.h:37
#define ONIXS_B3_UMDF_MD_LTWT_CLASS
Definition ABI.h:90
LogPlayer's configuration settings.
Definition LogPlayer.h:47
LogPlayerSettings & sendDelay(unsigned delay)
Pause before sending data to the same source as it was sent before (in microseconds).
Definition LogPlayer.h:106
bool useNaturalSendDelays() const
Use delays from the log file. If true, sendDelay will be ignored.
Definition LogPlayer.h:114
unsigned sendDelay() const
Pause before sending data to the same source as it was sent before (in microseconds).
Definition LogPlayer.h:100
LogPlayerSettings & simulateArbitrage(bool value)
Simulates arbitrage on realtime feeds. By default, data is sent through primary feed only.
Definition LogPlayer.h:176
LogPlayerSettings & packetsCount(unsigned long value)
The number of incremental packets to replay.
Definition LogPlayer.h:220
bool updateSendingTime() const
Update the SendingTime field in the Binary Packet Header.
Definition LogPlayer.h:128
const std::string & ifaceB() const
Interface through which application must send data belonging to secondary feed.
Definition LogPlayer.h:199
LogPlayerSettings & connectivityConfigurationFile(const std::string &configurationFile)
Path to the connectivity configuration file from which to load feed connection settings.
Definition LogPlayer.h:92
LogPlayerSettings & logFile(const std::string &file)
Path to the log file.
Definition LogPlayer.h:64
bool simulateArbitrage() const
Simulates arbitrage on realtime feeds. By default, data is sent through primary feed only.
Definition LogPlayer.h:170
LogPlayerSettings & sourceSwitchDelay(unsigned delay)
Pause before sending data to the source which differs from the source data was sent before (in micros...
Definition LogPlayer.h:148
LogPlayerSettings & ifaceA(const std::string &iface)
Interface through which application must send data belonging to primary feed. If not specified,...
Definition LogPlayer.h:190
const std::string & ifaceA() const
Interface through which application must send data belonging to primary feed. If not specified,...
Definition LogPlayer.h:184
LogPlayerSettings & channel(ChannelId value)
Identifies CME market data channel.
Definition LogPlayer.h:78
LogPlayerSettings & updateSendingTime(bool value)
Update the SendingTime field in the Binary Packet Header.
Definition LogPlayer.h:134
const std::string & connectivityConfigurationFile() const
Path to the connectivity configuration file.
Definition LogPlayer.h:85
const std::string & logFile() const
Path to the log file.
Definition LogPlayer.h:58
const std::string & primaryFeed() const
Defines primary feed for the feed group.
Definition LogPlayer.h:156
unsigned sourceSwitchDelay() const
Pause before sending data to the source which differs from the source data was sent before (in micros...
Definition LogPlayer.h:142
LogPlayerSettings & useNaturalSendDelays(bool value)
Use delays from the log file. If true, sendDelay will be ignored.
Definition LogPlayer.h:120
LogPlayerSettings & primaryFeed(const std::string &feed)
Defines primary feed for the feed group.
Definition LogPlayer.h:162
LogPlayerSettings & ifaceB(const std::string &iface)
Interface through which application must send data belonging to secondary feed.
Definition LogPlayer.h:206
LogPlayerSettings()
Initializes parameters with default values.
Definition LogPlayer.h:50
ChannelId channel() const
Identifies CME market data channel.
Definition LogPlayer.h:72
unsigned long packetsCount() const
The number of incremental packets to replay.
Definition LogPlayer.h:214
void run(const LogPlayerSettings &settings, const Interrupter *interrupter=nullptr, const PacketNotifier *packetNotifier=nullptr)
Starts playing of the log, until the interrupter is activated or the log is played totally.
const LogPlayerStatistics & statistics() const
Definition LogPlayer.h:289
LogPlayer()
Initializes the instance according to the given settings.
Definition LogPlayer.h:287
std::ostream & operator<<(std::ostream &out, const LogPlayerStatistics &statistics)
Definition LogPlayer.h:275
UInt32 ChannelId
Identifies channel.
Definition LogPlayer.h:32
Messaging::UInt32 UInt32
Definition Integral.h:37
virtual bool activated() const =0
Returns the Interrupter instance state.
virtual void onPacketProcessed(FeedType::Enum) const =0
Returns the Interrupter instance state.