OnixS C++ HKEX OMD-C Handler 1.0.0
API documentation
Loading...
Searching...
No Matches
News.h
Go to the documentation of this file.
1/*
2* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3*
4* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5* and international copyright treaties.
6*
7* Access to and use of the software is governed by the terms of the applicable ONIXS Software
8* Services Agreement (the Agreement) and Customer end user license agreements granting
9* a non-assignable, non-transferable and non-exclusive license to use the software
10* for it's own data processing purposes under the terms defined in the Agreement.
11*
12* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13* of this source code or associated reference material to any other location for further reproduction
14* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15*
16* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17* the terms of the Agreement is a violation of copyright law.
18*/
19
20#pragma once
21
22#include <vector>
23
28
29
30namespace OnixS {
31namespace HKEX {
32namespace MarketData {
33namespace Omdc {
34
36 struct NewsMsg : public BinaryMessage
37 {
39 UInt16 msgSize() const
41 {
42 return ordinary<UInt16>(0);
43 }
44
46 UInt16 msgType() const
48 {
49 return ordinary<UInt16>(2);
50 }
51
55 {
56 return fixedStr<3>(4);
57 }
58
60 StrRef newsID() const
62 {
63 return fixedStr<3>(7);
64 }
65
69 {
70 return fixedStr<320>(10);
71 }
72
77 {
78 return fixedStr<1>(330);
79 }
80
84 {
85 return fixedStr<1>(331);
86 }
87
89 UInt64 releaseTime() const
91 {
92 return ordinary<UInt64>(336);
93 }
94
96 UInt16 noMarketCodes() const
98 {
99 return ordinary<UInt16>(346);
100 }
101
103 UInt16 marketCode(UInt16 index) const
105 {
106 assert(noMarketCodes() != 0);
107 assert(index < noMarketCodes());
108
109 return ordinary<UInt16>(348 + 4 * index);
110 }
111
113 UInt16 noSecurityCodes() const
115 {
116 return ordinary<UInt16>(350 + 4 * noMarketCodes());
117 }
118
120 UInt16 securityCode(UInt16 index) const
122 {
123 assert(noSecurityCodes() != 0);
124 assert(index < noSecurityCodes());
125
126 return ordinary<UInt16>(352 + 4 * noMarketCodes() + 4 * index);
127 }
128
130 UInt16 noNewsLines() const
132 {
133 return ordinary<UInt16>(354 + 4 * noMarketCodes() + 4 * noSecurityCodes());
134 }
135
137 StrRef newsLine(UInt16 index) const
139 {
140 assert(noSecurityCodes() != 0);
141 assert(index < noSecurityCodes());
142
143 return fixedStr<160>(356 + 4 * noMarketCodes() + 4 * noSecurityCodes() + 160 * index);
144 }
145
148
150 static void validateSize(MessageSize size)
151 {
152 if ONIXS_HKEX_OMDC_UNLIKELY(size < messageSize_)
153 throwIncorrectSize("News", size, messageSize_);
154 }
155
157 NewsMsg(const void* data, MessageSize size)
159 : BinaryMessage(data, size)
160 {
161 }
162 };
163
165 ONIXS_HKEX_OMDC_API void toStr(std::string&, const NewsMsg&);
166
168 inline std::string toStr(const NewsMsg& msg)
169 {
170 std::string str;
171 toStr(str, msg);
172 return str;
173 }
174
175}
176}
177}
178}
#define ONIXS_HKEX_OMDC_CONST_OR_CONSTEXPR
Definition Compiler.h:171
#define ONIXS_HKEX_OMDC_NOTHROW
Definition Compiler.h:169
BinaryMessage() noexcept
Initializes blank instance referencing to nothing.
Provides efficient way of accessing text-based FIX field values.
Definition String.h:46
ONIXS_HKEX_OMDC_API void toStr(std::string &, Side::Enum)
Appends string presentation of object.
UInt16 MessageSize
Aliases message length type.
Definition Defines.h:93
ONIXS_HKEX_OMDC_API void throwIncorrectSize(const std::string &messageName, MessageSize receivedSize, MessageSize expectedSize)
StrRef newsLine(UInt16 index) const noexcept
News line.
Definition News.h:137
StrRef newsID() const noexcept
Unique number for the news page within each NewsType.
Definition News.h:60
NewsMsg(const void *data, MessageSize size) noexcept
Initializes instance over given memory block.
Definition News.h:157
UInt16 noMarketCodes() const noexcept
Number of Market segment identifier within this message.
Definition News.h:96
UInt16 msgSize() const noexcept
Size of the message.
Definition News.h:39
UInt16 msgType() const noexcept
Type of message.
Definition News.h:46
UInt64 releaseTime() const noexcept
Release time of the news.
Definition News.h:89
StrRef cancelFlag() const noexcept
Indicator of whether previously released exchange news (identified by NewsType and NewsID) has been c...
Definition News.h:75
static constexpr MessageSize messageSize_
Total message size.
Definition News.h:147
UInt16 marketCode(UInt16 index) const noexcept
Market segment identifier.
Definition News.h:103
static void validateSize(MessageSize size)
Check the given size.
Definition News.h:150
UInt16 securityCode(UInt16 index) const noexcept
Uniquely identifies a security available for trading.
Definition News.h:120
UInt16 noSecurityCodes() const noexcept
Number of security codes within this message.
Definition News.h:113
StrRef newsType() const noexcept
Type of Exchange news.
Definition News.h:53
StrRef lastFragment() const noexcept
Indicates whether this message is the last in a sequence of messages.
Definition News.h:82
UInt16 noNewsLines() const noexcept
Number of news lines.
Definition News.h:130
StrRef headline() const noexcept
News headline.
Definition News.h:67