OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.4.2
API documentation
InstrumentSummary.cpp
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 #include <boost/current_function.hpp>
20 
23 
24 #include "MessageDataStructures.h"
25 
26 #include "../Utils.h"
27 
28 namespace OnixS{
29 namespace Eurex{
30 namespace MarketData{
31 namespace EOBI{
32 
35 
36 InstrumentSummaryEntry::InstrumentSummaryEntry(const void *data)
37  : DataContainer(data)
38 {
39 }
40 
42 {
43  const InstrumentSummaryEntryMsgData* msgData = getData<InstrumentSummaryEntryMsgData>();
45  return false;
46 
47  price = Decimal(msgData->MDEntryPx/100000000.0, 8u);
48  return true;
49 }
50 
52 {
53  return (getData<InstrumentSummaryEntryMsgData>())->MDEntrySize;
54 }
55 
57 {
58  return static_cast<EOBI::MDEntryType::Enum>((getData<InstrumentSummaryEntryMsgData>())->MDEntryType);
59 }
60 
62 {
63  return static_cast<EOBI::TradeCondition::Enum>((getData<InstrumentSummaryEntryMsgData>())->TradeCondition);
64 }
65 
66 void InstrumentSummaryEntry::toString(std::string& presentation) const
67 {
68  presentation
69  << "InstrumentSummaryEntry ["
70  << "type=" << MDEntryType::toString(mdEntryType())
71  << "tradeCondition=" << TradeCondition::toString(tradeCondition());
72 
74  presentation << ", quantity=" << mdEntrySize();
75  else
76  {
77  Decimal price;
78  if(mdEntryPx(price))
79  presentation << ", price=" << price.toString() << ", quantity=" << mdEntrySize();
80  }
81 
82  presentation << ']';
83 }
84 
85 
86 InstrumentSummaryEntries::InstrumentSummaryEntries(const void *data)
87  : DataContainer(data)
88 {
89 }
90 
92 {
93  return (getData<InstrumentSummaryMsgData>())->NoMDEntries;
94 }
95 
97 {
98  if (idx >= size())
99  {
100  throw OperationException(BOOST_CURRENT_FUNCTION, "Invalid entry index passed.");
101  }
102 
103  const InstrumentSummaryMsgData *msg = getData<InstrumentSummaryMsgData>();
104  const InstrumentSummaryEntryMsgData *group = msg->MDInstrumentEntryGrp;
105 
106  return InstrumentSummaryEntry(group + idx);
107 }
108 
109 void InstrumentSummaryEntries::toString(std::string& presentation) const
110 {
111  presentation
112  << "InstrumentSummaryEntries (" << size() << ") [";
113 
114  for (size_t i = 0; i < size(); ++i)
115  {
116  (*this)[i].toString(presentation);
117 
118  if( i < size() - 1 )
119  presentation << ", ";
120  }
121 
122  presentation << ']';
123 }
124 
125 
126 std::string InstrumentSummary::msgType() const
127 {
128  return std::string("U23", 3); // implied constant
129 }
130 
132 {
133  return EOBI::MarketDataType::SingleInstrumentSnapshot; // implied constant
134 }
135 
137 {
138  return EOBI::SecurityIDSource::Marketplace; // implied constant
139 }
140 
142 {
143  return (getData<InstrumentSummaryMsgData>())->SecurityID;
144 }
145 
147 {
148  return (getData<InstrumentSummaryMsgData>())->LastUpdateTime;
149 }
150 
152 {
153  return (getData<InstrumentSummaryMsgData>())->TrdRegTSExecutionTime;
154 }
155 
157 {
158  return (getData<InstrumentSummaryMsgData>())->TotNoOrders;
159 }
160 
162 {
163  return static_cast<EOBI::SecurityStatus::Enum>((getData<InstrumentSummaryMsgData>())->SecurityStatus);
164 }
165 
167 {
168  return static_cast<EOBI::SecurityTradingStatus::Enum>((getData<InstrumentSummaryMsgData>())->SecurityTradingStatus);
169 }
170 
172 {
173  return static_cast<EOBI::FastMarketIndicator::Enum>((getData<InstrumentSummaryMsgData>())->FastMarketIndicator);
174 }
175 
177 {
178  return static_cast<EOBI::SecurityTradingEvent::Enum>((getData<InstrumentSummaryMsgData>())->SecurityTradingEvent);
179 }
180 
182 {
183  return (getData<InstrumentSummaryMsgData>())->NoMDEntries;
184 }
185 
187 {
188  return InstrumentSummaryEntries(getData<InstrumentSummaryMsgData>());
189 }
190 
192 {
193  return static_cast<EOBI::MarketCondition::Enum>((getData<InstrumentSummaryMsgData>())->MarketCondition);
194 }
195 
196 void InstrumentSummary::toString(std::string& presentation) const
197 {
198  presentation
199  << "InstrumentSummary [msgSeqNum=" << msgSeqNum()
200  << ", SecurityId=" << securityID()
201  << ", LastUpdateTime=" << lastUpdateTime()
202  << ", TrdRegTSExecutionTime=" << trdRegTSExecutionTime()
203  << ", TotNoOrders=" << totNoOrders()
204  << ", SecurityStatus=" << SecurityStatus::toString(securityStatus())
205  << ", SecurityTradingStatus=" << SecurityTradingStatus::toString(securityTradingStatus())
206  << ", MarketCondition=" << MarketCondition::toString(marketCondition())
207  << ", FastMarketIndicator=" << FastMarketIndicator::toString(fastMarketIndicator())
208  << ", NoMDEntries=" << noMDEntries();
209 
210  presentation << ", MdInstrumentEntryGrp=";
211  mdInstrumentEntryGrp().toString(presentation);
212 
213  presentation << ']';
214 }
215 
216 }}}}
UInt64 securityID() const
Unique instrument identifier.
static std::string toString(Enum value)
Definition: Defines.cpp:193
unsigned char UInt8
Definition: Numeric.h:35
InstrumentSummaryEntry operator[](size_t idx) const
Entry accessor.
static std::string toString(Enum value)
Definition: Defines.cpp:316
EOBI::Implementation::InstrumentSummaryMsgData InstrumentSummaryMsgData
static std::string toString(Enum value)
Definition: Defines.cpp:524
std::string toString() const
Returns text presentation.
Definition: MessageBase.cpp:37
EOBI::FastMarketIndicator::Enum fastMarketIndicator() const
Fast market indicator.
EOBI::SecurityTradingEvent::Enum securityTradingEvent() const
EOBI::Implementation::MDInstrumentEntryGrpSeqT InstrumentSummaryEntryMsgData
void toString(std::string &) const
Appends text presentation.
EOBI::MarketCondition::Enum marketCondition() const
Indicator for stressed market conditions.
Definition: Defines.h:30
Decimal type for better precision.
Definition: Numeric.h:63
EOBI::MarketDataType::Enum marketDataType() const
Market data type.
InstrumentSummaryEntries mdInstrumentEntryGrp() const
Variable size array, record counter: NoMDEntries.
EOBI::SecurityTradingStatus::Enum securityTradingStatus() const
Instrument state status.
EOBI::SecurityStatus::Enum securityStatus() const
Instrument status.
EOBI::MDEntryType::Enum mdEntryType() const
Type of market data entry.
unsigned short UInt16
Definition: Numeric.h:38
UInt16 totNoOrders() const
Corresponding number of orders for this instrument.
static std::string toString(Enum value)
Definition: Defines.cpp:500
UInt64 lastUpdateTime() const
Last update time of the corresponding order book.
UInt64 trdRegTSExecutionTime() const
Last matching execution timestamp.
void toString(std::string &) const
Appends text presentation to given string.
Definition: Decimal.cpp:217
EOBI::SecurityIDSource::Enum securityIDSource() const
Marketplace assigned identifier.
EOBI::TradeCondition::Enum tradeCondition() const
Trade Condition.
UInt8 noMDEntries() const
Number of entries in Market Data message for MDEntryGrp.
static std::string toString(Enum value)
Definition: Defines.cpp:635
void toString(std::string &) const
Appends text presentation.