OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.2.2
API documentation
Trade.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 
25 
26 namespace OnixS
27 {
28  namespace Eurex
29  {
30  namespace MarketData
31  {
32  /// Trade.
33  template< class TTradeEntry >
34  class Trade
35  {
36  public:
37  /// Initializes an instance.
38  Trade (SecurityId id, UInt32 sequenceNumber, const TTradeEntry& tradeEntry);
39 
40  /// Unique instrument ID as qualified by the
41  /// exchange per tag 22-SecurityIDSource (tag 48).
42  SecurityId securityId() const;
43 
44  /// Defines when the trade happens.
45  ///
46  /// Only present for TradeCondition=AW.
48  {
49  return tradeEntry_.trdType();
50  }
51 
52  /// Defines the trade condition.
54  {
55  return tradeEntry_.tradeCondition();
56  }
57 
58  /// Trade volume
59  bool volume (Decimal& value) const
60  {
61  return tradeEntry_.mdEntrySize (value);
62  }
63 
64  /// Trade price
65  bool price (Decimal& value) const
66  {
67  return tradeEntry_.mdEntryPx (value);
68  }
69 
70  /// Returns group entry (FIX fields) of underlying message.
71  /// Entry contains all the data related with given trade.
72  const TTradeEntry& underlyingEntry() const
73  {
74  return tradeEntry_;
75  }
76 
77  /// Sequence number of the last processed message
79  {
80  return sequenceNumber_;
81  }
82 
83  /// Underlying entry size
84  UInt32 size() const;
85 
86  /// Returns text presentation.
87  std::string toString() const;
88 
89  /// Appends text presentation.
90  virtual void toString (std::string&) const = 0;
91 
92  virtual ~Trade() { }
93 
94  protected:
97 
98  // Underlying trade entry.
99  const TTradeEntry& tradeEntry_;
100  };
101 
102  template< class TTradeEntry >
104  : securityId_ (securityId)
105  , sequenceNumber_ (sequenceNumber)
106  , tradeEntry_ (tradeEntry)
107  {
108  }
109 
110  template< class TTradeEntry >
112  {
113  return securityId_;
114  }
115 
116  template< class TTradeEntry >
118  {
119  Decimal size;
120  tradeEntry_.mdEntrySize (size);
121  return size;
122  }
123 
124  template< class TTradeEntry >
125  std::string Trade<TTradeEntry>::toString() const
126  {
127  std::string str;
128 
129  toString (str);
130 
131  return str;
132  }
133 
134  /// Snapshot trade
135  class ONIXS_EUREX_EMDI_API SnapshotTrade : public Trade<MDSnapshotEntry>
136  {
137  public:
138  /// Appends text presentation.
139  void toString (std::string&) const;
140 
141  protected:
142  /// Initializes an instance.
144 
145  private:
146  /// Initializes instance as reference to the other one.
147  SnapshotTrade (const SnapshotTrade&);
148 
149  /// Reinitializes instance as reference of other one.
150  SnapshotTrade& operator = (const SnapshotTrade&);
151 
152  // Underlying implementation.
153  void* impl_;
154  };
155 
156  /// Incremental trade
157  class ONIXS_EUREX_EMDI_API IncrementalTrade : public Trade<MDIncrementalEntry>
158  {
159  public:
160  /// MDEntryID
161  UInt32 entryId() const;
162 
163  /// Appends text presentation.
164  void toString (std::string&) const;
165 
166  protected:
167  /// Initializes an instance.
169 
170  private:
171  /// Initializes instance as reference to the other one.
173 
174  /// Reinitializes instance as reference of other one.
175  IncrementalTrade& operator = (const IncrementalTrade&);
176 
177  // Underlying implementation.
178  void* impl_;
179  };
180  }
181  }
182 }
Trade(SecurityId id, UInt32 sequenceNumber, const TTradeEntry &tradeEntry)
Initializes an instance.
Definition: Trade.h:103
const TTradeEntry & tradeEntry_
Definition: Trade.h:99
TrdType::Enum type() const
Definition: Trade.h:47
UInt32 size() const
Underlying entry size.
Definition: Trade.h:117
unsigned int UInt32
Definition: Numeric.h:41
Definition: Defines.h:30
Decimal type for better precision.
Definition: Numeric.h:63
UInt32 sequenceNumber() const
Sequence number of the last processed message.
Definition: Trade.h:78
std::string toString() const
Returns text presentation.
Definition: Trade.h:125
Int64 SecurityId
Alias for Security Id type.
Definition: Defines.h:51
bool price(Decimal &value) const
Trade price.
Definition: Trade.h:65
SecurityId securityId() const
Definition: Trade.h:111
TradeConditionSet condition() const
Defines the trade condition.
Definition: Trade.h:53
bool volume(Decimal &value) const
Trade volume.
Definition: Trade.h:59
Market data snapshot entry.
Definition: DepthSnapshot.h:37
const TTradeEntry & underlyingEntry() const
Definition: Trade.h:72