860 lines
38 KiB
C++
Executable File
860 lines
38 KiB
C++
Executable File
// 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 <string>
|
|
#include <set>
|
|
|
|
#include "OnixS/CME/MDP3/Types.h"
|
|
#include "OnixS/CME/MDP3/BBA.h"
|
|
#include "OnixS/CME/MDP3/DirectBook.h"
|
|
#include "OnixS/CME/MDP3/ImpliedBook.h"
|
|
#include "OnixS/CME/MDP3/ConsolidatedBook.h"
|
|
|
|
namespace OnixS
|
|
{
|
|
namespace CME
|
|
{
|
|
namespace MDP3
|
|
{
|
|
ONIXS_CME_MDP3_API_DECL(struct, HandlerSettings);
|
|
ONIXS_CME_MDP3_API_DECL(struct, ReplayOptions);
|
|
|
|
ONIXS_CME_MDP3_API_DECL(struct, DirectBestBidAskTrackingOptions);
|
|
ONIXS_CME_MDP3_API_DECL(struct, ImpliedBestBidAskTrackingOptions);
|
|
|
|
ONIXS_CME_MDP3_API_DECL(class, DirectBookChangeListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, ImpliedBookChangeListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, DirectBookUpdateListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, ImpliedBookUpdateListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, ConsolidatedBookUpdateListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, ErrorListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, WarningListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, HandlerStateChangeListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, MessageProcessingListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, SecurityDefinitionListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, StatisticsListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, SecurityStatusListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, TradeListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, OrderIdListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, ElectronicVolumeListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, RequestForQuoteListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, FeedEngineListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, EventMessageListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, EventListener);
|
|
ONIXS_CME_MDP3_API_DECL(class, FeedListener);
|
|
|
|
ONIXS_CME_MDP3_API_DECL(class, Timestamp);
|
|
ONIXS_CME_MDP3_API_DECL(class, FeedEngine);
|
|
ONIXS_CME_MDP3_API_DECL(class, TcpRecoveryService);
|
|
ONIXS_CME_MDP3_API_DECL(class, AsyncLogService);
|
|
|
|
/// Export/Import template instantiations.
|
|
struct
|
|
ONIXS_CME_MDP3_API
|
|
FilteringTraits
|
|
{
|
|
typedef
|
|
std::set<SecurityId>
|
|
SecurityIdFilters;
|
|
|
|
typedef
|
|
std::set<std::string>
|
|
TextFilters;
|
|
};
|
|
|
|
typedef
|
|
FilteringTraits::SecurityIdFilters
|
|
SecurityIdFilters;
|
|
|
|
typedef
|
|
FilteringTraits::TextFilters
|
|
SecuritySymbolFilters;
|
|
|
|
typedef
|
|
FilteringTraits::TextFilters
|
|
SecurityGroupFilters;
|
|
|
|
typedef
|
|
FilteringTraits::TextFilters
|
|
SecurityAssetFilters;
|
|
|
|
/// Set of options affecting behavior of the Handler
|
|
/// while maintaining order books by natural refresh.
|
|
struct
|
|
ONIXS_CME_MDP3_API
|
|
NaturalRefreshOptions
|
|
{
|
|
/// Makes Handler to use Instrument Definition Replay
|
|
/// Feed for security definitions recovery.
|
|
///
|
|
/// @note Default value is 'true'.
|
|
bool useInstrumentFeed() const
|
|
{
|
|
return useInstrumentFeed_;
|
|
}
|
|
|
|
/// Sets useInstrumentFeed. @see useInstrumentFeed.
|
|
void useInstrumentFeed(bool value)
|
|
{
|
|
useInstrumentFeed_ = value;
|
|
}
|
|
|
|
/// Path to file containing instrument definitions.
|
|
///
|
|
/// Data (instrument definitions) accepted in format
|
|
/// as it's defined by CME (secdef.dat).
|
|
///
|
|
/// @note This setting is ignored if
|
|
/// NaturalRefreshOptions::useInstrumentFeed() set to true.
|
|
///
|
|
/// @warning CME strongly discourages usage of secdef.dat in
|
|
/// production, it's considered legacy feature. Please avoid
|
|
/// its usage if possible.
|
|
///
|
|
/// If value is not specified and Intrument Feed is not used,
|
|
/// Handler starts with empty instrument definitions set.
|
|
/// This case is suitable for processing market data from the
|
|
/// beginning of weekly session, when MDP transmits
|
|
/// instrument definitions via real-time (incremental)
|
|
/// feeds.
|
|
///
|
|
/// If market data processing using natural refresh is
|
|
/// launched at the middle of the week (late join case),
|
|
/// it's preferred to use Instrument Definition Replay Feed
|
|
/// or instrument definitions file specified (not recommended by CME)
|
|
/// because otherwise Handler will apply default values for order
|
|
/// book depths which may lead to inconsistencies in order books.
|
|
const std::string& definitionsFile() const
|
|
{
|
|
return *definitionsFile_;
|
|
}
|
|
|
|
/// Sets definitionsFile. @see definitionsFile.
|
|
void definitionsFile(const std::string& value)
|
|
{
|
|
*definitionsFile_ = value;
|
|
}
|
|
|
|
/// Initializes options with default values.
|
|
NaturalRefreshOptions();
|
|
|
|
/// Cleans everything up.
|
|
~NaturalRefreshOptions();
|
|
|
|
/// Returns textual presentation.
|
|
std::string toString() const
|
|
{
|
|
std::string str;
|
|
toString(str);
|
|
return str;
|
|
}
|
|
|
|
/// Returns textual presentation.
|
|
void toString(std::string&) const;
|
|
|
|
private:
|
|
bool useInstrumentFeed_;
|
|
Exportable<std::string> definitionsFile_;
|
|
};
|
|
|
|
/// Market joining strategies.
|
|
struct
|
|
ONIXS_CME_MDP3_API
|
|
HandlerStartupStrategies
|
|
{
|
|
enum Enum
|
|
{
|
|
/// Identifies early joining.
|
|
|
|
/// For a startup prior to the weekly market open,
|
|
/// all market data including book updates, statistics,
|
|
/// quotes, instrument definitions, trades, instrument/
|
|
/// instrument group, status) are disseminated through
|
|
/// the Incremental UDP Feed A and Feed B, so there is
|
|
/// no need to use neither Security Definition Channel
|
|
/// nor Market Data Recovery Channel.
|
|
PreOpening,
|
|
|
|
/// Identifies late joining which causes
|
|
/// Handler to use recovery channels to get
|
|
/// up-to-date market state.
|
|
LateJoin
|
|
};
|
|
|
|
/// Deserializes constant from string representation.
|
|
static Enum deserialize(const char*);
|
|
|
|
/// Returns string representation of constant.
|
|
static const char* toString(Enum);
|
|
};
|
|
|
|
/// Market joining strategies.
|
|
typedef
|
|
HandlerStartupStrategies::Enum
|
|
HandlerStartupStrategy;
|
|
|
|
/// Statistics on incremental market data processing.
|
|
class
|
|
ONIXS_CME_MDP3_API
|
|
PendingMarketDataInfo
|
|
{
|
|
public:
|
|
/// Initializes blank instance.
|
|
PendingMarketDataInfo()
|
|
: bufferedPacketsCount_(0),
|
|
cachedOutOfOrderPacketsCount_(0)
|
|
{
|
|
}
|
|
|
|
/// Number of packets already received by the Handler
|
|
/// from all incremental feeds but not yet processed.
|
|
///
|
|
/// Handler may receive packets on a background while processing
|
|
/// already received market data to avoid overflow of socket buffers.
|
|
/// If processing is slowed down, number of buffered packets may grow.
|
|
/// Buffered packets may contain duplicates especially if both feeds
|
|
/// A and B are enabled. Packets buffering is limited to one packet
|
|
/// per feed if direct packets pulling strategy is used by the Handler.
|
|
/// See documentation on packets pulling strategies for more information.
|
|
size_t
|
|
bufferedPacketsCount() const
|
|
{
|
|
return bufferedPacketsCount_;
|
|
}
|
|
|
|
/// Updates number of packets already received by the Handler
|
|
/// from all incremental feeds but not yet processed.
|
|
void
|
|
bufferedPacketsCount(size_t count)
|
|
{
|
|
bufferedPacketsCount_ = count;
|
|
}
|
|
|
|
/// Number of out of order packets cached by Handler.
|
|
///
|
|
/// When out of order packet is received or gap occurs,
|
|
/// Handler waits for a certain time to let potentially
|
|
/// missed data get received. While waiting on data,
|
|
/// packets are being cached.
|
|
size_t
|
|
cachedOutOfOrderPacketsCount() const
|
|
{
|
|
return cachedOutOfOrderPacketsCount_;
|
|
}
|
|
|
|
/// Updates number of out of order packets cached by Handler.
|
|
void
|
|
cachedOutOfOrderPacketsCount(size_t count)
|
|
{
|
|
cachedOutOfOrderPacketsCount_ = count;
|
|
}
|
|
|
|
/// Serializes to string presentation.
|
|
std::string toString() const
|
|
{
|
|
std::string str;
|
|
toString(str);
|
|
return str;
|
|
}
|
|
|
|
/// Serializes to string presentation.
|
|
void toString(std::string& presentation) const;
|
|
|
|
private:
|
|
size_t bufferedPacketsCount_;
|
|
size_t cachedOutOfOrderPacketsCount_;
|
|
};
|
|
|
|
/// Interface for user-defined watch service to be used by Handler.
|
|
struct
|
|
ONIXS_CME_MDP3_API
|
|
WatchService
|
|
{
|
|
/// Gets current time as Timestamp object.
|
|
virtual Timestamp now() = 0;
|
|
|
|
/// Cleans up instance.
|
|
virtual ~WatchService()
|
|
{}
|
|
};
|
|
|
|
/// Encapsulates all the machinery related with market
|
|
/// data processing from CME Market Data Platform.
|
|
class
|
|
ONIXS_CME_MDP3_API
|
|
Handler
|
|
{
|
|
public:
|
|
/// Initializes instance according to given settings.
|
|
Handler(const HandlerSettings& settings);
|
|
|
|
/// Finalizes instance usage.
|
|
~Handler();
|
|
|
|
/// Adds Security Id filtering value.
|
|
///
|
|
/// @note The filter is inclusive.
|
|
void addSecurityIdFilter(SecurityId id);
|
|
|
|
/// Removes Security Id filter.
|
|
void removeSecurityIdFilter(SecurityId id);
|
|
|
|
/// Removes all Security Id filters.
|
|
void removeAllSecurityIdFilters();
|
|
|
|
/// Fills given collection with the registered Security Id filters.
|
|
void getSecurityIdFilters(SecurityIdFilters* filters) const;
|
|
|
|
/// Adds Security Symbol filtering value.
|
|
///
|
|
/// @note The filter is inclusive.
|
|
void addSecuritySymbolFilter(const std::string& symbol);
|
|
|
|
/// Removes Security Symbol filter.
|
|
void removeSecuritySymbolFilter(const std::string& symbol);
|
|
|
|
/// Removes all Security Symbol filters.
|
|
void removeAllSecuritySymbolFilters();
|
|
|
|
/// Fills given collection with the registered Security Symbol filters.
|
|
void getSecuritySymbolFilters(SecuritySymbolFilters* filters) const;
|
|
|
|
/// Adds Security Group filtering value.
|
|
///
|
|
/// @note The filter is inclusive.
|
|
void addSecurityGroupFilter(const std::string& group);
|
|
|
|
/// Removes Security Group filter.
|
|
void removeSecurityGroupFilter(const std::string& group);
|
|
|
|
/// Removes all Security Group filters.
|
|
void removeAllSecurityGroupFilters();
|
|
|
|
/// Fills given collection with the registered Security Group filters.
|
|
void getSecurityGroupFilters(SecurityGroupFilters* filters) const;
|
|
|
|
/// Adds Security Asset filtering value.
|
|
///
|
|
/// @note The filter is inclusive.
|
|
void addSecurityAssetFilter(const std::string& asset);
|
|
|
|
/// Removes Security Asset filter.
|
|
void removeSecurityAssetFilter(const std::string& asset);
|
|
|
|
/// Removes all Security Asset filters.
|
|
void removeAllSecurityAssetFilters();
|
|
|
|
/// Fills given collection with the registered Security Asset filters.
|
|
void getSecurityAssetFilters(SecurityAssetFilters* filters) const;
|
|
|
|
/// Log a debug message.
|
|
void logDebug(const std::string& message);
|
|
|
|
/// Log an error message.
|
|
void logError(const std::string& message);
|
|
|
|
/// Log an information message.
|
|
void logMessage(const std::string& message);
|
|
|
|
/// Log a warning message.
|
|
void logWarning(const std::string& message);
|
|
|
|
/// Backs up current log file without stopping the Handler.
|
|
void backupLog();
|
|
|
|
/// Registers the error listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerErrorListener(
|
|
ErrorListener* listener);
|
|
|
|
/// Registers the warning listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerWarningListener(
|
|
WarningListener* listener);
|
|
|
|
/// Registers the direct book change listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerDirectBookChangeListener(
|
|
DirectBookChangeListener* listener);
|
|
|
|
/// Registers the direct book change listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerDirectBookChangeListener(
|
|
DirectBookChangeListener* listener,
|
|
const DirectBestBidAskTrackingOptions& bbaTrackingOptions);
|
|
|
|
/// Registers the direct book update listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerDirectBookUpdateListener(
|
|
DirectBookUpdateListener* listener);
|
|
|
|
/// Registers the direct book update listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerDirectBookUpdateListener(
|
|
DirectBookUpdateListener* listener,
|
|
const DirectBestBidAskTrackingOptions& options);
|
|
|
|
/// Registers the implied book change listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerImpliedBookChangeListener(
|
|
ImpliedBookChangeListener* listener);
|
|
|
|
/// Registers the implied book change listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerImpliedBookChangeListener(
|
|
ImpliedBookChangeListener* listener,
|
|
const ImpliedBestBidAskTrackingOptions& options);
|
|
|
|
/// Registers the implied book update listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerImpliedBookUpdateListener(
|
|
ImpliedBookUpdateListener* listener);
|
|
|
|
/// Registers the implied book update listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerImpliedBookUpdateListener(
|
|
ImpliedBookUpdateListener* listener,
|
|
const ImpliedBestBidAskTrackingOptions& options);
|
|
|
|
/// Registers the consolidated book update listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerConsolidatedBookUpdateListener(
|
|
ConsolidatedBookUpdateListener* listener);
|
|
|
|
/// Registers the consolidated book update listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerConsolidatedBookUpdateListener(
|
|
ConsolidatedBookUpdateListener* listener,
|
|
const ConsolidatedBestBidAskTrackingOptions& options);
|
|
|
|
/// Registers the security definitions listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerSecurityDefinitionListener(
|
|
SecurityDefinitionListener* listener);
|
|
|
|
/// Registers the statistics listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerStatisticsListener(
|
|
StatisticsListener* listener);
|
|
|
|
/// Registers the security status listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerSecurityStatusListener(
|
|
SecurityStatusListener* listener);
|
|
|
|
/// Registers the trades listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerTradeListener(
|
|
TradeListener* listener);
|
|
|
|
/// Registers the Order IDs listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerOrderIdListener(
|
|
OrderIdListener* listener);
|
|
|
|
/// Registers the electronic volumes listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerElectronicVolumeListener(
|
|
ElectronicVolumeListener* listener);
|
|
|
|
/// Registers the Request For Quote listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerRequestForQuoteListener(
|
|
RequestForQuoteListener* listener);
|
|
|
|
/// Registers the market event listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerEventListener(
|
|
EventListener* listener);
|
|
|
|
/// Registers the market event message listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerEventMessageListener(
|
|
EventMessageListener* listener);
|
|
|
|
/// Registers the message processing listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerMessageProcessingListener(
|
|
MessageProcessingListener* listener);
|
|
|
|
/// Registers the Handler state change listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerStateChangeListener(
|
|
HandlerStateChangeListener* listener);
|
|
|
|
/// Registers feed engine events listener.
|
|
///
|
|
/// Listener instance is used only if private feed engine
|
|
/// is used by the Handler. Listener is ignored if shared
|
|
/// feed engine is binded to the Handler.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerFeedEngineListener(
|
|
FeedEngineListener* listener);
|
|
|
|
/// Registers market data feed events listener.
|
|
///
|
|
/// Only single instance of listener can be associated with
|
|
/// the Handler. Registering new listener removes previous one.
|
|
/// Listener instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Listeners are to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerFeedListener(
|
|
FeedListener* listener);
|
|
|
|
/// Registers user defined Watch Service to be used by Handler.
|
|
///
|
|
/// Only single instance of Watch Service can be associated with
|
|
/// the Handler. Registering new Watch Service removes previous one.
|
|
/// Watch Service instance lifetime shall be not less than Handler's one.
|
|
///
|
|
/// Watch Service is to be associated before starting market data
|
|
/// processing - Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
registerWatchService(
|
|
WatchService* watchService);
|
|
|
|
/// If security definitions cache is used,
|
|
/// cleans it up. The Handler will refresh
|
|
/// the cache during next execution.
|
|
void clearInstrumentDefinitionsCache();
|
|
|
|
/// Provides information on incremental market data processing state.
|
|
void getPendingMarketDataInfo(PendingMarketDataInfo& info);
|
|
|
|
/// Allows obtaining snapshot of direct book for given security.
|
|
///
|
|
/// Number of levels to be copied is limited by 'maxDepth' parameter.
|
|
/// Thus, it's possible to copy only a few levels instead of full book.
|
|
///
|
|
/// @return true if book was found for given security.
|
|
bool
|
|
directBookSnapshot(
|
|
SecurityId securityId,
|
|
DirectBookSnapshot& bookSnapshot,
|
|
MarketDepth maxDepth = MarketDepthTraits::MaxDepth);
|
|
|
|
/// Allows obtaining snapshot of implied book for given security.
|
|
///
|
|
/// Number of levels to be copied is limited by 'maxDepth' parameter.
|
|
/// Thus, it's possible to copy only a few levels instead of full book.
|
|
///
|
|
/// @return true if book was found for given security.
|
|
bool
|
|
impliedBookSnapshot(
|
|
SecurityId securityId,
|
|
ImpliedBookSnapshot& bookSnapshot,
|
|
MarketDepth maxDepth = MarketDepthTraits::MaxDepth);
|
|
|
|
/// Allows obtaining snapshot of consolidated book for given security.
|
|
///
|
|
/// Number of levels to be copied is limited by 'maxDepth' parameter.
|
|
/// Thus, it's possible to copy only a few levels instead of full book.
|
|
///
|
|
/// @return true if book was found for given security.
|
|
bool
|
|
consolidatedBookSnapshot(
|
|
SecurityId securityId,
|
|
ConsolidatedBookSnapshot& bookSnapshot,
|
|
MarketDepth maxDepth = MarketDepthTraits::MaxDepth);
|
|
|
|
/// Binds Feed Engine to be used by Handler.
|
|
/// instead of creating own instance.
|
|
///
|
|
/// Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
bindToFeedEngine(
|
|
FeedEngine* feedEngine);
|
|
|
|
/// Binds TCP Recovery Service to be used by Handler.
|
|
/// instead of creating own instance.
|
|
///
|
|
/// Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
bindToTcpRecoveryService(
|
|
TcpRecoveryService* tcpRecoveryService);
|
|
|
|
/// Binds Asynchronous Logging Service to be used by Handler.
|
|
/// All logging I/O operations of this handler instance will be performed
|
|
/// asynchronously by separate thread.
|
|
///
|
|
/// Handler must be in stopped state.
|
|
///
|
|
/// @throw Error in case when handler is not in configurable state.
|
|
void
|
|
bindToAsyncLogService(
|
|
AsyncLogService* asyncLogService);
|
|
|
|
/// Starts market data processing.
|
|
///
|
|
/// @param startupStrategy identifies strategy Handler
|
|
/// must use to join the market. By default, late joining
|
|
/// strategy is used.
|
|
void
|
|
start(
|
|
HandlerStartupStrategy startupStrategy =
|
|
HandlerStartupStrategies::LateJoin);
|
|
|
|
/// Starts market data processing in natural refresh.
|
|
///
|
|
/// @param options Natural Refresh Mode options.
|
|
void start(const NaturalRefreshOptions& options);
|
|
|
|
/// Starts replaying previously logged data.
|
|
///
|
|
/// @param options Log replay options.
|
|
void start(const ReplayOptions& options);
|
|
|
|
/// Stops the Handler.
|
|
void stop();
|
|
|
|
private:
|
|
class Implementation;
|
|
Implementation* impl_;
|
|
};
|
|
}
|
|
}
|
|
}
|