OnixS C++ CME MDP Premium Market Data Handler 5.9.0
API Documentation
Loading...
Searching...
No Matches
SessionSettings.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 <string>
24
27
29
57
60void toStr(std::string&, JoinRecoveryOptions::Enum);
61
63inline std::string toStr(JoinRecoveryOptions::Enum recovery)
64{
65 std::string str;
66
67 toStr(str, recovery);
68
69 return str;
70}
71
94
98
100inline std::string toStr(GapAndErrorHandlingOptions::Enum handling)
101{
102 std::string str;
103
104 toStr(str, handling);
105
106 return str;
107}
108
111{
113 typedef UInt32 Base;
114
115 enum Enum
116 {
133
142 };
143};
144
148
150inline std::string toStr(InstrumentRecoveryOptions::Enum option)
151{
152 std::string str;
153
154 toStr(str, option);
155
156 return str;
157}
158
182
186
188inline std::string toStr(MarketRecoveryOptions::Enum option)
189{
190 std::string str;
191
192 toStr(str, option);
193
194 return str;
195}
196
197ONIXS_CMEMDH_EXPORTED_CLASS_DECL(TcpRecoveryService);
198
201{
202public:
208 : group_(group ? *group : SettingGroup::null())
209 , service_(ONIXS_CMEMDH_NULLPTR)
210 , attempts_(1)
211 , servingTimeLimit_(10)
212 {
213 }
214
220 : group_(SettingGroup::null())
221 , service_(other.service_)
222 , attempts_(other.attempts_)
223 , servingTimeLimit_(other.servingTimeLimit_)
224 {
225 }
226
229
237 {
238 return service_;
239 }
240
245 {
246 group_.controlAssignment("TCP Recovery Service Instance", service_, service);
247
248 return *this;
249 }
250
257 {
258 return attempts_;
259 }
260
267 {
268 group_.controlAssignment("TCP Recovery Attempt Quantity", attempts_, qty);
269
270 return *this;
271 }
272
282 {
283 return servingTimeLimit_;
284 }
285
293 {
294 group_.controlAssignment("TCP Recovery Serving Time Limit", servingTimeLimit_, servingTimeLimit);
295
296 return *this;
297 }
298
302 {
303 group_.controlChange(
304 "TCP Recovery Session Settings", &TcpRecoverySessionSettings::assignNoControl, *this, other
305 );
306
307 return *this;
308 }
309
310private:
313
314 const SettingGroup& group_;
315
316 TcpRecoveryService* service_;
317
318 UInt32 attempts_;
319 UInt32 servingTimeLimit_;
320
321 // Re-initializes the instance as a copy of the
322 // other one and bypassing assignment control.
323 void assignNoControl(const TcpRecoverySessionSettings& other)
324 {
325 service_ = other.service_;
326
327 attempts_ = other.attempts_;
328
329 servingTimeLimit_ = other.servingTimeLimit_;
330 }
331};
332
335void toStr(std::string&, const TcpRecoverySessionSettings&);
336
338inline std::string toStr(const TcpRecoverySessionSettings& settings)
339{
340 std::string str;
341
342 toStr(str, settings);
343
344 return str;
345}
346
350{
351public:
354 : SettingGroup(controller)
355 , joinRecovery_(JoinRecoveryOptions::InstrumentsAndMarketState)
356 , gapAndErrorHandling_(GapAndErrorHandlingOptions::RecoverMarketState)
357 , instrumentRecovery_(InstrumentRecoveryOptions::Accurate)
358 , marketRecovery_(MarketRecoveryOptions::BothMboAndMbp)
359 , tcpRecovery_(&group())
360 {
361 }
362
366 : SettingGroup()
367 , joinRecovery_(other.joinRecovery_)
368 , gapAndErrorHandling_(other.gapAndErrorHandling_)
369 , instrumentRecovery_(other.instrumentRecovery_)
370 , marketRecovery_(other.marketRecovery_)
371 , tcpRecovery_(other.tcpRecovery_)
372 {
373 }
374
377
384 {
385 return joinRecovery_;
386 }
387
391 {
392 group().controlAssignment("Join Recovery Strategy", joinRecovery_, recovery);
393
394 return *this;
395 }
396
403 {
404 return gapAndErrorHandling_;
405 }
406
410 {
411 group().controlAssignment("Gap And Error Handling Strategy", gapAndErrorHandling_, handling);
412
413 return *this;
414 }
415
420 {
421 return instrumentRecovery_;
422 }
423
426 {
427 group().controlAssignment("Instrument Recovery Strategy", instrumentRecovery_, recovery);
428
429 return *this;
430 }
431
436 {
437 return marketRecovery_;
438 }
439
442 {
443 group().controlAssignment("Market Recovery Strategy", marketRecovery_, recovery);
444
445 return *this;
446 }
447
450 {
451 return tcpRecovery_;
452 }
453
456 {
457 return tcpRecovery_;
458 }
459
465 {
466 group().controlChange("Session Settings", &SessionSettings::assignNoControl, *this, other);
467
468 return *this;
469 }
470
471protected:
474 const SettingGroup& group() const
475 {
476 return *this;
477 }
478
482 {
484
485 tcpRecovery_.assignNoControl(other.tcpRecovery_);
486 }
487
489 {
490 joinRecovery_ = other.joinRecovery_;
491
492 gapAndErrorHandling_ = other.gapAndErrorHandling_;
493
494 instrumentRecovery_ = other.instrumentRecovery_;
495
496 marketRecovery_ = other.marketRecovery_;
497 }
498
499private:
500 JoinRecoveryOptions::Enum joinRecovery_;
501 GapAndErrorHandlingOptions::Enum gapAndErrorHandling_;
502
503 InstrumentRecoveryOptions::Enum instrumentRecovery_;
504 MarketRecoveryOptions::Enum marketRecovery_;
505
506 TcpRecoverySessionSettings tcpRecovery_;
507
509 friend struct LegacyAssigner;
510};
511
514void toStr(std::string&, const SessionSettings&);
515
517inline std::string toStr(const SessionSettings& settings)
518{
519 std::string str;
520
521 toStr(str, settings);
522
523 return str;
524}
525
529
537
545
553
561
569
577
585
593
601
609
610// Complex (one-call) setup.
611
624
636
646
647// Deprecated way of session setup.
648
649#if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
650
664
679
694
709
724
739
754
755#endif // ONIXS_CMEMDH_NO_DEPRECATED
756
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:48
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:35
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_NULLPTR
Definition Compiler.h:178
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
Basic set of parameters affecting behavior of the Handler when the market data processing is performe...
SessionSettings & marketRecovery(MarketRecoveryOptions::Enum recovery)
Defines market recovery options.
SessionSettings & gapAndErrorHandling(GapAndErrorHandlingOptions::Enum handling)
Defines what Handler should do in case of gap in real-time (incremental) data.
SessionSettings & instrumentRecovery(InstrumentRecoveryOptions::Enum recovery)
Defines how instrument definitions are recovered.
void assignNoControlLegacy(const SessionSettings &other)
~SessionSettings()
Cleans everything up.
InstrumentRecoveryOptions::Enum instrumentRecovery() const
Indicates how instrument definitions are recovered.
SessionSettings(const SessionSettings &other)
Re-initializes settings as copies of the other ones omitting group belonging.
const SettingGroup & group() const
Instance of the group to which the given settings belongs.
JoinRecoveryOptions::Enum joinRecovery() const
Defines aspects of recovery to be done at market join stage.
const TcpRecoverySessionSettings & tcpRecovery() const
Set of TCP recovery settings.
SessionSettings & joinRecovery(JoinRecoveryOptions::Enum recovery)
Defines aspects of recovery to be done at market join stage.
SessionSettings(SettingChangeController *controller=nullptr)
Initializes parameters with default values.
void assignNoControl(const SessionSettings &other)
Re-initializes the instance as a copy of the other one and bypassing assignment control.
GapAndErrorHandlingOptions::Enum gapAndErrorHandling() const
Defines what Handler should do in case of gap in real-time (incremental) data.
MarketRecoveryOptions::Enum marketRecovery() const
Defines selected market recovery options.
TcpRecoverySessionSettings & tcpRecovery()
Editable set of TCP recovery settings.
SessionSettings & operator=(const SessionSettings &other)
Copies settings from the given instance.
Base services for settings grouped by a certain criteria.
SettingGroup(SettingChangeController *controller=nullptr)
Initializes the group of settings with the given validation services.
Collection of session settings related to TCP recovery.
~TcpRecoverySessionSettings()
Finalizes the instance.
TcpRecoverySessionSettings(const SettingGroup *group=nullptr)
Initializes the instance with the default values.
TcpRecoverySessionSettings & operator=(const TcpRecoverySessionSettings &other)
Re-initializes as a copy of the other one.
TcpRecoveryService * service() const
An instance of the TCP recovery service if there's any associated.
UInt32 servingTimeLimit() const
Amount of time allocated to process a recovery request.
TcpRecoverySessionSettings & service(TcpRecoveryService *service)
Associates the instance of the TCP Recovery service to be used by a Handler during market data proces...
TcpRecoverySessionSettings & servingTimeLimit(UInt32 servingTimeLimit)
Amount of time allocated to process a recovery request.
UInt32 attempts() const
Number of times a Handler must try to recover missing data using the TCP recovery before it switches ...
friend class SessionSettings
Lets grouping and value assignment control functioning.
TcpRecoverySessionSettings & attempts(UInt32 qty)
Updates number of times a Handler must try to recover missing data using the TCP recovery before it s...
TcpRecoverySessionSettings(const TcpRecoverySessionSettings &other)
Initializes the instance as a copy of the other one.
void setSessionToRecoverInstrumentsFast(SessionSettings &settings)
Updates session settings to tell the Handler to recover instruments using fast strategy each time ins...
void setSessionToJoinInPreopening(SessionSettings &settings)
Updates session settings to tell the Handler to skip join-time recovery and switch processing increme...
void setSessionToRecoverMboBooksOnly(SessionSettings &settings)
Updates session settings to recover MBO books only each time the Handler recovers market state from s...
void setSessionToRecoverMbpBooksOnly(SessionSettings &settings)
Updates session settings to recover MBP books only each time the Handler recovers market state from s...
void setSessionToNaturalRefresh(SessionSettings &settings)
Configures session settings to maintain order books using natural refresh.
void setSessionToFullRecoverUponRealtimeIssues(SessionSettings &settings)
Updates session settings to tell the Handler to recover instruments and market state (books) in case ...
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
void setSessionToRecoverBothMboAndMbpBooks(SessionSettings &settings)
Updates session settings to recover books of all types each time the Handler recovers market state fr...
void setSessionToRecoverInstrumentsAccurately(SessionSettings &settings)
Various functions helping in configuring session in the desired way.
UInt32 UInt32
uInt32.
Definition Fields.h:202
void setSessionToContinueRealtimeProcessingUponIssues(SessionSettings &settings)
Updates session settings to tell the Handler continue processing incremental (real-time) data in case...
void setSessionToLateJoin(SessionSettings &settings)
Updates session settings to tell the Handler to recover instruments and market state before it switch...
void setSessionToRecoverBooksUponRealtimeIssues(SessionSettings &settings)
Updates session settings to tell the Handler to recover market state (books) in case of gap or other ...
void setSessionToAccurateLateJoin(SessionSettings &settings)
Configures session to maintain order books accurately and considering market data processing is start...
void setSessionToAccuratePreopening(SessionSettings &settings)
Configures session to maintain order books accurately and without performing initial (late-join) reco...
AccurateLateJoinMboSession()
Configures session settings according to specialization.
AccurateLateJoinMbpSession()
Configures session settings according to specialization.
AccurateLateJoinSession()
Configures session settings according to specialization.
AccuratePreopeningMboSession()
Configures session settings according to specialization.
AccuratePreopeningMbpSession()
Configures session settings according to specialization.
AccuratePreopeningSession()
Configures session settings according to specialization.
Defines the way Handler has to handle gap in real-time (incremental) data.
Enum
Defines the way Handler has to handle gap in real-time (incremental) data.
@ ContinueProcessing
Handler continues processing of real-time market data.
@ RecoverMarketState
Handler recovers market state from snapshots.
@ RecoverInstrumentsAndMarketState
Handler recovers instruments and market state afterwards.
Defines different ways of instrument definition recovery.
@ Fast
The fast mode allows to start processing instrument definitions from the middle of a recovery loop wi...
@ Accurate
The given strategy tells the Handler to recover instruments in the most accurate way.
Defines type of recovery to be done by Handler at the time it joins market.
Enum
Defines type of recovery to be done by Handler while it joins market.
@ InstrumentsAndMarketState
Instructs Handler to perform full recovery (both instruments and market state (books,...
@ Instruments
Instructs Handler to recover instruments before switching to real-time (incremental data) processing.
@ Disabled
No recovery is to be done at join time.
Defines market state recovery options.
@ MboOnly
Only market by order books will be recovered during market state recovery.
@ BothMboAndMbp
Both market by price and market by order books will be recovered during market state recovery.
@ MbpOnly
Only market by price books will be recovered during market state recovery.
NaturalRefreshSession()
Configures session settings according to specialization.
Represents a service controlling change/update operations for the collections of settings.