OpenMAMA
MamdaTradeListener.h
Go to the documentation of this file.
1 /* $Id$
2  *
3  * OpenMAMA: The open middleware agnostic messaging API
4  * Copyright (C) 2011 NYSE Technologies, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef MamdaTradeListenerH
23 #define MamdaTradeListenerH
24 
25 #include <mamda/MamdaConfig.h>
26 #include <mamda/MamdaMsgListener.h>
27 #include <mamda/MamdaTradeRecap.h>
28 #include <mamda/MamdaTradeReport.h>
29 #include <mamda/MamdaTradeGap.h>
37 #include <mamda/MamdaFieldState.h>
38 #include <mamda/MamdaTradeSide.h>
39 
40 namespace Wombat
41 {
42 
43  class MamdaTradeHandler;
44 
67  class MAMDAExpDLL MamdaTradeListener
68  : public MamdaMsgListener
69  , public MamdaTradeRecap
70  , public MamdaTradeReport
71  , public MamdaTradeGap
73  , public MamdaTradeCorrection
74  , public MamdaTradeClosing
77  {
78  public:
80  virtual ~MamdaTradeListener ();
81 
82  void addHandler (MamdaTradeHandler* handler);
83  void processPosDupAndOutOfSeqAsTransient (bool tf);
84  void resolvePossiblyDuplicate (bool tf);
85  void usePosDupAndOutOfSeqHandlers (bool tf);
86 
87  void setCheckUpdatesForTrades (bool check);
88 
89  const char* getSide () const;
90 
91 
92  // Inherited from MamdaBasicRecap and MamdaBasicEvent
93  const char* getSymbol () const;
94  const char* getPartId () const;
95  const MamaDateTime& getSrcTime () const;
96  const MamaDateTime& getActivityTime () const;
97  const MamaDateTime& getLineTime () const;
98  const MamaDateTime& getSendTime () const;
99  const MamaMsgQual& getMsgQual () const;
100  const char* getPubId () const;
101  mama_seqnum_t getEventSeqNum () const;
102  const MamaDateTime& getEventTime () const;
103 
104  // Inherited from MamdaTradeRecap
105  const MamaPrice& getLastPrice () const;
106  mama_quantity_t getLastVolume () const;
107  const char* getLastPartId () const;
108  const MamaDateTime& getLastTime () const;
109  const MamaPrice& getIrregPrice () const;
110  mama_quantity_t getIrregVolume () const;
111  const char* getIrregPartId () const;
112  const MamaDateTime& getIrregTime () const;
113  const MamaDateTime& getTradeDate () const;
114  mama_u32_t getTradeCount () const;
115  mama_quantity_t getAccVolume () const;
116  mama_quantity_t getOffExAccVolume () const;
117  mama_quantity_t getOnExAccVolume () const;
118  const MamaPrice& getNetChange () const;
119  double getPctChange () const;
120  MamdaTradeDirection getTradeDirection () const;
121  const MamaPrice& getOpenPrice () const;
122  const MamaPrice& getHighPrice () const;
123  const MamaPrice& getLowPrice () const;
124  const MamaPrice& getClosePrice () const;
125  const MamaPrice& getPrevClosePrice () const;
126  const MamaPrice& getAdjPrevClosePrice () const;
127  const MamaDateTime& getPrevCloseDate () const;
128  mama_u32_t getBlockCount () const;
129  mama_quantity_t getBlockVolume () const;
130  double getVwap () const;
131  double getOffExVwap () const;
132  double getOnExVwap () const;
133  double getTotalValue () const;
134  double getOffExTotalValue () const;
135  double getOnExTotalValue () const;
136  double getStdDev () const;
137  double getStdDevSum () const;
138  double getStdDevSumSquares () const;
139  const char* getTradeUnits () const;
140  mama_seqnum_t getLastSeqNum () const;
141  mama_seqnum_t getHighSeqNum () const;
142  mama_seqnum_t getLowSeqNum () const;
143  mama_seqnum_t getTotalVolumeSeqNum () const;
144  const char* getCurrencyCode () const;
145  const MamaPrice& getSettlePrice () const;
146  const MamaDateTime& getSettleDate () const;
147  MamdaTradeExecVenue getTradeExecVenue () const;
148  const MamaPrice& getOffExchangeTradePrice () const;
149  const MamaPrice& getOnExchangeTradePrice () const;
150 
151  // Inherited from MamdaTradeReport
152  const MamaPrice& getTradePrice () const;
153  mama_quantity_t getTradeVolume () const;
154  const char* getTradePartId () const;
155  const char* getTradeQual () const;
156  const char* getTradeQualNative () const;
157  mama_u32_t getTradeSellersSaleDays () const;
158  char getTradeStopStock () const;
159  bool getIsIrregular () const;
160  mama_u64_t getOrderId () const;
161  const char* getUniqueId () const;
162  const char* getTradeId () const;
163  const char* getCorrTradeId () const;
164  const char* getTradeAction () const;
165 
166  // Inherited from MamdaTradeGap
167  mama_seqnum_t getBeginGapSeqNum () const;
168  mama_seqnum_t getEndGapSeqNum () const;
169 
170  // Inherited from MamdaTradeCancelOrError
171  bool getIsCancel () const;
172  mama_seqnum_t getOrigSeqNum () const;
173  const MamaPrice& getOrigPrice () const;
174  mama_quantity_t getOrigVolume () const;
175  const char* getOrigPartId () const;
176  const char* getOrigQual () const;
177  const char* getOrigQualNative () const;
178  mama_u32_t getOrigSellersSaleDays () const;
179  char getOrigStopStock () const;
180  const char* getOrigTradeId () const;
181  bool getGenericFlag () const;
182  char getShortSaleCircuitBreaker () const;
183  char getOrigShortSaleCircuitBreaker() const;
184  char getCorrShortSaleCircuitBreaker() const;
185 
186  // Inherited from MamdaTradeCorrection
187  const MamaPrice& getCorrPrice () const;
188  mama_quantity_t getCorrVolume () const;
189  const char* getCorrPartId () const;
190  const char* getCorrQual () const;
191  const char* getCorrQualNative () const;
192  mama_u32_t getCorrSellersSaleDays () const;
193  char getCorrStopStock () const;
194 
195  // Inherited from MamdaTradeClosing
196  bool getIsIndicative () const;
197 
198 
199  /* FieldState Accessors */
200  MamdaFieldState getSymbolFieldState () const;
201  MamdaFieldState getPartIdFieldState () const;
202  MamdaFieldState getSrcTimeFieldState () const;
203  MamdaFieldState getActivityTimeFieldState () const;
204  MamdaFieldState getLineTimeFieldState () const;
205  MamdaFieldState getSendTimeFieldState () const;
206  MamdaFieldState getMsgQualFieldState () const;
207  MamdaFieldState getPubIdFieldState () const;
208  MamdaFieldState getEventSeqNumFieldState () const;
209  MamdaFieldState getEventTimeFieldState () const;
210  MamdaFieldState getLastPriceFieldState () const;
211  MamdaFieldState getLastVolumeFieldState () const;
212  MamdaFieldState getLastPartIdFieldState () const;
213  MamdaFieldState getLastTimeFieldState () const;
214  MamdaFieldState getIrregPriceFieldState () const;
215  MamdaFieldState getIrregVolumeFieldState () const;
216  MamdaFieldState getIrregPartIdFieldState () const;
217  MamdaFieldState getIrregTimeFieldState () const;
218  MamdaFieldState getTradeDateFieldState () const;
219  MamdaFieldState getSideFieldState () const;
220  MamdaFieldState getTradeCounFieldState () const;
221  MamdaFieldState getAccVolumeFieldState () const;
222  MamdaFieldState getOffExAccVolumeFieldState () const;
223  MamdaFieldState getOnExAccVolumeFieldState () const;
224  MamdaFieldState getNetChangeFieldState () const;
225  MamdaFieldState getPctChangeFieldState () const;
226  MamdaFieldState getTradeDirectionFieldState () const;
227  MamdaFieldState getOpenPriceFieldState () const;
228  MamdaFieldState getHighPriceFieldState () const;
229  MamdaFieldState getLowPriceFieldState () const;
230  MamdaFieldState getClosePriceFieldState () const;
231  MamdaFieldState getPrevClosePriceFieldState () const;
232  MamdaFieldState getAdjPrevClosePriceFieldState () const;
233  MamdaFieldState getPrevCloseDateFieldState () const;
234  MamdaFieldState getBlockCountFieldState () const;
235  MamdaFieldState getBlockVolumeFieldState () const;
236  MamdaFieldState getVwapFieldState () const;
237  MamdaFieldState getOffExVwapFieldState () const;
238  MamdaFieldState getOnExVwapFieldState () const;
239  MamdaFieldState getTotalValueFieldState () const;
240  MamdaFieldState getOffExTotalValueFieldState () const;
241  MamdaFieldState getOnExTotalValueFieldState () const;
242  MamdaFieldState getStdDevFieldState () const;
243  MamdaFieldState getStdDevSumFieldState () const;
244  MamdaFieldState getStdDevSumSquaresFieldState () const;
245  MamdaFieldState getTradeUnitsFieldState () const;
246  MamdaFieldState getLastSeqNumFieldState () const;
247  MamdaFieldState getHighSeqNumFieldState () const;
248  MamdaFieldState getLowSeqNumFieldState () const;
249  MamdaFieldState getTotalVolumeSeqNumFieldState () const;
250  MamdaFieldState getCurrencyCodeFieldState () const;
251  MamdaFieldState getSettlePriceFieldState () const;
252  MamdaFieldState getSettleDateFieldState () const;
253  MamdaFieldState getTradeExecVenuFieldState () const;
254  MamdaFieldState getOffExchangeTradePriceFieldState () const;
255  MamdaFieldState getOnExchangeTradePriceFieldState () const;
256  MamdaFieldState getTradePriceFieldState () const;
257  MamdaFieldState getTradeVolumeFieldState () const;
258  MamdaFieldState getTradePartIdFieldState () const;
259  MamdaFieldState getTradeQualFieldState () const;
260  MamdaFieldState getTradeQualNativeFieldState () const;
261  MamdaFieldState getTradeSellersSaleDaysFieldState () const;
262  MamdaFieldState getTradeStopStockFieldState () const;
263  MamdaFieldState getIsIrregularFieldState () const;
264  MamdaFieldState getOrderIdFieldState () const;
265  MamdaFieldState getUniqueIdFieldState () const;
266  MamdaFieldState getTradeIdFieldState () const;
267  MamdaFieldState getCorrTradeIdFieldState () const;
268  MamdaFieldState getTradeActionFieldState () const;
269  MamdaFieldState getTradeExecVenueFieldState () const;
270  MamdaFieldState getBeginGapSeqNumFieldState () const;
271  MamdaFieldState getEndGapSeqNumFieldState () const;
272  MamdaFieldState getIsCancelFieldState () const;
273  MamdaFieldState getOrigSeqNumFieldState () const;
274  MamdaFieldState getOrigPriceFieldState () const;
275  MamdaFieldState getOrigVolumeFieldState () const;
276  MamdaFieldState getOrigPartIdFieldState () const;
277  MamdaFieldState getOrigQualFieldState () const;
278  MamdaFieldState getOrigQualNativeFieldState () const;
279  MamdaFieldState getOrigSellersSaleDaysFieldState () const;
280  MamdaFieldState getOrigStopStockFieldState () const;
281  MamdaFieldState getCorrPriceFieldState () const;
282  MamdaFieldState getCorrVolumeFieldState () const;
283  MamdaFieldState getCorrPartIdFieldState () const;
284  MamdaFieldState getCorrQualFieldState () const;
285  MamdaFieldState getCorrQualNativeFieldState () const;
286  MamdaFieldState getCorrSellersSaleDaysFieldState () const;
287  MamdaFieldState getCorrStopStockFieldState () const;
288  MamdaFieldState getIsIndicativeFieldState () const;
289  MamdaFieldState getTradeCountFieldState () const;
290  MamdaFieldState getOrigTradeIdFieldState () const;
291  MamdaFieldState getGenericFlagFieldState () const;
292  MamdaFieldState getShortSaleCircuitBreakerFieldState () const;
293  MamdaFieldState getOrigShortSaleCircuitBreakerFieldState () const;
294  MamdaFieldState getCorrShortSaleCircuitBreakerFieldState () const;
295 
299  virtual void onMsg (MamdaSubscription* subscription,
300  const MamaMsg& msg,
301  short msgType);
302 
303  void assertEqual (MamdaTradeListener* listener);
304  void reset (void);
305 
306  struct MamdaTradeListenerImpl;
307 
308  private:
309  MamdaTradeListenerImpl& mImpl;
310  };
311 
312 
313 } // namespace
314 
315 #endif // MamdaTradeListenerH
316 


© 2012 Linux Foundation