OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.4.3
API documentation
TradeReversal.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 TradeReversalEntry::TradeReversalEntry(const void *data)
37  : DataContainer(data)
38 {
39 }
40 
42 {
43  const TradeReversalEntryMsgData* msgData = getData<TradeReversalEntryMsgData>();
45  return false;
46 
47  price = Decimal(msgData->MDEntryPx/100000000.0, 8u);
48  return true;
49 }
50 
52 {
53  return (getData<TradeReversalEntryMsgData>())->MDEntrySize;
54 }
55 
57 {
58  return static_cast<EOBI::MDEntryType::Enum>(getData<TradeReversalEntryMsgData>()->MDEntryType);
59 }
60 
61 
62 std::string TradeReversalEntry::toString() const
63 {
64  std::string str;
65 
66  toString (str);
67 
68  return str;
69 }
70 
71 void TradeReversalEntry::toString(std::string& presentation) const
72 {
73  presentation
74  << "TradeReversalEntry [";
75 
76  Decimal price;
77  if(mdEntryPx(price))
78  presentation << "mdEntryPx=" << price.toString();
79 
80  presentation << ", mdEntrySize="
81  << mdEntrySize();
82 
83  presentation << ']';
84 }
85 
86 TradeReversalEntries::TradeReversalEntries(const void *data)
87  : DataContainer(data)
88 {
89 }
90 
92 {
93  return (getData<TradeReversalMsgData>())->NoMDEntries;
94 }
95 
97 {
98  if (idx >= size())
99  {
100  throw OperationException(BOOST_CURRENT_FUNCTION, "Invalid entry index passed.");
101  }
102 
103  const TradeReversalMsgData *msg = getData<TradeReversalMsgData>();
104  const TradeReversalEntryMsgData *group = msg->MDTradeEntryGrp;
105 
106  return TradeReversalEntry(group + idx);
107 }
108 
109 
110 std::string TradeReversal::msgType() const
111 {
112  return std::string("U22", 3);
113 }
114 
116 {
117  return EOBI::MarketDataType::TradeReversal; // implied constant
118 }
119 
121 {
122  return EOBI::MDUpdateAction::Delete; // implied constant
123 }
124 
126 {
127  return EOBI::SecurityIDSource::Marketplace; // implied constant
128 }
129 
131 {
132  return (getData<TradeReversalMsgData>())->SecurityID;
133 }
134 
136 {
137  return (getData<TradeReversalMsgData>())->TransactTime;
138 }
139 
141 {
142  return (getData<TradeReversalMsgData>())->TrdMatchID;
143 }
144 
146 {
147  return (getData<TradeReversalMsgData>())->LastQty;
148 }
149 
151 {
152  return Decimal((getData<TradeReversalMsgData>())->LastPx/100000000.0, 8u);
153 }
154 
156 {
157  return (getData<TradeReversalMsgData>())->TrdRegTSExecutionTime;
158 }
159 
161 {
162  return (getData<TradeReversalMsgData>())->NoMDEntries;
163 }
164 
166 {
167  return TradeReversalEntries(getData<TradeReversalMsgData>());
168 }
169 
171 {
172  return static_cast<EOBI::TradeCondition::Enum>((getData<TradeReversalMsgData>())->TradeCondition);
173 }
174 
175 void TradeReversal::toString(std::string& presentation) const
176 {
177  presentation
178  << "TradeReversal [msgSeqNum="
179  << msgSeqNum()
180  << ", securityID="
181  << securityID()
182  << ", transactTime="
183  << transactTime()
184  << ", trdMatchID="
185  << trdMatchID()
186  << ", lastQty="
187  << lastQty()
188  << ", lastPx="
189  << lastPx().toString()
190  << ", trdRegTSExecutionTime="
191  << trdRegTSExecutionTime()
192  << ", noMDEntries="
193  << mdTradeEntryGrp().size()
194  << ", TradeCondition=" << TradeCondition::toString(tradeCondition())
195  << ": (";
196 
197  for(size_t i=0; i<mdTradeEntryGrp().size(); i++)
198  {
199  presentation << mdTradeEntryGrp()[i].toString() << ", ";
200  }
201  presentation << " )";
202 
203  presentation << ']';
204 }
205 
206 }}}}
unsigned char UInt8
Definition: Numeric.h:35
EOBI::SecurityIDSource::Enum securityIDSource() const
Marketplace assigned identifier.
Implementation::MDTradeEntryGrpSeqT TradeReversalEntryMsgData
std::string toString() const
Returns text presentation.
Definition: MessageBase.cpp:37
bool mdEntryPx(Decimal &price) const
Price.
Int64 lastQty() const
Quantity executed in this fill.
UInt32 trdMatchID() const
Unique identifier for each price level (match step) of a match event; it is used for public trade rep...
unsigned int UInt32
Definition: Numeric.h:41
Definition: Defines.h:30
Decimal type for better precision.
Definition: Numeric.h:63
Decimal lastPx() const
Price of this fill.
EOBI::MarketDataType::Enum marketDataType() const
Market data type.
UInt64 transactTime() const
Transaction timestamp.
UInt64 trdRegTSExecutionTime() const
Matching timestamp of new last trade.
std::string toString() const
Returns text presentation.
UInt64 securityID() const
Unique instrument identifier.
TradeReversalEntry operator[](size_t idx) const
Entry accessor.
EOBI::TradeCondition::Enum tradeCondition() const
Trade Condition.
static std::string toString(Enum value)
Definition: Defines.cpp:500
TradeReversalEntries mdTradeEntryGrp() const
Variable size array, record counter: NoMDEntries.
Implementation::TradeReversalMsgData TradeReversalMsgData
void toString(std::string &) const
Appends text presentation to given string.
Definition: Decimal.cpp:217
EOBI::MDEntryType::Enum mdEntryType() const
Type of market data entry.
EOBI::MDUpdateAction::Enum mdUpdateAction() const
Type of Market Data update action.
std::string msgType() const
Message type.