185 lines
6.0 KiB
C++
185 lines
6.0 KiB
C++
// 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 <memory>
|
|
|
|
#include <OnixS/CME/MDH/Bootstrap.h>
|
|
|
|
ONIXS_CMEMDH_NAMESPACE_BEGIN
|
|
|
|
ONIXS_CMEMDH_EXPORTED_CLASS_DECL(FeedEngine);
|
|
ONIXS_CMEMDH_EXPORTED_CLASS_DECL(TcpRecoveryService);
|
|
ONIXS_CMEMDH_EXPORTED_CLASS_DECL(Logger);
|
|
|
|
ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(HandlerListener);
|
|
ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(FeedListener);
|
|
|
|
ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(MarketDataListener);
|
|
ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(SecurityListener);
|
|
|
|
ONIXS_CMEMDH_LTWT_CLASS_DECL(HandlerSettings);
|
|
|
|
ONIXS_CMEMDH_LTWT_CLASS_DECL(SessionSettings);
|
|
ONIXS_CMEMDH_LTWT_CLASS_DECL(ReplaySettings);
|
|
|
|
ONIXS_CMEMDH_LTWT_CLASS_DECL(InstrumentSelection);
|
|
|
|
ONIXS_CMEMDH_INTERNAL_CLASS_DECL(ChannelModel);
|
|
|
|
/// Encapsulates all the machinery related with market
|
|
/// data processing from CME Market Data Platform.
|
|
ONIXS_CMEMDH_EXPORTED_CLASS Handler
|
|
{
|
|
// Data processing workhorse.
|
|
ChannelModel* model_;
|
|
|
|
public:
|
|
/// Initializes instance according to given settings.
|
|
explicit Handler(
|
|
const HandlerSettings&);
|
|
|
|
/// Finalizes instance usage.
|
|
~Handler();
|
|
|
|
/// Configuration settings of given instance.
|
|
const HandlerSettings& settings() const;
|
|
|
|
/// Logger currently used by the Handler.
|
|
Logger& logger();
|
|
|
|
/// Filters instruments whose market data
|
|
/// is to be processed and events are to be
|
|
/// fired by the Handler.
|
|
///
|
|
/// @warning Instrument selection can be updated
|
|
/// only when market data processing is not performed
|
|
/// by the Handler or upon successful instrument
|
|
/// recovery completion.
|
|
void
|
|
selectInstruments(
|
|
const InstrumentSelection&);
|
|
|
|
/// Registers Handler 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 std::exception in case when handler is not in configurable state.
|
|
void
|
|
registerListener(
|
|
HandlerListener& listener);
|
|
|
|
/// Registers feed 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 std::exception in case when handler is not in configurable state.
|
|
void
|
|
registerFeedListener(
|
|
FeedListener& listener);
|
|
|
|
/// Registers market data 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 std::exception in case when handler is not in configurable state.
|
|
void
|
|
registerMarketDataListener(
|
|
MarketDataListener& listener);
|
|
|
|
/// Registers security 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 std::exception in case when handler is not in configurable state.
|
|
void
|
|
registerSecurityListener(
|
|
SecurityListener& listener);
|
|
|
|
/// Binds Feed Engine to the Handler.
|
|
///
|
|
/// Handler must be in stopped state.
|
|
///
|
|
/// @throw std::exception in case when handler is not in configurable state.
|
|
void
|
|
bindFeedEngine(
|
|
FeedEngine& feedEngine);
|
|
|
|
/// Binds TCP Recovery Service to the Handler.
|
|
///
|
|
/// Handler must be in stopped state.
|
|
///
|
|
/// @throw std::exception in case when handler is not in configurable state.
|
|
void
|
|
bindTcpRecovery(
|
|
TcpRecoveryService& tcpRecovery);
|
|
|
|
/// Binds Logging Service to the Handler.
|
|
///
|
|
/// Handler must be in stopped state.
|
|
///
|
|
/// @throw std::exception in case when handler is not in configurable state.
|
|
void
|
|
bindLogger(
|
|
Logger& logger);
|
|
|
|
/// Erases instrument definitions cache if used.
|
|
/// Handler will produce a new cache at next start.
|
|
void clearInstrumentCache();
|
|
|
|
/// Starts market data processing according to given parameters.
|
|
void
|
|
start(
|
|
const SessionSettings&);
|
|
|
|
/// Stops the Handler.
|
|
void stop();
|
|
|
|
/// Processes market data stored in log
|
|
/// files according to specified settings.
|
|
void
|
|
replay(
|
|
const ReplaySettings&);
|
|
};
|
|
|
|
ONIXS_CMEMDH_NAMESPACE_END
|