// Copyright Onix Solutions Limited [OnixS]. All rights reserved. // // This software owned by Onix Solutions Limited [OnixS] and is // protected by copyright law and international copyright treaties. // // Access to and use of the software is governed by the terms of the applicable // OnixS Software Services Agreement (the Agreement) and Customer end user license // agreements granting a non-assignable, non-transferable and non-exclusive license // to use the software for it's own data processing purposes under the terms defined // in the Agreement. // // Except as otherwise granted within the terms of the Agreement, copying or // reproduction of any part of this source code or associated reference material // to any other location for further reproduction or redistribution, and any // amendments to this copyright notice, are expressly prohibited. // // Any reproduction or redistribution for sale or hiring of the Software not in // accordance with the terms of the Agreement is a violation of copyright law. // #pragma once #include #include ONIXS_CMEMDH_NAMESPACE_BEGIN /// Defines type of recovery to be done /// by Handler at the time it joins market. ONIXS_CMEMDH_LTWT_STRUCT JoinRecoveryOptions { /// Integral type serving as /// basement for given enumeration. typedef UInt32 Base; /// Defines type of recovery to be done /// by Handler while it joins market. enum Enum { /// No recovery is to be done at join time. /// Handler will switch to real-time data /// processing immediately. Disabled, /// Instructs Handler to recover instruments before /// switching to real-time (incremental data) processing. Instruments, /// Instructs Handler to perform full recovery (both instruments /// and market state (books, last trades, statistics, etc)) /// before switching to real-time (incremental) data processing. InstrumentsAndMarketState }; }; /// Serializes join recovery option. ONIXS_CMEMDH_EXPORTED void toStr( std::string&, JoinRecoveryOptions::Enum); /// Serializes join recovery option. inline std::string toStr( JoinRecoveryOptions::Enum recovery) { std::string str; toStr(str, recovery); return str; } /// Defines the way Handler has to handle /// gap in real-time (incremental) data. ONIXS_CMEMDH_LTWT_STRUCT GapAndErrorHandlingOptions { /// Integral type serving as /// basement for given enumeration. typedef UInt32 Base; /// Defines the way Handler has to handle /// gap in real-time (incremental) data. enum Enum { /// Handler recovers market state from snapshots. RecoverMarketState, /// Handler recovers instruments and market state afterwards. RecoverInstrumentsAndMarketState, /// Handler continues processing of real-time market data. ContinueProcessing }; }; /// Serializes gap and error handling option. ONIXS_CMEMDH_EXPORTED void toStr( std::string&, GapAndErrorHandlingOptions::Enum); /// Serializes gap and error handling option. inline std::string toStr( GapAndErrorHandlingOptions::Enum handling) { std::string str; toStr(str, handling); return str; } /// Defines market state recovery options. ONIXS_CMEMDH_LTWT_STRUCT MarketRecoveryOptions { /// Integral type serving as /// basement for given enumeration. typedef UInt32 Base; enum Enum { /// Only market by price books will be /// recovered during market state recovery. MbpOnly, /// Only market by order books will be /// recovered during market state recovery. MboOnly, /// Both market by price and market by order /// books will be recovered during market /// state recovery. BothMboAndMbp }; }; /// Serializes market recovery option. ONIXS_CMEMDH_EXPORTED void toStr( std::string&, MarketRecoveryOptions::Enum); /// Serializes market recovery option. inline std::string toStr( MarketRecoveryOptions::Enum option) { std::string str; toStr(str, option); return str; } /// Set of parameters affecting Handler's behavior /// when market data processing session is spawned. ONIXS_CMEMDH_LTWT_CLASS SessionSettings { JoinRecoveryOptions::Enum joinRecovery_; GapAndErrorHandlingOptions::Enum gapAndErrorHandling_; MarketRecoveryOptions::Enum marketRecovery_; public: /// Initializes parameters with default values. SessionSettings() : joinRecovery_( JoinRecoveryOptions:: InstrumentsAndMarketState) , gapAndErrorHandling_( GapAndErrorHandlingOptions:: RecoverMarketState) , marketRecovery_( MarketRecoveryOptions::BothMboAndMbp) { } /// Cleans everything up. ~SessionSettings() { } /// Defines aspects of recovery to be done at market join stage. /// /// @note Default value is JoinRecovery::InstrumentsAndMarket. JoinRecoveryOptions::Enum joinRecovery() const { return joinRecovery_; } /// Defines aspects of recovery to be done at market join stage. void joinRecovery( JoinRecoveryOptions::Enum recovery) { joinRecovery_ = recovery; } /// Defines what Handler should do in case /// of gap in real-time (incremental) data. /// /// @note Default value is GapAndErrorHandling::RecoverMarketState. GapAndErrorHandlingOptions::Enum gapAndErrorHandling() const { return gapAndErrorHandling_; } /// Defines what Handler should do in case /// of gap in real-time (incremental) data. void gapAndErrorHandling( GapAndErrorHandlingOptions::Enum handling) { gapAndErrorHandling_ = handling; } /// Defines selected market recovery options. /// /// @note Default value is MarketRecovery::BothMboAndMbp. MarketRecoveryOptions::Enum marketRecovery() const { return marketRecovery_; } /// Defines market recovery options. void marketRecovery( MarketRecoveryOptions::Enum recovery) { marketRecovery_ = recovery; } }; /// Serializes market data processing session settings. ONIXS_CMEMDH_EXPORTED void toStr( std::string&, const SessionSettings&); /// Serializes market data processing session settings. inline std::string toStr( const SessionSettings& settings) { std::string str; toStr(str, settings); return str; } // /// Settings for session with accurate book /// maintenance and considering market data /// processing is started from the beginning /// of weekly session. ONIXS_CMEMDH_LTWT_CLASS AccuratePreopeningSession : public SessionSettings { using SessionSettings:: joinRecovery; using SessionSettings:: gapAndErrorHandling; public: /// Configures session settings /// according to specialization. AccuratePreopeningSession() { joinRecovery( JoinRecoveryOptions:: Disabled); gapAndErrorHandling( GapAndErrorHandlingOptions:: RecoverMarketState); } }; /// Settings for session with accurate book maintenance /// and considering market data processing is started /// from the beginning of weekly session. Market recovery /// is limited to recovery market by order books only. ONIXS_CMEMDH_LTWT_STRUCT AccuratePreopeningMboSession : AccuratePreopeningSession { /// Configures session settings /// according to specialization. AccuratePreopeningMboSession() { marketRecovery( MarketRecoveryOptions:: MboOnly); } }; /// Settings for session with accurate book maintenance /// and considering market data processing is started /// from the beginning of weekly session. Market recovery /// is limited to recovery market by price books only. ONIXS_CMEMDH_LTWT_STRUCT AccuratePreopeningMbpSession : AccuratePreopeningSession { /// Configures session settings /// according to specialization. AccuratePreopeningMbpSession() { marketRecovery( MarketRecoveryOptions:: MbpOnly); } }; /// Settings for session with accurate book /// maintenance and considering market data /// processing is started at the middle of /// weekly session (late join). ONIXS_CMEMDH_LTWT_CLASS AccurateLateJoinSession : public SessionSettings { using SessionSettings:: joinRecovery; using SessionSettings:: gapAndErrorHandling; public: /// Configures session settings /// according to specialization. AccurateLateJoinSession() : SessionSettings() { joinRecovery( JoinRecoveryOptions:: InstrumentsAndMarketState); gapAndErrorHandling( GapAndErrorHandlingOptions:: RecoverMarketState); } }; /// Settings for session with accurate book maintenance /// and considering market data processing is started at /// the middle of weekly session (late join). Market recovery /// is limited to recover market by order books only. ONIXS_CMEMDH_LTWT_STRUCT AccurateLateJoinMboSession : AccurateLateJoinSession { /// Configures session settings /// according to specialization. AccurateLateJoinMboSession() { marketRecovery( MarketRecoveryOptions:: MboOnly); } }; /// Settings for session with accurate book maintenance /// and considering market data processing is started at /// the middle of weekly session (late join). Market recovery /// is limited to recover market by price books only. ONIXS_CMEMDH_LTWT_STRUCT AccurateLateJoinMbpSession : AccurateLateJoinSession { /// Configures session settings /// according to specialization. AccurateLateJoinMbpSession() { marketRecovery( MarketRecoveryOptions:: MbpOnly); } }; /// Configures session settings to maintain /// order books using natural refresh. Startup /// recovery is not performed and thus only /// real-time processing takes place. ONIXS_CMEMDH_LTWT_CLASS NaturalRefreshSession : public SessionSettings { using SessionSettings:: joinRecovery; using SessionSettings:: gapAndErrorHandling; public: /// Configures session settings /// according to specialization. NaturalRefreshSession() : SessionSettings() { joinRecovery( JoinRecoveryOptions::Disabled); gapAndErrorHandling( GapAndErrorHandlingOptions:: ContinueProcessing); } }; ONIXS_CMEMDH_NAMESPACE_END