OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
SnapshotFullRefresh.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>
29#include <OnixS/CME/MDH/Watch.h>
30
32
35
37namespace details
38{
39 template <typename Holder>
41
43 enum class SnapshotFullRefreshInitializationTag {};
45
46 template <Messaging::UpdateAction::Enum Action>
47 struct IsSnapshotFullRefreshAction : std::integral_constant<bool,
48 Action == Messaging::UpdateAction::New>
49 {};
50
52 {
53 template <typename Holder>
54 static auto apply(
55 Holder& message, Messaging::UInt32 totNumReports, SecurityId securityId,
56 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 rptSeq,
57 Messaging::Timestamp transactTime, Messaging::Timestamp updateTime) noexcept
59 {
60 message->reset();
61 message->setTotNumReports(totNumReports);
62 message->setSecurityId(securityId);
63 message->setLastMsgSeqNumProcessed(lastMsgSeqNumProcessed);
64 message->setRptSeq(rptSeq);
65 message->setTransactTime(transactTime);
66 message->setLastUpdateTime(updateTime);
67 message->setTradeDate(updateTime);
68 message->setSecurityTradingStatus(Messaging::SecurityTradingStatus::NewPriceIndication);
69
70 return message;
71 }
72 };
73
74 template <typename Holder>
76 Holder& message, Messaging::EntryType::Enum entryType, Messaging::Int8 priceLevel,
77 Messaging::Decimal9 price, Messaging::Int32 quantity, Messaging::Int32 numberOfOrders)
78 {
79 auto entry = appendGroupEntry(message->entries(), [&message](
80 typename decltype(message->entries())::Size size) { return message->entries(size); });
81
82 entry.setEntryType(entryType);
83 entry.setPriceLevel(priceLevel);
84 entry.setEntryPx(price);
85 entry.setEntrySize(quantity);
86 entry.setNumberOfOrders(numberOfOrders);
87 entry.setSettlPriceType(Messaging::SettlPriceType());
88 entry.setOpenCloseSettlFlag(Messaging::OpenCloseSettlFlag::DailyOpenPrice);
89
90 return entry;
91 }
92}
93
105template <typename Holder, details::SnapshotFullRefreshInitializationTag...>
106auto initialize(
107 Holder& message, Messaging::UInt32 totNumReports, SecurityId securityId,
108 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 rptSeq,
109 Messaging::Timestamp transactTime, Messaging::Timestamp updateTime)
111{
113 message, totNumReports, securityId, lastMsgSeqNumProcessed, rptSeq, transactTime, updateTime);
114}
115
126template <typename Holder, details::SnapshotFullRefreshInitializationTag...>
127auto initialize(
128 Holder& message, Messaging::UInt32 totNumReports, SecurityId securityId,
129 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 rptSeq,
132{
133 return initialize(message, totNumReports, securityId, lastMsgSeqNumProcessed, rptSeq, timestamp, timestamp);
134}
135
147template <typename Holder, details::SnapshotFullRefreshInitializationTag...>
149auto initialize(
151 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 rptSeq,
152 Messaging::Timestamp transactTime, Messaging::Timestamp updateTime) -> decltype(
155 totNumReports, securityId, lastMsgSeqNumProcessed, rptSeq,
156 transactTime, updateTime))
157{
160 totNumReports, securityId, lastMsgSeqNumProcessed, rptSeq,
161 transactTime, updateTime);
162}
163
175template <typename Holder, details::SnapshotFullRefreshInitializationTag...>
177auto initialize(
179 SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 rptSeq,
181 initialize<Holder>(
182 totNumReports, securityId, lastMsgSeqNumProcessed, rptSeq, timestamp, timestamp))
183{
184 return initialize<Holder>(totNumReports, securityId, lastMsgSeqNumProcessed, rptSeq, timestamp, timestamp);
185}
186
198template <typename Holder>
199auto addEntry(
200 Holder& message, Messaging::EntryType::Enum entryType, Messaging::Int8 priceLevel,
201 Messaging::Decimal9 price, Messaging::Int32 quantity, Messaging::Int32 numberOfOrders)
203{
204 details::appendSnapshotFullRefreshEntry(message, entryType, priceLevel, price, quantity, numberOfOrders);
205 return message;
206}
207
209namespace details
210{
212 {
213 template <typename Holder, typename... Arguments>
214 static auto apply(Holder& message, Arguments&&... arguments)
215 -> decltype(addEntry(message, std::forward<Arguments>(arguments)...),
216 appendSnapshotFullRefreshEntry(message, std::forward<Arguments>(arguments)...))
217 {
218 return appendSnapshotFullRefreshEntry(message, std::forward<Arguments>(arguments)...);
219 }
220 };
221
222 template <>
224 {
225 template <Messaging::UpdateAction::Enum Action, typename Holder, typename... Arguments>
226 static auto apply(Holder& message, Arguments&&... arguments)
227 -> typename std::enable_if<IsSnapshotFullRefreshAction<Action>::value,
228 decltype(SnapshotFullRefreshEntryOperation::apply(message, std::forward<Arguments>(arguments)...))>::type
229 {
230 return SnapshotFullRefreshEntryOperation::apply(message, std::forward<Arguments>(arguments)...);
231 }
232 };
233}
234
#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
std::int8_t Int8
int8.
Definition Integral.h:30
std::int32_t Int32
int32.
Definition Integral.h:34
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
Messaging::SnapshotFullRefresh52::Entry appendSnapshotFullRefreshEntry(Holder &message, Messaging::EntryType::Enum entryType, Messaging::Int8 priceLevel, Messaging::Decimal9 price, Messaging::Int32 quantity, Messaging::Int32 numberOfOrders)
EnableMutableMessageHolder< SnapshotFullRefresh, Holder > EnableSnapshotFullRefresh
typename std::enable_if< IsMutableMessageHolder< ExpectedHolder, Holder >::value, Holder & >::type EnableMutableMessageHolder
Group::Entry appendGroupEntry(Group group, Resize resize)
MessageHolder< Messaging::SnapshotFullRefresh52 > SnapshotFullRefresh
Owns storage for a full snapshot refresh test message.
SecurityId securityId(const Messaging::FIX::MultiContainer &message)
Definition Accessors.h:43
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::Timestamp timestamp(const Messaging::FIX::MultiContainer &, Messaging::FIX::Tag)
Retrieves last update time field value.
static auto apply(Holder &message, Arguments &&... arguments) -> typename std::enable_if< IsSnapshotFullRefreshAction< Action >::value, decltype(SnapshotFullRefreshEntryOperation::apply(message, std::forward< Arguments >(arguments)...))>::type
static auto apply(Holder &message, Arguments &&... arguments) -> decltype(addEntry(message, std::forward< Arguments >(arguments)...), appendSnapshotFullRefreshEntry(message, std::forward< Arguments >(arguments)...))
static auto apply(Holder &message, Messaging::UInt32 totNumReports, SecurityId securityId, SequenceNumber lastMsgSeqNumProcessed, Messaging::UInt32 rptSeq, Messaging::Timestamp transactTime, Messaging::Timestamp updateTime) noexcept -> EnableSnapshotFullRefresh< Holder >