OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
SnapshotFullRefreshOrderBook.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>
30#include <OnixS/CME/MDH/Watch.h>
31
33
36
38namespace details
39{
40 template <typename Holder>
42
44 enum class SnapshotFullRefreshOrderBookInitializationTag {};
46
47 template <Messaging::UpdateAction::Enum Action>
48 struct IsSnapshotFullRefreshOrderBookAction : std::integral_constant<bool,
49 Action == Messaging::UpdateAction::New>
50 {};
51
53 {
54 template <typename Holder>
55 static auto apply(
56 Holder& message, Messaging::UInt32 totNumReports, SecurityId securityId,
57 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 numberOfChunks,
58 Messaging::UInt32 currentChunk, Messaging::Timestamp transactTime) noexcept
60 {
61 message->reset();
62 message->setTotNumReports(totNumReports);
63 message->setSecurityId(securityId);
64 message->setLastMsgSeqNumProcessed(lastMsgSeqNumProcessed);
65 message->setNoChunks(numberOfChunks);
66 message->setCurrentChunk(currentChunk);
67 message->setTransactTime(transactTime);
68
69 return message;
70 }
71 };
72
73 template <typename Holder>
75 Holder& message, OrderId orderId, OrderPriority orderPriority,
77 {
78 auto entry = appendGroupEntry(message->entries(), [&message](
79 typename decltype(message->entries())::Size size) { return message->entries(size); });
80
81 entry.setOrderId(orderId);
82 entry.setOrderPriority(orderPriority);
83 entry.setEntryPx(price);
84 entry.setDisplayQty(quantity);
85 entry.setEntryType(entryType);
86
87 return entry;
88 }
89}
90
101template <typename Holder, details::SnapshotFullRefreshOrderBookInitializationTag...>
102auto initialize(
103 Holder& message, Messaging::UInt32 totNumReports, SecurityId securityId,
104 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 numberOfChunks,
105 Messaging::UInt32 currentChunk, Messaging::Timestamp transactTime = UtcWatch::now())
107{
109 message, totNumReports, securityId, lastMsgSeqNumProcessed,
110 numberOfChunks, currentChunk, transactTime);
111}
112
122template <typename Holder, details::SnapshotFullRefreshOrderBookInitializationTag...>
124auto initialize(
126 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 numberOfChunks,
127 Messaging::UInt32 currentChunk, Messaging::Timestamp transactTime = UtcWatch::now()) -> decltype(
131 totNumReports, securityId, lastMsgSeqNumProcessed,
132 numberOfChunks, currentChunk, transactTime))
133{
137 totNumReports, securityId, lastMsgSeqNumProcessed,
138 numberOfChunks, currentChunk, transactTime);
139}
140
151template <typename Holder>
152auto addEntry(
153 Holder& message, OrderId orderId, OrderPriority orderPriority,
156{
158 message, orderId, orderPriority, price, quantity, entryType);
159 return message;
160}
161
163namespace details
164{
166 {
167 template <typename Holder, typename... Arguments>
168 static auto apply(Holder& message, Arguments&&... arguments) -> decltype(
169 addEntry(message, std::forward<Arguments>(arguments)...),
170 appendSnapshotFullRefreshOrderBookEntry(message, std::forward<Arguments>(arguments)...))
171 {
173 message, std::forward<Arguments>(arguments)...);
174 }
175 };
176
177 template <>
179 {
180 template <Messaging::UpdateAction::Enum Action, typename Holder, typename... Arguments>
181 static auto apply(Holder& message, Arguments&&... arguments) -> typename std::enable_if<
184 message, std::forward<Arguments>(arguments)...))>::type
185 {
187 message, std::forward<Arguments>(arguments)...);
188 }
189 };
190}
191
#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
std::uint32_t UInt32
uInt32.
Definition Integral.h:35
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
Messaging::SnapshotFullRefreshOrderBook53::Entry appendSnapshotFullRefreshOrderBookEntry(Holder &message, OrderId orderId, OrderPriority orderPriority, Messaging::Decimal9 price, DisplayQuantity quantity, Messaging::EntryTypeBook::Enum entryType)
Group::Entry appendGroupEntry(Group group, Resize resize)
EnableMutableMessageHolder< SnapshotFullRefreshOrderBook, Holder > EnableSnapshotFullRefreshOrderBook
MessageHolder< Messaging::SnapshotFullRefreshOrderBook53 > SnapshotFullRefreshOrderBook
Owns storage for a full order-book snapshot 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::UInt32 SequenceNumber
Identifies a packet within an MDP packet sequence.
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
static auto apply(Holder &message, Arguments &&... arguments) -> typename std::enable_if< IsSnapshotFullRefreshOrderBookAction< Action >::value, decltype(SnapshotFullRefreshOrderBookEntryOperation::apply(message, std::forward< Arguments >(arguments)...))>::type
static auto apply(Holder &message, Arguments &&... arguments) -> decltype(addEntry(message, std::forward< Arguments >(arguments)...), appendSnapshotFullRefreshOrderBookEntry(message, std::forward< Arguments >(arguments)...))
static auto apply(Holder &message, Messaging::UInt32 totNumReports, SecurityId securityId, SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 numberOfChunks, Messaging::UInt32 currentChunk, Messaging::Timestamp transactTime) noexcept -> EnableSnapshotFullRefreshOrderBook< Holder >