243 lines
5.9 KiB
C++
243 lines
5.9 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 <OnixS/CME/MDH/Domain.h>
|
|
|
|
#include <OnixS/CME/MDH/FeedSettings.h>
|
|
|
|
#include <OnixS/CME/MDH/BookManagement.h>
|
|
#include <OnixS/CME/MDH/TradeProcessing.h>
|
|
|
|
#include <OnixS/CME/MDH/HandlerDebugLogging.h>
|
|
|
|
#include <OnixS/CME/MDH/MemoryPoolSettings.h>
|
|
|
|
ONIXS_CMEMDH_NAMESPACE_BEGIN
|
|
|
|
/// Handler's configuration settings.
|
|
ONIXS_CMEMDH_LTWT_CLASS HandlerSettings
|
|
{
|
|
ChannelId channel_;
|
|
|
|
FeedSettings feeds_;
|
|
|
|
TradeProcessing::Enum tradeProcessing_;
|
|
BookManagement bookManagement_;
|
|
|
|
UInt32 recoveryQueueMaxSize_;
|
|
std::string instrumentCache_;
|
|
|
|
HandlerDebugLoggingSettings debugLogging_;
|
|
|
|
MemoryPoolSettings memoryPool_;
|
|
|
|
public:
|
|
/// Initializes parameters with default values.
|
|
HandlerSettings()
|
|
: channel_(0)
|
|
, tradeProcessing_(
|
|
TradeProcessing::SummaryLevel)
|
|
, recoveryQueueMaxSize_(1000000)
|
|
{
|
|
}
|
|
|
|
/// Cleans everything up.
|
|
~HandlerSettings()
|
|
{
|
|
}
|
|
|
|
/// Identifies CME market data channel.
|
|
ChannelId channel() const
|
|
{
|
|
return channel_;
|
|
}
|
|
|
|
/// Identifies CME market data channel.
|
|
void channel(ChannelId value)
|
|
{
|
|
channel_ = value;
|
|
}
|
|
|
|
/// Reference to parameters related with feeds.
|
|
const
|
|
FeedSettings&
|
|
feeds() const
|
|
{
|
|
return feeds_;
|
|
}
|
|
|
|
/// Reference to parameters related with feeds.
|
|
FeedSettings&
|
|
feeds()
|
|
{
|
|
return feeds_;
|
|
}
|
|
|
|
/// Indicates how trades are processed.
|
|
TradeProcessing::Enum
|
|
tradeProcessing() const
|
|
{
|
|
return tradeProcessing_;
|
|
}
|
|
|
|
/// Defines how trades are processed.
|
|
void
|
|
tradeProcessing(
|
|
TradeProcessing::Enum strategy)
|
|
{
|
|
tradeProcessing_ = strategy;
|
|
}
|
|
|
|
/// Reference to parameters affecting book management.
|
|
const
|
|
BookManagement&
|
|
bookManagement() const
|
|
{
|
|
return bookManagement_;
|
|
}
|
|
|
|
/// Reference to parameters affecting book management.
|
|
BookManagement&
|
|
bookManagement()
|
|
{
|
|
return bookManagement_;
|
|
}
|
|
|
|
/// Maximum number of packets transmitted via
|
|
/// incremental feed to be hold in internal queue
|
|
/// while market state is recovered from snapshots.
|
|
///
|
|
/// When Handler recovers order books from snapshots,
|
|
/// the given parameter limits the size of the internal
|
|
/// queue used by the Handler to keep packets coming from
|
|
/// incremental feeds. Upon reaching limit, newer packets
|
|
/// substitute older ones.
|
|
///
|
|
/// @note The default value is 1000000.
|
|
UInt32
|
|
recoveryQueueMaxSize() const
|
|
{
|
|
return recoveryQueueMaxSize_;
|
|
}
|
|
|
|
/// Maximum number of packets to be hold in the internal
|
|
/// queue used by the Handler while processing incoming data.
|
|
void
|
|
recoveryQueueMaxSize(
|
|
UInt32 queueMaxSize)
|
|
{
|
|
recoveryQueueMaxSize_ = queueMaxSize;
|
|
}
|
|
|
|
/// Path to the file where the Handler
|
|
/// must store security definitions for
|
|
/// further use instead of a live instrument
|
|
/// feed while recovering definitions due
|
|
/// to late join.
|
|
///
|
|
/// If path is not defined, the Handler
|
|
/// will not cache instrument definitions.
|
|
///
|
|
/// @note The default value is empty string.
|
|
///
|
|
/// @warning If this option is activated, then
|
|
/// it is recommended to remove the cache file
|
|
/// weekly to start the trading week with the
|
|
/// fresh copy of security definitions.
|
|
const
|
|
std::string&
|
|
instrumentCache() const
|
|
{
|
|
return instrumentCache_;
|
|
}
|
|
|
|
/// Updates option to use file-based
|
|
/// caching of the security definitions.
|
|
void
|
|
instrumentCache(
|
|
const std::string& filename)
|
|
{
|
|
instrumentCache_ = filename;
|
|
}
|
|
|
|
/// Parameters affecting logging at debug level.
|
|
HandlerDebugLoggingSettings&
|
|
debugLogging()
|
|
{
|
|
return debugLogging_;
|
|
}
|
|
|
|
/// Parameters affecting logging at debug level.
|
|
const
|
|
HandlerDebugLoggingSettings&
|
|
debugLogging() const
|
|
{
|
|
return debugLogging_;
|
|
}
|
|
|
|
/// Parameters affecting behavior of memory pool
|
|
/// used by Handler while processing market data.
|
|
MemoryPoolSettings&
|
|
memoryPool()
|
|
{
|
|
return memoryPool_;
|
|
}
|
|
|
|
/// Parameters affecting behavior of memory pool
|
|
/// used by Handler while processing market data.
|
|
const
|
|
MemoryPoolSettings&
|
|
memoryPool() const
|
|
{
|
|
return memoryPool_;
|
|
}
|
|
};
|
|
|
|
/// Serializes BBA tracking parameters into string.
|
|
ONIXS_CMEMDH_EXPORTED
|
|
void
|
|
toStr(
|
|
std::string&,
|
|
const HandlerSettings&);
|
|
|
|
/// Serializes BBA tracking parameters into string.
|
|
inline
|
|
std::string
|
|
toStr(
|
|
const HandlerSettings& settings)
|
|
{
|
|
std::string str;
|
|
|
|
toStr(str, settings);
|
|
|
|
return str;
|
|
}
|
|
|
|
/// Makes filename for instrument cache for the given channel.
|
|
ONIXS_CMEMDH_EXPORTED
|
|
std::string
|
|
makeInstrumentCacheFilename(ChannelId);
|
|
|
|
ONIXS_CMEMDH_NAMESPACE_END
|