OnixS C++ CME Market Data Handler  5.7.0
API documentation
BookManagement.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 <string>
24 
25 #include <OnixS/CME/MDH/Decimal.h>
26 
28 
31 
33 
35 
36 /// Raises exception on invalid best bid/offer threshold value.
37 inline
38 void
40 {
41  throw std::runtime_error
42  (
43  "Threshold for tracking best bids "
44  "or offers can't be a negative value. "
45  );
46 }
47 
48 /// Defines tracking attributes for a particular BBO parameter.
50 {
51  // Group which the given set of settings belongs to.
52  const SettingGroup& group_;
53 
54  // Actual threshold value.
55  Decimal threshold_;
56 
57  // Indicates whether threshold must be used.
58  bool enabled_;
59 
60 protected:
61  /// Lets grouping and value assignment control functioning.
62  friend
64  (
66  );
67 
68  /// Lets grouping and value assignment control functioning.
69  friend
71  (
73  );
74 
75  /// Lets grouping and value assignment control functioning.
76  friend
78  (
80  );
81 
82  /// Instance of a group which the
83  /// given set of settings belongs to.
84  const SettingGroup& group() const
85  {
86  return group_;
87  }
88 
89  /// Re-initializes the instance as a copy of the
90  /// other one and bypassing assignment control.
91  void
92  assignNoControl(
93  const BboThreshold& other)
94  {
95  threshold_ = other.threshold_;
96  enabled_ = other.enabled_;
97  }
98 
99 public:
100  /// Initializes BBO attribute (price, qty, etc) tracking.
101  ///
102  /// Optional setting group instance allows binding the given
103  /// set of settings to a particular group of settings.
104  BboThreshold(
105  const SettingGroup* group = NULL)
106  : group_(group ? *group : SettingGroup::null())
107  , threshold_(), enabled_(false)
108  {
109  }
110 
111  /// Initializes as a copy of the
112  /// other one.
113  ///
114  /// Attributes controlling value
115  /// assignment aren't cloned and
116  /// thus only settings are copied.
118  const BboThreshold& other)
119  : group_(
120  SettingGroup::null())
121  , threshold_(
122  other.threshold_)
123  , enabled_(
124  other.enabled_)
125  {
126  }
127 
128  /// Finalizes the group.
129  ~BboThreshold()
130  {
131  }
132 
133  /// Indicates whether tracking is enabled.
134  bool
135  enabled() const
136  {
137  return enabled_;
138  }
139 
140  /// Indicates whether tracking is enabled.
141  BboThreshold&
142  enabled(
143  bool value)
144  {
145  group_.
146  controlAssignment
147  (
148  "BBO Threshold Enable",
149  enabled_,
150  value
151  );
152 
153  return *this;
154  }
156  /// Threshold for the parameter being tracked.
157  const
158  Decimal&
159  threshold() const
160  {
161  return threshold_;
162  }
163 
164  /// Updates threshold for the
165  /// parameter being tracked.
166  BboThreshold&
167  threshold(
168  const Decimal& value)
169  {
170  if (0 <= value.mantissa())
171  {
172  group_.
173  controlAssignment
174  (
175  "BBO Threshold",
176  threshold_,
177  value
178  );
179  }
180  else
181  {
183  }
184 
185  return *this;
186  }
187 
188  /// Re-initializes as a copy of the other one.
189  ///
190  /// Attributes controlling value assignment aren't
191  /// cloned and thus only settings are copied.
192  BboThreshold&
193  operator =(
194  const BboThreshold& other)
195  {
196  group_.
197  controlChange
198  (
199  "BBO Threshold Settings",
200  &BboThreshold::assignNoControl,
201  *this,
202  other
203  );
204 
205  return *this;
206  }
207 };
208 
209 /// Checks whether new value exceeds given
210 /// threshold in compare to the old value.
211 ONIXS_CMEMDH_EXPORTED
212 bool
214  const Decimal&,
215  const Decimal&,
216  const Decimal&);
217 
218 /// Checks whether new value exceeds given
219 /// threshold in compare to the old value.
220 ONIXS_CMEMDH_EXPORTED
221 bool
223  const Decimal&,
224  Int32,
225  Int32);
226 
227 /// Defines tracking for BBO in MBO books.
229 {
230  BboThreshold price_;
231 
232 protected:
233  /// Lets grouping and value assignment control functioning.
234  template<class>
235  friend
236  class
238 
239  /// Instance of the group of setting which
240  /// the given set of settings belongs to.
241  const
242  SettingGroup&
243  group() const
244  {
245  return price_.group();
246  }
247 
248  /// Re-initializes as a copy of the other instance
249  /// without involving value assignment control services.
250  void
251  assignNoControl(
252  const MboBboTracking& other)
253  {
254  price_.
255  assignNoControl(
256  other.price_);
257  }
258 
259 public:
260  /// Initializes tracking settings
261  /// with optional grouping services.
263  const SettingGroup* group = NULL)
264  : price_(group)
265  {
266  }
267 
268  /// Initializes the instance as a copy of the other one.
269  ///
270  /// Attributes controlling value assignment aren't
271  /// cloned and thus only settings' values are copied.
273  const MboBboTracking& other)
274  : price_(other.price_)
275  {
276  }
278  /// Finalizes the instance.
279  ~MboBboTracking()
280  {
281  }
282 
283  /// Price tracking attributes.
284  const
285  BboThreshold&
286  price() const
287  {
288  return price_;
289  }
291  /// Price tracking attributes.
292  BboThreshold& price()
293  {
294  return price_;
295  }
296 
297  /// Indicates whether tracking enabled at all.
298  bool
299  enabled() const
300  {
301  return (
302  price_.enabled()
303  );
304  }
305 
306  /// Checks whether any of thresholds is exceeded.
307  bool
308  exceeded(
309  const Order& previous,
310  const Order& current) const
311  {
312  return
313  (
314  price_.enabled()
315  &&
317  (
318  price_.threshold(),
319  previous.price(),
320  current.price()
321  )
322  );
323  }
324 
325  /// Re-initializes the instance
326  /// as a copy of the other one.
328  operator =(
329  const MboBboTracking& other)
330  {
331  group().
332  controlChange
333  (
334  "MBO BBO Tracking Settings",
335  &MboBboTracking::assignNoControl,
336  *this,
337  other
338  );
339 
340  return *this;
341  }
342 };
343 
344 /// Serializes BBO tracking parameters into string.
345 ONIXS_CMEMDH_EXPORTED
346 void
347 toStr(
348  std::string&,
349  const MboBboTracking&);
350 
351 /// Serializes BBO tracking parameters into string.
352 inline
353 std::string
355  const MboBboTracking& tracking)
356 {
357  std::string str;
358 
359  toStr(str, tracking);
360 
361  return str;
362 }
363 
364 /// Defines tracking for BBO in implied books.
366 {
367  BboThreshold price_;
368  BboThreshold quantity_;
369 
370 protected:
371  /// Lets grouping and value assignment control functioning.
372  template<class>
373  friend
374  class
376 
377  /// Instance of the group of setting which
378  /// the given set of settings belongs to.
379  const
380  SettingGroup&
381  group() const
382  {
383  return price_.group();
384  }
385 
386  /// Re-initializes as a copy of the other instance
387  /// without involving value assignment control services.
388  void
389  assignNoControl(
390  const ImpliedBboTracking& other)
391  {
392  price_.assignNoControl(other.price_);
393  quantity_.assignNoControl(other.quantity_);
394  }
395 
396 public:
397  /// Initializes tracking with
398  /// optional grouping facilities.
400  const SettingGroup* group = NULL)
401  : price_(group), quantity_(group)
402  {
403  }
404 
405  /// Initializes the instance
406  /// as a copy of the other one.
407  ///
408  /// Attributes controlling value
409  /// assignment aren't cloned and
410  /// thus only settings are copied.
412  const ImpliedBboTracking& other)
413  : price_(other.price_)
414  , quantity_(other.quantity_)
415  {
416  }
418  /// Finalizes the instance.
420  {
421  }
422 
423  /// Price tracking attributes.
424  const
425  BboThreshold&
426  price() const
427  {
428  return price_;
429  }
431  /// Price tracking attributes.
432  BboThreshold& price()
433  {
434  return price_;
435  }
436 
437  /// Quantity tracking attributes.
438  const
439  BboThreshold&
440  quantity() const
441  {
442  return quantity_;
443  }
445  /// Quantity tracking attributes.
446  BboThreshold& quantity()
447  {
448  return quantity_;
449  }
450 
451  /// Indicates whether tracking enabled at all.
452  bool
453  enabled() const
454  {
455  return (
456  price_.enabled()
457  ||
458  quantity_.enabled()
459  );
460  }
461 
462  /// Checks whether any of thresholds is exceeded.
463  bool
464  exceeded(
465  const ImpliedPriceLevel& previous,
466  const ImpliedPriceLevel& current) const
467  {
468  return (
469  (price_.enabled()
470  &&
472  price_.threshold(),
473  previous.price(),
474  current.price()))
475  ||
476  (quantity_.enabled()
477  &&
479  quantity_.threshold(),
480  previous.quantity(),
481  current.quantity()))
482  );
483  }
484 
485  /// Re-initializes the instance
486  /// as a copy of the other one.
487  ///
488  /// Attributes controlling value
489  /// assignment aren't cloned and
490  /// thus only settings are copied.
492  operator =(
493  const ImpliedBboTracking& other)
494  {
495  group().
496  controlChange
497  (
498  "Implied BBO Tracking Settings",
499  &ImpliedBboTracking::assignNoControl,
500  *this,
501  other
502  );
503 
504  return *this;
505  }
506 };
507 
508 /// Serializes BBO tracking parameters into string.
509 ONIXS_CMEMDH_EXPORTED
510 void
511 toStr(
512  std::string&,
513  const ImpliedBboTracking&);
514 
515 /// Serializes BBO tracking parameters into string.
516 inline
517 std::string
519  const ImpliedBboTracking& tracking)
520 {
521  std::string str;
522 
523  toStr(str, tracking);
524 
525  return str;
526 }
527 
528 /// Defines tracking for BBO in direct books.
531 : public ImpliedBboTracking
532 {
533  BboThreshold numberOfOrders_;
534 
535 protected:
536  /// Lets grouping and value
537  /// assignment control functioning.
538  template<class>
539  friend
540  class
542 
543  /// Re-initializes as a copy of the other instance
544  /// without involving value assignment control services.
545  void
546  assignNoControl(
547  const DirectBboTracking& other)
548  {
549  ImpliedBboTracking::
550  assignNoControl(other);
551 
552  numberOfOrders_.
553  assignNoControl(
554  other.numberOfOrders_);
555  }
556 
557 public:
558  /// Initializes tracking with the
559  /// optional grouping services enabled.
561  const SettingGroup* group = NULL)
562  : ImpliedBboTracking(group)
563  , numberOfOrders_(group)
564  {
565  }
566 
567  /// Initializes the instance
568  /// as a copy of the other one.
569  ///
570  /// Attributes controlling value
571  /// assignment aren't cloned and
572  /// thus only settings are copied.
574  const DirectBboTracking& other)
576  static_cast
577  <const ImpliedBboTracking&>
578  (other))
579  , numberOfOrders_(
580  other.numberOfOrders_)
581  {
582  }
584  /// Finalizes the instance.
586  {
587  }
588 
589  /// Tracking for order quantity.
590  const
591  BboThreshold&
592  numberOfOrders() const
593  {
594  return numberOfOrders_;
595  }
596 
597  /// Tracking for order quantity.
598  BboThreshold&
599  numberOfOrders()
600  {
601  return numberOfOrders_;
602  }
603 
604  /// Indicates whether tracking enabled at all.
605  bool
606  enabled() const
607  {
608  return (
609  ImpliedBboTracking::enabled()
610  ||
611  numberOfOrders_.enabled()
612  );
613  }
614 
615  /// Checks whether any of thresholds is exceeded.
616  bool
617  exceeded(
618  const DirectPriceLevel& previous,
619  const DirectPriceLevel& current) const
620  {
621  return
622  (
624  exceeded
625  (
626  previous,
627  current
628  )
629  ||
630  (
631  numberOfOrders_.enabled()
632  &&
634  (
635  numberOfOrders_.threshold(),
636  previous.numberOfOrders(),
637  current.numberOfOrders()
638  )
639  )
640  );
641  }
642 
643  /// Re-initializes instance as
644  /// a copy of the other one.
645  ///
646  /// Attributes controlling value
647  /// assignment aren't cloned and
648  /// thus only settings are copied.
650  operator =(
651  const DirectBboTracking& other)
652  {
653  group().
654  controlChange
655  (
656  "Direct BBO Tracking Settings",
657  &DirectBboTracking::assignNoControl,
658  *this,
659  other
660  );
661 
662  return *this;
663  }
664 };
665 
666 /// Serializes BBO tracking parameters into string.
667 ONIXS_CMEMDH_EXPORTED
668 void
669 toStr(
670  std::string&,
671  const DirectBboTracking&);
672 
673 /// Serializes BBO tracking parameters into string.
674 inline
675 std::string
677  const DirectBboTracking& tracking)
678 {
679  std::string str;
680 
681  toStr(str, tracking);
682 
683  return str;
684 }
685 
686 /// Parameters affecting book management machinery for
687 /// a particular book type (direct, implied, consolidated).
688 template
689 <
690  class BboTracking
691 >
692 class
694 {
695  // Indicates whether feature is enabled.
696  bool maintain_;
697 
698  // Parameters for tracking.
699  BboTracking bboTracking_;
700 
701 protected:
702  /// Lets grouping and value
703  /// assignment control functioning.
704  friend
706  (
708  );
709 
710  /// Instance of the group of setting which
711  /// the given set of settings belongs to.
712  const
713  SettingGroup&
714  group() const
715  {
716  return bboTracking_.group();
717  }
719  /// Re-initializes as a copy of the other instance
720  /// without involving value assignment control services.
721  void
722  assignNoControl(
723  const BaseBookManagement& other)
724  {
725  maintain_ =
726  other.maintain_;
727 
728  bboTracking_.
729  assignNoControl(
730  other.bboTracking_);
731  }
733 public:
734  /// Initializes instance with the default values
735  /// and setting validation facilities enabled.
737  const SettingGroup* group = NULL)
738  : maintain_(false), bboTracking_(group)
739  {
740  }
741 
742  /// Initializes the instance
743  /// as a copy of the other one.
744  ///
745  /// Attributes controlling value
746  /// assignment aren't cloned and
747  /// thus only settings are copied.
749  const BaseBookManagement& other)
750  : maintain_(other.maintain_)
751  , bboTracking_(other.bboTracking_)
752  {
753  }
754 
755  /// Finalizes the instance.
757  {
758  }
759 
760  /// Forces to build order book of a particular kind.
761  ///
762  /// Unless parameter is set to 'true', Handler doesn't
763  /// construct and doesn't process data blocks for the
764  /// books of given kind. If book isn't built, book snapshot
765  /// retrieval is not possible.
766  ///
767  /// @note Default value is 'false'.
768  bool
769  maintain() const
770  {
771  return maintain_;
772  }
773 
774  /// Forces Handler to maintain order books.
776  maintain(
777  bool value)
778  {
779  group().
780  controlAssignment
781  (
782  "Maintain",
783  maintain_,
784  value
785  );
786 
787  return *this;
788  }
789 
790  /// Parameters affecting BBO tracking for
791  /// books which given settings refer to.
792  const
793  BboTracking&
794  bboTracking() const
795  {
796  return bboTracking_;
797  }
798 
799  /// Parameters affecting BBO tracking for
800  /// books which given settings refer to.
801  BboTracking& bboTracking()
802  {
803  return bboTracking_;
804  }
805 
806  /// Re-initializes the instance
807  /// as a copy of other one.
808  ///
809  /// Attributes controlling value
810  /// assignment aren't cloned and
811  /// thus only settings are copied.
813  operator =(
814  const
815  BaseBookManagement& other)
816  {
817  group().
818  controlChange
819  (
820  "Base Book Management Settings",
821  &BaseBookManagement::assignNoControl,
822  *this,
823  other
824  );
825 
826  return *this;
827  }
828 };
829 
830 /// Parameters affecting book management machinery for
831 /// a particular book type (direct, implied, consolidated).
832 template
833 <
834  class BboTracking,
835  typename Depth
836 >
837 class
839 : public BaseBookManagement
840 <
841  BboTracking
842 >
843 {
844  // Lets grouping and value assignment control functioning.
845  friend
847  (
849  );
850 
851  // Alias for the base class.
852  typedef
854  <
855  BboTracking
856  >
857  Base;
858 
859  //
860 
861  Depth defaultDepth_;
862 
863  // Re-initializes as a copy of the other instance
864  // without involving value assignment control services.
865  void
866  assignNoControl(
867  const FixedDepthBookManagement& other)
868  {
869  Base::assignNoControl(other);
870 
871  defaultDepth_ =
872  other.defaultDepth_;
873  }
875 public:
876  /// Initializes instance with defaults
877  /// and optional grouping facilities.
879  const SettingGroup* group = NULL,
880  Depth defaultDepth = 0)
881  : Base(group)
882  , defaultDepth_(
883  defaultDepth)
884  {
885  }
886 
887  /// Initializes the instance
888  /// as a copy of the other one.
889  ///
890  /// Attributes controlling value
891  /// assignment aren't cloned and
892  /// thus only settings are copied.
894  const
896  : Base(
897  static_cast
898  <const Base&>
899  (other))
900  , defaultDepth_(
901  other.defaultDepth_)
902  {
903  }
904 
905  /// Finalizes the instance.
907  {
908  }
909 
910  /// Defines default depth of order book for
911  /// the security whose definition wasn't
912  /// received or had no corresponding data.
913  Depth
914  defaultDepth() const
915  {
916  return defaultDepth_;
917  }
918 
919  /// Defines default depth of order book for
920  /// the security whose definition wasn't
921  /// received or had no corresponding data.
923  defaultDepth(
924  Depth value)
925  {
926  this->
927  group().
928  controlAssignment
929  (
930  "Default Depth",
931  defaultDepth_,
932  value
933  );
934 
935  return *this;
936  }
937 
938  /// Re-initializes the instance
939  /// as a copy of the other one.
940  ///
941  /// Attributes controlling value
942  /// assignment aren't cloned and
943  /// thus only settings are copied.
945  operator =(
946  const
948  {
949  this->
950  group().
951  controlChange
952  (
953  "Fixed Depth Book Management Settings",
954  &FixedDepthBookManagement::assignNoControl,
955  *this,
956  other
957  );
958 
959  return *this;
960  }
961 };
962 
963 /// Parameters affecting book management machinery
964 /// for a books having variable depth like MBO ones.
965 template
966 <
967  class BboTracking,
968  typename Depth
969 >
970 class
972 : public BaseBookManagement
973 <
974  BboTracking
975 >
976 {
977  // Lets grouping and value assignment control functioning.
978  friend
980  (
982  );
983 
984  // Alias for the base class.
985  typedef
987  <
988  BboTracking
989  >
990  Base;
991 
992  //
993 
994  Depth reserved_;
995 
996  // Re-initializes as a copy of the other instance
997  // without involving value assignment control services.
998  void
999  assignNoControl(
1000  const AnyDepthBookManagement& other)
1001  {
1002  Base::assignNoControl(other);
1003  }
1005 public:
1006  /// Initializes the instance with default values.
1007  /// Optional parameter to enable grouping facilities.
1009  const SettingGroup* group = NULL)
1010  : Base(group)
1011  {
1012  }
1013 
1014  /// Initializes the instance
1015  /// as a copy of the other one.
1016  ///
1017  /// Attributes controlling value
1018  /// assignment aren't cloned and
1019  /// thus only settings are copied.
1021  const
1022  AnyDepthBookManagement& other)
1023  : Base(
1024  static_cast
1025  <const Base&>
1026  (other))
1027  {
1028  }
1029 
1030  /// Re-initializes the instance
1031  /// as a copy of the other one.
1032  ///
1033  /// Attributes controlling value
1034  /// assignment aren't cloned and
1035  /// thus only settings are copied.
1037  operator =(
1038  const
1039  AnyDepthBookManagement& other)
1040  {
1041  this->
1042  group().
1043  controlChange
1044  (
1045  "Any Depth Book Management Settings",
1046  &AnyDepthBookManagement::assignNoControl,
1047  *this,
1048  other
1049  );
1050 
1051  return *this;
1052  }
1053 };
1054 
1055 /// Defines book update notification strategies.
1057 {
1058  /// Integral type used as basement for constants.
1059  typedef UInt32 Base;
1060 
1061  enum Enum
1062  {
1063  /// Book update event is raised once security id is changed in
1064  /// sequence of market data entries being processed by the Handler.
1065  ///
1066  /// @warning Given strategy does not follow MDP policy
1067  /// on exposing order books and thus can be used on own risk!
1068  /// Also, books may not be in a valid state (especially consolidated),
1069  /// as far as exposed earlier than data for entire market event
1070  /// is processed.
1072 
1073  /// Book update event is raised at the end of market event.
1074  ///
1075  /// Direct books updates are raised at the end of real
1076  /// quotes updates, implied books updates are raised at
1077  /// the end of implied quotes updates and consolidated
1078  /// books updates are raised at the end of entire event.
1079  OnEndOfEvent
1080  };
1081 };
1082 
1083 /// Serializes book update notification policy into a string.
1084 ONIXS_CMEMDH_EXPORTED
1085 void
1086 toStr(
1087  std::string&,
1089 
1090 /// Serializes book update notification policy into a string.
1091 inline
1092 std::string
1095 {
1096  std::string str;
1097 
1098  toStr(str, strategy);
1099 
1100  return str;
1101 }
1102 
1103 // Aliases for instantiations.
1104 
1105 /// Management and tracking parameters for MBO books.
1106 typedef
1108 <
1110  SortedOrders::size_type
1111 >
1113 
1114 /// Management and tracking parameters for direct books.
1115 typedef
1117 <
1119  MbpBookDepth
1120 >
1122 
1123 /// Management and tracking parameters for implied books.
1124 typedef
1126 <
1128  MbpBookDepth
1129 >
1131 
1132 /// Management and tracking parameters for consolidated books.
1133 typedef
1135 <
1137 >
1139 
1140 /// Parameters affecting book management machinery.
1143 {
1144  // Lets grouping and value
1145  // assignment control functioning.
1146  friend
1148  (
1150  );
1151 
1152  // Subsets of parameters.
1153 
1154  MboBookManagement mboBooks_;
1155 
1156  DirectBookManagement directBooks_;
1157  ImpliedBookManagement impliedBooks_;
1158 
1159  ConsolidatedBookManagement consolidatedBooks_;
1160 
1161  BookUpdateNotification::Enum updateNotification_;
1162 
1163  // Casts the given instance to an
1164  // instance of SettingGroup class.
1165  const
1166  SettingGroup&
1167  group() const
1168  {
1169  return *this;
1170  }
1171 
1172  // Re-initializes the given instance
1173  // as a copy of the other one without
1174  // involving assignment control service.
1175  void
1176  assignNoControl(
1177  const BookManagement& other)
1178  {
1179  mboBooks_.
1180  assignNoControl(
1181  other.mboBooks_);
1182 
1183  directBooks_.
1184  assignNoControl(
1185  other.directBooks_);
1186 
1187  impliedBooks_.
1188  assignNoControl(
1189  other.impliedBooks_);
1190 
1191  consolidatedBooks_.
1192  assignNoControl(
1193  other.consolidatedBooks_);
1194 
1195  updateNotification_ =
1196  other.updateNotification_;
1197  }
1198 
1199 public:
1200  /// Initializes instance with default values.
1203  controller = NULL)
1204  : SettingGroup(controller)
1205  , mboBooks_(&group())
1206  , directBooks_(&group(), 10)
1207  , impliedBooks_(&group(), 2)
1208  , updateNotification_(
1210  OnEndOfEvent)
1211  {
1212  }
1213 
1214  /// Initializes the instance
1215  /// as a copy of the other one.
1216  ///
1217  /// Attributes controlling value
1218  /// assignment aren't cloned and
1219  /// thus only settings are copied.
1221  const BookManagement& other)
1222  : SettingGroup()
1223  , mboBooks_(
1224  other.mboBooks_)
1225  , directBooks_(
1226  other.directBooks_)
1227  , impliedBooks_(
1228  other.impliedBooks_)
1229  , consolidatedBooks_(
1230  other.consolidatedBooks_)
1231  , updateNotification_(
1232  other.updateNotification_)
1233  {
1234  }
1235 
1236  // Finalizes the instance.
1237  ~BookManagement()
1238  {
1239  }
1241  /// Management and tracking parameters for direct books.
1242  const
1244  mboBooks() const
1245  {
1246  return mboBooks_;
1247  }
1248 
1249  /// Management and tracking parameters for direct books.
1251  mboBooks()
1252  {
1253  return mboBooks_;
1254  }
1256  /// Management and tracking parameters for direct books.
1257  const
1259  directBooks() const
1260  {
1261  return directBooks_;
1262  }
1263 
1264  /// Management and tracking parameters for direct books.
1266  directBooks()
1267  {
1268  return directBooks_;
1269  }
1271  /// Management and tracking parameters for implied books.
1272  const
1274  impliedBooks() const
1275  {
1276  return impliedBooks_;
1277  }
1278 
1279  /// Management and tracking parameters for implied books.
1281  impliedBooks()
1282  {
1283  return impliedBooks_;
1284  }
1286  /// Management and tracking parameters for consolidated books.
1287  const
1289  consolidatedBooks() const
1290  {
1291  return consolidatedBooks_;
1292  }
1293 
1294  /// Management and tracking parameters for consolidated books.
1296  consolidatedBooks()
1297  {
1298  return consolidatedBooks_;
1299  }
1300 
1301  /// Defines the way Handler raises onBookUpdated callbacks.
1302  ///
1303  /// @note Default is BookUpdateNotification::OnEndOfEvent.
1305  updateNotification() const
1306  {
1307  return updateNotification_;
1308  }
1309 
1310  /// Defines the way Handler raises order book update event.
1311  BookManagement&
1312  updateNotification(
1314  {
1315  group().
1316  controlAssignment
1317  (
1318  "Update Notification",
1319  updateNotification_,
1320  value
1321  );
1322 
1323  return *this;
1324  }
1325 
1326  /// Copies settings from the given instance.
1327  ///
1328  /// Attributes controlling value assignment aren't
1329  /// cloned and thus only settings' values are copied.
1331  operator =(
1332  const BookManagement& other)
1333  {
1334  group().
1335  controlChange
1336  (
1337  "Book Management Settings",
1338  &BookManagement::assignNoControl,
1339  *this,
1340  other
1341  );
1342 
1343  return *this;
1344  }
1345 };
1346 
1347 /// Serializes book management settings into string.
1348 ONIXS_CMEMDH_EXPORTED
1349 void
1350 toStr(
1351  std::string&,
1352  const BookManagement&);
1353 
1354 /// Serializes book management settings into string.
1355 inline
1356 std::string
1358  const BookManagement& settings)
1359 {
1360  std::string str;
1361 
1362  toStr(str, settings);
1363 
1364  return str;
1365 }
1366 
AnyDepthBookManagement< MboBboTracking, SortedOrders::size_type > MboBookManagement
Management and tracking parameters for MBO books.
Encapsulates price level concept.
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:94
void assignNoControl(const BboThreshold &other)
Handler&#39;s configuration settings.
Int32 quantity() const
Quantify for the given price.
Int32 Int32
int32.
Definition: Fields.h:69
Defines tracking for BBO in direct books.
UInt32 UInt32
uInt32.
Definition: Fields.h:247
const Decimal & threshold() const
Threshold for the parameter being tracked.
Defines tracking for BBO in MBO books.
const SettingGroup & group() const
Order as the member of the Market By Order (MBO) book.
Definition: Order.h:79
std::string toStr(const BookManagement &settings)
Serializes book management settings into string.
Int32 & numberOfOrders()
Updates total number of orders.
const Decimal & price() const
Order price.
Definition: Order.h:145
Mantissa mantissa() const
Returns mantissa of given decimal.
Definition: Decimal.h:290
bool value(Number &number, const MultiContainer &container, Tag tag)
Defines tracking for BBO in implied books.
Encapsulates price level concept.
Defines tracking attributes for a particular BBO parameter.
#define ONIXS_CMEMDH_LTWT_STRUCT
Definition: Bootstrap.h:98
Defines book update notification strategies.
UInt8 MbpBookDepth
Market by price order book depth type.
Definition: MbpBookTraits.h:28
const Decimal & price() const
A real number with floating exponent.
Definition: Decimal.h:231
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
FixedDepthBookManagement< ImpliedBboTracking, MbpBookDepth > ImpliedBookManagement
Management and tracking parameters for implied books.
Base services for settings grouped by a certain criteria.
Definition: SettingGroup.h:124
bool enabled() const
Indicates whether tracking is enabled.
FixedDepthBookManagement< DirectBboTracking, MbpBookDepth > DirectBookManagement
Management and tracking parameters for direct books.
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:106
BaseBookManagement< ImpliedBboTracking > ConsolidatedBookManagement
Management and tracking parameters for consolidated books.
void throwBadBboThreshold()
Raises exception on invalid best bid/offer threshold value.
Parameters affecting book management machinery.
ONIXS_CMEMDH_EXPORTED bool thresholdExceeded(const Decimal &, Int32, Int32)
UInt32 Base
Integral type used as basement for constants.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156