OnixS C++ CME Market Data Handler  5.4.0
API documentation
SecurityListener.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <OnixS/CME/MDH/MboBook.h>
27 
29 
32 
34 
37 
38 /// Collection of attributes associated with
39 /// security-related data in security listener
40 /// callbacks.
41 template
42 <
43  class Container,
44  class Data = typename Container::Entry
45 >
47 {
48  Data entry_;
49  Container message_;
50  const NetPacket& packet_;
51 
52  /// Reinitializes instance as copy of other one.
54  operator =(
55  const SecurityDataArgs&);
56 
57 public:
58  /// Type of message whose instance
59  /// is referenced by given arguments.
60  typedef Container Message;
61 
62  /// Type of repeating group entry whose
63  /// instance referenced by given arguments.
64  typedef Data Entry;
65 
66  /// Initializes instance with
67  /// given market data entry.
69  const NetPacket& packet,
70  const Message& message,
71  const Entry& entry)
72  : entry_(entry)
73  , message_(message)
74  , packet_(packet)
75  {
76  }
77 
78  /// Initializes instance as copy of other one.
80  const SecurityDataArgs& other)
81  : entry_(other.entry_)
82  , message_(other.message_)
83  , packet_(other.packet_)
84  {
85  }
86 
87  /// Instance of the packet containing the message
88  /// which in its turn contains the market data entry.
89  const NetPacket& packet() const
90  {
91  return packet_;
92  }
93 
94  /// Instance of message containing market data entry.
95  const Message& message() const
96  {
97  return message_;
98  }
99 
100  /// Instance of market data being referenced.
101  const Entry& entry() const
102  {
103  return entry_;
104  }
105 };
106 
107 namespace
108 {
109  /// Empty order list.
110  inline
111  const
113  nullOrders()
114  {
115  static
116  const
118  theNull;
119 
120  return theNull;
121  }
122 }
123 
124 /// Attributes of trade summary.
125 template
126 <
127  class Summary,
128  class Data = typename Summary::Entry
129 >
131 : public SecurityDataArgs
132 <
133  Summary,
134  Data
135 >
136 {
137  const TradeOrderIds& orderIds_;
138 
140  operator =(
141  const TradeSummaryArgs&);
142 
143 public:
144  typedef
146  <
147  Summary,
148  Data
149  >
151 
152  /// Aliases type of message holding
153  /// trade summary repeating group entries.
154  typedef
155  typename
156  Base::Message
158 
159  /// Aliases trade summary data entry.
160  typedef
161  typename
162  Base::Entry
164 
165  /// Aliases collection of order ids.
166  typedef
169 
170  /// Initializes instance with data to be referenced.
172  const NetPacket& packet,
173  const Message& message,
174  const Entry& entry,
175  const OrderIds& ids = nullOrders())
176  : Base(packet, message, entry)
177  , orderIds_(ids)
178  {
179  }
180 
181  /// Initializes the instance as ref-copy of the other one.
183  const TradeSummaryArgs& other)
184  : Base(static_cast<const Base&>(other))
185  , orderIds_(other.orderIds_)
186  {
187  }
188 
189  /// Order details referring to given trade.
190  /// Collection may be empty if order details
191  /// gather is not enabled.
192  ///
193  /// @see HandlerSettings::tradeProcessing
194  /// for more information.
195  const
196  OrderIds&
197  orderIds() const
198  {
199  return orderIds_;
200  }
201 };
202 
203 typedef
205 <
207 >
209 
210 /// Instantiation of security data attributes for volumes.
211 typedef
213 <
215 >
217 
218 /// Instantiation of security data attributes for MBO book atomic updates.
219 typedef
221 <
223 >
225 
226 /// Instantiation of security data attributes for MBO book atomic updates.
227 typedef
229 <
232 >
234 
235 /// Instantiation of security data attributes for MBP book atomic updates.
236 typedef
238 <
239  IncrementalRefreshBook46
240 >
242 
243 /// Instantiation of security data attributes for daily statistics.
244 typedef
246 <
248 >
250 
251 /// Instantiation of security data attributes for session statistics.
252 typedef
254 <
256 >
258 
259 /// Instantiation of security data attributes for limits and banding.
260 typedef
262 <
264 >
266 
267 /// Instantiation of security data attributes for quote request related symbols.
268 typedef
270 <
273 >
275 
276 //
277 
278 /// Instantiation of security data attributes for recovery data.
279 typedef
281 <
283 >
285 
286 /// Instantiation of security data attributes for MBO recovery data.
287 typedef
289 <
291 >
293 
294 //
295 
296 /// Exposes details of book maintenance failure.
297 template
298 <
299  class Book
300 >
301 class
303 {
304 public:
305  /// Initializes instance with reference
306  /// to a book and failure reason.
308  const Book& book,
309  const std::string& description)
310  : book_(book)
311  , description_(description)
312  {
313  }
314 
315  /// Book which wasn't updated successfully.
316  const Book& book() const
317  {
318  return book_;
319  }
320 
321  /// Details on book update failure.
322  const std::string& description() const
323  {
324  return description_;
325  }
326 
327 private:
328  const Book& book_;
329  const std::string& description_;
330 
332  const BookUpdateErrorArgs&);
333 
335  operator =(
336  const BookUpdateErrorArgs&);
337 };
338 
339 /// Instantiation of book update error
340 /// arguments for books of MBO type.
341 typedef
344 
345 /// Instantiation of book update error
346 /// arguments for books of direct type.
347 typedef
350 
351 /// Instantiation of book update error
352 /// arguments for books of implied type.
353 typedef
356 
357 /// Callbacks invoked by Handler to expose market data entities.
359 {
360  /// Invoked when book reset procedure
361  /// is spawned by MDP on a channel.
362  virtual
363  void
365  Handler&)
366  {
367  }
368 
369  /// Invoked upon instrument definition reception.
370  virtual
371  void
373  Handler&,
374  const Security&,
376  {
377  }
378 
379  /// Invoked upon instrument definition reception.
380  virtual
381  void
383  Handler&,
384  const Security&,
386  {
387  }
388 
389  /// Invoked upon instrument definition reception.
390  virtual
391  void
393  Handler&,
394  const Security&,
396  {
397  }
398 
399  /// Invoked upon instrument definition reception.
400  virtual
401  void
403  Handler&,
404  const Security&,
406  {
407  }
408 
409  /// Invoked upon processing of an instrument
410  /// definition extracted from instrument cache.
411  virtual
412  void
414  Handler&,
415  const Security&,
417  {
418  }
419 
420  /// Invoked for the instrument whose instrument
421  /// data wasn't received but other data like trades
422  /// or book updates is about to be processed.
423  virtual
424  void
426  Handler&,
427  Security&)
428  {
429  }
430 
431  /// Invoked when snapshot is received for
432  /// the security while Handler recovers market
433  /// state from snapshots.
434  virtual
435  void
437  Handler&,
438  const Security&,
440  {
441  }
442 
443  /// Invoked when snapshot is received for
444  /// the security while Handler recovers market
445  /// state from snapshots.
446  virtual
447  void
449  Handler&,
450  const Security&,
452  {
453  }
454 
455  /// Invoked when trade is recovered from snapshot
456  /// while Handler recovers market state from snapshots.
457  virtual
458  void
460  Handler&,
461  const Security&,
462  const Recovery52EntryArgs&)
463  {
464  }
465 
466  /// Invoked when trade summary
467  /// is received for the security.
468  virtual
469  void
471  Handler&,
472  const Security&,
473  const TradeSummary48Args&)
474  {
475  }
476 
477  /// Invoked when electronic volume is
478  /// recovered from snapshot for the security.
479  virtual
480  void
482  Handler&,
483  const Security&,
484  const Recovery52EntryArgs&)
485  {
486  }
487 
488  /// Invoked when electronic volume
489  /// is received for the security.
490  virtual
491  void
493  Handler&,
494  const Security&,
495  const Volume37Args&)
496  {
497  }
498 
499  /// Invoked when atomic book update for
500  // the security is recovered from snapshot.
501  virtual
502  void
504  Handler&,
505  const Security&,
506  const MboRecovery53EntryArgs&)
507  {
508  }
509 
510  /// Invoked when atomic book update for
511  // the security is recovered from snapshot.
512  virtual
513  void
515  Handler&,
516  const Security&,
517  const Recovery52EntryArgs&)
518  {
519  }
520 
521  /// Invoked when atomic book update
522  /// for the security is received.
523  virtual
524  void
526  Handler&,
527  const Security&,
529  {
530  }
531 
532  /// Invoked when atomic book update
533  /// for the security is received.
534  virtual
535  void
537  Handler&,
538  const Security&,
540  {
541  }
542 
543  /// Invoked when atomic book update
544  /// for the security is received.
545  virtual
546  void
548  Handler&,
549  const Security&,
551  {
552  }
553 
554  /// Invoked when MBO book
555  /// is updated for the security.
556  ///
557  /// @note Callback is invoked if
558  /// MBO book maintenance is enabled.
559  ///
560  /// @see HandlerSettings::bookManagement()
561  /// for more information.
562  virtual
563  void
565  Handler&,
566  const Security&,
567  const MboBook&)
568  {
569  }
570 
571  /// Invoked when direct book
572  /// is updated for the security.
573  ///
574  /// @note Callback is invoked if direct
575  /// book maintenance is enabled.
576  ///
577  /// @see HandlerSettings::bookManagement()
578  /// for more information.
579  virtual
580  void
582  Handler&,
583  const Security&,
584  const DirectBook&)
585  {
586  }
587 
588  /// Invoked when implied book
589  /// is updated for the security.
590  ///
591  /// @note Callback is invoked if direct
592  /// book maintenance is enabled.
593  ///
594  /// @see HandlerSettings::bookManagement()
595  /// for more information.
596  virtual
597  void
599  Handler&,
600  const Security&,
601  const ImpliedBook&)
602  {
603  }
604 
605  /// Invoked when consolidated book
606  /// is updated for the security.
607  ///
608  /// @note Callback is invoked if direct
609  /// book maintenance is enabled.
610  ///
611  /// @see HandlerSettings::bookManagement()
612  /// for more information.
613  virtual
614  void
616  Handler&,
617  const Security&,
618  const ConsolidatedBook&)
619  {
620  }
621 
622  /// Invoked when Handler fails to update
623  /// MBO book for given security.
624  virtual
625  void
627  Handler&,
628  const Security&,
629  const MboBookUpdateErrorArgs&)
630  {
631  }
632 
633  /// Invoked when Handler fails to update
634  /// direct book for given security.
635  virtual
636  void
638  Handler&,
639  const Security&,
641  {
642  }
643 
644  /// Invoked when Handler fails to update
645  /// implied book for given security.
646  virtual
647  void
649  Handler&,
650  const Security&,
652  {
653  }
654 
655  /// Invoked when settlement price for the
656  /// security is recovered from snapshot.
657  virtual
658  void
660  Handler&,
661  const Security&,
662  const Recovery52EntryArgs&)
663  {
664  }
665 
666  /// Invoked when settlement price
667  /// for the security is received.
668  virtual
669  void
671  Handler&,
672  const Security&,
673  const DailyStatistics49Args&)
674  {
675  }
676 
677  /// Invoked when cleared volume for the
678  /// security is recovered from snapshot.
679  virtual
680  void
682  Handler&,
683  const Security&,
684  const Recovery52EntryArgs&)
685  {
686  }
687 
688  /// Invoked when cleared volume
689  /// for the security is received.
690  virtual
691  void
693  Handler&,
694  const Security&,
695  const DailyStatistics49Args&)
696  {
697  }
698 
699  /// Invoked when open interest for the
700  /// security is recovered from snapshot.
701  virtual
702  void
704  Handler&,
705  const Security&,
706  const Recovery52EntryArgs&)
707  {
708  }
709 
710  /// Invoked when open interest
711  /// for the security is received.
712  virtual
713  void
715  Handler&,
716  const Security&,
717  const DailyStatistics49Args&)
718  {
719  }
720 
721  /// Invoked when fixing price recovered
722  /// from snapshot for given security.
723  virtual
724  void
726  Handler&,
727  const Security&,
728  const Recovery52EntryArgs&)
729  {
730  }
731 
732  /// Invoked when fixing price
733  /// is received for the security.
734  virtual
735  void
737  Handler&,
738  const Security&,
739  const DailyStatistics49Args&)
740  {
741  }
742 
743  /// Invoked when opening price recovered
744  /// from snapshot for given security.
745  virtual
746  void
748  Handler&,
749  const Security&,
750  const Recovery52EntryArgs&)
751  {
752  }
753 
754  /// Invoked when opening price
755  /// is received for the security.
756  virtual
757  void
759  Handler&,
760  const Security&,
762  {
763  }
764 
765  /// Invoked when session high trade price
766  /// recovered from snapshot for given security.
767  virtual
768  void
770  Handler&,
771  const Security&,
772  const Recovery52EntryArgs&)
773  {
774  }
775 
776  /// Invoked when session high trade
777  /// price is received for the security.
778  virtual
779  void
781  Handler&,
782  const Security&,
784  {
785  }
786 
787  /// Invoked when session low trade price
788  /// recovered from snapshot for given security.
789  virtual
790  void
792  Handler&,
793  const Security&,
794  const Recovery52EntryArgs&)
795  {
796  }
797 
798  /// Invoked when session low trade
799  /// price is received for the security.
800  virtual
801  void
803  Handler&,
804  const Security&,
806  {
807  }
808 
809  /// Invoked when session highest bid price
810  /// recovered from snapshot for given security.
811  virtual
812  void
814  Handler&,
815  const Security&,
816  const Recovery52EntryArgs&)
817  {
818  }
819 
820  /// Invoked when session highest bid
821  /// price is received for the security.
822  virtual
823  void
825  Handler&,
826  const Security&,
828  {
829  }
830 
831  /// Invoked when session lowest offer price
832  /// recovered from snapshot for given security.
833  virtual
834  void
836  Handler&,
837  const Security&,
838  const Recovery52EntryArgs&)
839  {
840  }
841 
842  /// Invoked when session lowest offer
843  /// price is received for the security.
844  virtual
845  void
847  Handler&,
848  const Security&,
850  {
851  }
852 
853  /// Invoked when threshold limits and price
854  /// band variation is received for the security.
855  virtual
856  void
858  Handler&,
859  const Security&,
860  const LimitsAndBanding50Args&)
861  {
862  }
863 
864  /// Invoked when request for quote
865  /// data is received for the security.
866  virtual
867  void
869  Handler&,
870  const Security&,
872  {
873  }
874 
875  /// Invoked when security status
876  /// is recovered from snapshot.
877  virtual
878  void
880  Handler&,
881  const Security&,
883  {
884  }
885 
886  /// Invoked when security status
887  /// is received for given security.
888  virtual
889  void
891  Handler&,
892  const Security&,
893  const SecurityStatus30Args&)
894  {
895  }
896 
897  /// Invoked when security status
898  /// is received for group of securities.
899  virtual
900  void
902  Handler&,
903  const SecurityStatus30Args&)
904  {
905  }
906 
907  /// Invoked when gap on is detected in market
908  /// data referring to the given security.
909  virtual
910  void
912  Handler&,
913  const Security&,
914  UInt32)
915  {
916  }
917 };
918 
SecurityDataArgs< QuoteRequest39, QuoteRequest39::RelatedSymEntry > QuoteRequest39RelatedSymArgs
Instantiation of security data attributes for quote request related symbols.
MDIncrementalRefreshSessionStatistics.
Definition: Messages.h:4072
virtual void onLowTradePrice(Handler &, const Security &, const Recovery52EntryArgs &)
TradeSummaryArgs(const TradeSummaryArgs &other)
Initializes the instance as ref-copy of the other one.
virtual void onHighestBid(Handler &, const Security &, const SessionStatistics51Args &)
virtual void onBookAtomicUpdate(Handler &, const Security &, const MboRecovery53EntryArgs &)
Invoked when atomic book update for.
virtual void onOpeningPrice(Handler &, const Security &, const SessionStatistics51Args &)
virtual void onStatus(Handler &, const Security &, const SnapshotFullRefresh52Args &)
SnapshotFullRefreshOrderBook.
Definition: Messages.h:6381
MDIncrementalRefreshBook.
Definition: Messages.h:3354
virtual void onOpenInterest(Handler &, const Security &, const Recovery52EntryArgs &)
virtual void onOpeningPrice(Handler &, const Security &, const Recovery52EntryArgs &)
UInt32 UInt32
uInt32.
Definition: Fields.h:247
virtual void onOpenInterest(Handler &, const Security &, const DailyStatistics49Args &)
const NetPacket & packet() const
BookUpdateErrorArgs< MboBook > MboBookUpdateErrorArgs
virtual void onUndefined(Handler &, Security &)
Attributes of trade summary.
SecurityDataArgs< IncrementalRefreshBook46, IncrementalRefreshBook46CombinedEntry > MboBookCombined46AtomicUpdateArgs
Instantiation of security data attributes for MBO book atomic updates.
Base::Entry Entry
Aliases trade summary data entry.
SecurityDataArgs< IncrementalRefreshSessionStatistics51 > SessionStatistics51Args
Instantiation of security data attributes for session statistics.
virtual void onElectronicVolume(Handler &, const Security &, const Recovery52EntryArgs &)
virtual void onDefinition(Handler &, const Security &, const InstrumentDefinitionFuture54Args &)
Invoked upon instrument definition reception.
virtual void onBookUpdate(Handler &, const Security &, const ImpliedBook &)
const Message & message() const
Instance of message containing market data entry.
virtual void onElectronicVolume(Handler &, const Security &, const Volume37Args &)
SecurityDataArgs(const SecurityDataArgs &other)
Initializes instance as copy of other one.
MDIncrementalRefreshDailyStatistics.
Definition: Messages.h:3677
virtual void onBookAtomicUpdate(Handler &, const Security &, const MboBookCombined46AtomicUpdateArgs &)
virtual void onHighestBid(Handler &, const Security &, const Recovery52EntryArgs &)
virtual void onBookUpdate(Handler &, const Security &, const ConsolidatedBook &)
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:46
Exposes details of book maintenance failure.
virtual void onBookUpdate(Handler &, const Security &, const MboBook &)
virtual void onClearedVolume(Handler &, const Security &, const Recovery52EntryArgs &)
const Entry & entry() const
Instance of market data being referenced.
virtual void onReset(Handler &)
virtual void onTrade(Handler &, const Security &, const TradeSummary48Args &)
SecurityDataArgs< IncrementalRefreshOrderBook47 > MboBook47AtomicUpdateArgs
Instantiation of security data attributes for MBO book atomic updates.
const Book & book() const
Book which wasn&#39;t updated successfully.
MDIncrementalRefreshOrderBook.
Definition: Messages.h:6189
Callbacks invoked by Handler to expose market data entities.
virtual void onQuoteRequest(Handler &, const Security &, const QuoteRequest39RelatedSymArgs &)
virtual void onClearedVolume(Handler &, const Security &, const DailyStatistics49Args &)
virtual void onSettlementPrice(Handler &, const Security &, const DailyStatistics49Args &)
SecurityDataArgs(const NetPacket &packet, const Message &message, const Entry &entry)
virtual void onGroupStatus(Handler &, const SecurityStatus30Args &)
TradeSummaryArgs(const NetPacket &packet, const Message &message, const Entry &entry, const OrderIds &ids=nullOrders())
Initializes instance with data to be referenced.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
virtual void onFixingPrice(Handler &, const Security &, const Recovery52EntryArgs &)
virtual void onSettlementPrice(Handler &, const Security &, const Recovery52EntryArgs &)
MDIncrementalRefreshTradeSummary.
Definition: Messages.h:5905
TradeOrderIds OrderIds
Aliases collection of order ids.
const std::string & description() const
Details on book update failure.
virtual void onTrade(Handler &, const Security &, const Recovery52EntryArgs &)
Attributes associated with security.
Definition: Security.h:29
SecurityDataArgs< SnapshotFullRefreshOrderBook53 > MboRecovery53EntryArgs
Instantiation of security data attributes for MBO recovery data.
virtual void onHighTradePrice(Handler &, const Security &, const Recovery52EntryArgs &)
BookUpdateErrorArgs(const Book &book, const std::string &description)
virtual void onBookUpdateError(Handler &, const Security &, const MboBookUpdateErrorArgs &)
virtual void onDefinition(Handler &, const Security &, const InstrumentDefinitionOption55Args &)
Invoked upon instrument definition reception.
virtual void onBookAtomicUpdate(Handler &, const Security &, const Recovery52EntryArgs &)
Invoked when atomic book update for.
virtual void onBookUpdate(Handler &, const Security &, const DirectBook &)
virtual void onRecovery(Handler &, const Security &, const SnapshotFullRefresh52Args &)
virtual void onDefinition(Handler &, const Security &, const InstrumentDefinitionFixedIncome57Args &)
Invoked upon instrument definition reception.
const OrderIds & orderIds() const
MDIncrementalRefreshVolume.
Definition: Messages.h:4262
BookUpdateErrorArgs< ImpliedBook > ImpliedBookUpdateErrorArgs
virtual void onHighTradePrice(Handler &, const Security &, const SessionStatistics51Args &)
BookUpdateErrorArgs< DirectBook > DirectBookUpdateErrorArgs
virtual void onBookAtomicUpdate(Handler &, const Security &, const MbpBook46AtomicUpdateArgs &)
virtual void onRecovery(Handler &, const Security &, const SnapshotFullRefreshOrderBook53Args &)
SecurityDataArgs< IncrementalRefreshVolume37 > Volume37Args
Instantiation of security data attributes for volumes.
virtual void onFixingPrice(Handler &, const Security &, const DailyStatistics49Args &)
virtual void onBookAtomicUpdate(Handler &, const Security &, const MboBook47AtomicUpdateArgs &)
SecurityDataArgs< SnapshotFullRefresh52 > Recovery52EntryArgs
Instantiation of security data attributes for recovery data.
virtual void onLimitsAndBanding(Handler &, const Security &, const LimitsAndBanding50Args &)
TradeSummaryArgs< IncrementalRefreshTradeSummary48 > TradeSummary48Args
virtual void onStatus(Handler &, const Security &, const SecurityStatus30Args &)
virtual void onBookUpdateError(Handler &, const Security &, const ImpliedBookUpdateErrorArgs &)
SecurityDataArgs< Summary, Data > Base
virtual void onDefinition(Handler &, const Security &, const FIX::MultiContainerArgs &)
virtual void onGap(Handler &, const Security &, UInt32)
virtual void onBookUpdateError(Handler &, const Security &, const DirectBookUpdateErrorArgs &)
virtual void onDefinition(Handler &, const Security &, const InstrumentDefinitionSpread56Args &)
Invoked upon instrument definition reception.
virtual void onLowestOffer(Handler &, const Security &, const SessionStatistics51Args &)
#define ONIXS_CMEMDH_EXPORTED_STRUCT
Definition: Bootstrap.h:58
virtual void onLowTradePrice(Handler &, const Security &, const SessionStatistics51Args &)
SecurityDataArgs< IncrementalRefreshLimitsBanding50 > LimitsAndBanding50Args
Instantiation of security data attributes for limits and banding.
SecurityDataArgs< IncrementalRefreshBook46 > MbpBook46AtomicUpdateArgs
Instantiation of security data attributes for MBP book atomic updates.
Market By Order book.
Definition: MboBook.h:82
SecurityDataArgs< IncrementalRefreshDailyStatistics49 > DailyStatistics49Args
Instantiation of security data attributes for daily statistics.
virtual void onLowestOffer(Handler &, const Security &, const Recovery52EntryArgs &)
MDIncrementalRefreshLimitsBanding.
Definition: Messages.h:3885
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156