OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
IncrementalRefreshOrderBook.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 protected by copyright law
4// and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable OnixS Software
7// Services Agreement (the Agreement) and Customer end user license agreements granting
8// a non-assignable, non-transferable and non-exclusive license to use the software
9// for it's own data processing purposes under the terms defined in the Agreement.
10//
11// Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
12// of this source code or associated reference material to any other location for further reproduction
13// or redistribution, and any amendments to this copyright notice, are expressly prohibited.
14//
15// Any reproduction or redistribution for sale or hiring of the Software not in accordance with
16// the terms of the Agreement is a violation of copyright law.
17//
18
19#pragma once
20
21#include <type_traits>
22#include <utility>
23
24#include <OnixS/CME/MDH/ABI.h>
27#include <OnixS/CME/MDH/Order.h>
31#include <OnixS/CME/MDH/Watch.h>
32
34
37
39namespace details
40{
41 template <typename Holder>
43
45 enum class IncrementalRefreshOrderBookInitializationTag {};
47
48 template <Messaging::UpdateAction::Enum Action>
49 struct IsOrderBookMdEntryAction : std::integral_constant<bool,
50 Action == Messaging::UpdateAction::New ||
51 Action == Messaging::UpdateAction::Change ||
52 Action == Messaging::UpdateAction::Delete>
53 {};
54
55 template <Messaging::UpdateAction::Enum Action, typename Holder>
56 using EnableOrderBookMdEntry = typename std::enable_if<
58
59 template <Messaging::UpdateAction::Enum Action, typename Holder>
61 Holder& message, SecurityId securityId, OrderId orderId, OrderPriority orderPriority,
63 {
64 auto entry = appendGroupEntry(message->entries(), [&message](
65 typename decltype(message->entries())::Size size) { return message->entries(size); });
66
67 entry.setSecurityId(securityId);
68 entry.setOrderId(orderId);
69 entry.setOrderPriority(orderPriority);
70 entry.setEntryPx(price);
71 entry.setDisplayQty(quantity);
72 entry.setUpdateAction(Action);
73 entry.setEntryType(entryType);
74
75 return entry;
76 }
77
78}
79
86template <typename Holder, details::IncrementalRefreshOrderBookInitializationTag...>
87auto initialize(Holder& message, EventFlags::Bits eventIndicator, Messaging::Timestamp transactTime = UtcWatch::now()) noexcept
88 -> details::EnableIncrementalRefreshOrderBook<Holder>
89{
90 return details::initializeMessage<IncrementalRefreshOrderBook>(message, eventIndicator, transactTime);
91}
92
98template <typename Holder, details::IncrementalRefreshOrderBookInitializationTag...>
100auto initialize(EventFlags::Bits eventIndicator, Messaging::Timestamp transactTime = UtcWatch::now()) -> decltype(
102{
104}
105
118template <Messaging::UpdateAction::Enum Action, typename Holder>
119auto addEntry(
120 Holder& message, SecurityId securityId, OrderId orderId, OrderPriority orderPriority,
123{
125 message, securityId, orderId, orderPriority, price, quantity, entryType);
126
127 return message;
128}
129
131namespace details
132{
133 template <Messaging::UpdateAction::Enum Action>
135 {
136 template <typename Holder, typename... Arguments>
137 static auto apply(Holder& message, Arguments&&... arguments) -> decltype(
138 addEntry<Action>(message, std::forward<Arguments>(arguments)...),
139 appendOrderBookMdEntry<Action>(message, std::forward<Arguments>(arguments)...))
140 {
141 return appendOrderBookMdEntry<Action>(message, std::forward<Arguments>(arguments)...);
142 }
143 };
144
145 template <>
147 {
148 template <Messaging::UpdateAction::Enum Action, typename Holder, typename... Arguments>
149 static auto apply(Holder& message, Arguments&&... arguments) -> typename std::enable_if<
152 message, std::forward<Arguments>(arguments)...))>::type
153 {
155 message, std::forward<Arguments>(arguments)...);
156 }
157 };
158}
159
#define ONIXS_CME_MDH_TESTING_NAMESPACE_END
Definition Bootstrap.h:84
#define ONIXS_CME_MDH_TESTING_NAMESPACE_BEGIN
Definition Bootstrap.h:83
#define ONIXS_CMEMDH_NODISCARD
Definition Compiler.h:165
The time point without the time-zone information.
Definition Time.h:450
Owns fixed-capacity storage for a prefixed CME message.
static Messaging::Timestamp now() noexcept
Returns current UTC time.
Definition Watch.h:66
FixedPointDecimal< Int64, IntegralConstant< Int8, -9 > > Decimal9
Decimal with constant exponent -9.
Definition Composites.h:37
auto makeInitializationRecipe(Arguments &&... arguments) -> typename std::enable_if< IsMutableMessageHolder< ExpectedHolder, Holder >::value, decltype(makeMessageRecipe< typename std::decay< Holder >::type >(makeMessageOperation< Operation >(std::forward< Arguments >(arguments)...)))>::type
typename std::enable_if< IsMutableMessageHolder< ExpectedHolder, Holder >::value, Holder & >::type EnableMutableMessageHolder
typename std::enable_if< IsOrderBookMdEntryAction< Action >::value, EnableIncrementalRefreshOrderBook< Holder > >::type EnableOrderBookMdEntry
auto initializeMessage(Holder &message, EventFlags::Bits eventIndicator, Messaging::Timestamp transactTime) noexcept -> EnableMutableMessageHolder< ExpectedHolder, Holder >
Messaging::IncrementalRefreshOrderBook47::Entry appendOrderBookMdEntry(Holder &message, SecurityId securityId, OrderId orderId, OrderPriority orderPriority, Messaging::Decimal9 price, DisplayQuantity quantity, Messaging::EntryTypeBook::Enum entryType)
Group::Entry appendGroupEntry(Group group, Resize resize)
EnableMutableMessageHolder< IncrementalRefreshOrderBook, Holder > EnableIncrementalRefreshOrderBook
MessageHolder< Messaging::IncrementalRefreshOrderBook47 > IncrementalRefreshOrderBook
Owns storage for an incremental order-book refresh test message.
SecurityId securityId(const Messaging::FIX::MultiContainer &message)
Definition Accessors.h:43
Messaging::UInt64 OrderPriority
Represents an order's matching priority.
Definition Order.h:35
Messaging::Int32 SecurityId
Identifies a security in CME MDP 3.0 market data.
Definition Domain.h:31
Messaging::UInt64 OrderId
Identifies an order in a Market By Order book.
Definition Order.h:32
Messaging::Int32 DisplayQuantity
Represents the displayed quantity of an order.
Definition Order.h:38
Messaging::MatchEventIndicator::Bits Bits
Protocol storage type for combined event flags.
Definition EventFlags.h:30
static auto apply(Holder &message, Arguments &&... arguments) -> typename std::enable_if< IsOrderBookMdEntryAction< Action >::value, decltype(OrderBookMdEntryOperation< Action >::apply(message, std::forward< Arguments >(arguments)...))>::type
static auto apply(Holder &message, Arguments &&... arguments) -> decltype(addEntry< Action >(message, std::forward< Arguments >(arguments)...), appendOrderBookMdEntry< Action >(message, std::forward< Arguments >(arguments)...))