OnixS C++ CME Market Data Handler  5.4.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  void
142  enabled(
143  bool value)
144  {
145  group_.
146  controlAssignment
147  (
148  "BBO Threshold Enable",
149  enabled_,
150  value
151  );
152  }
154  /// Threshold for the parameter being tracked.
155  const
156  Decimal&
157  threshold() const
158  {
159  return threshold_;
160  }
161 
162  /// Updates threshold for the
163  /// parameter being tracked.
164  void
165  threshold(
166  const Decimal& value)
167  {
168  if (0 <= value.mantissa())
169  {
170  group_.
171  controlAssignment
172  (
173  "BBO Threshold",
174  threshold_,
175  value
176  );
177  }
178  else
179  {
181  }
182  }
183 
184  /// Re-initializes as a copy of the other one.
185  ///
186  /// Attributes controlling value assignment aren't
187  /// cloned and thus only settings are copied.
188  BboThreshold&
189  operator =(
190  const BboThreshold& other)
191  {
192  group_.
193  controlAssignment
194  (
195  "BBO Threshold Settings",
196  &BboThreshold::assignNoControl,
197  *this,
198  other
199  );
200 
201  return *this;
202  }
203 };
204 
205 /// Checks whether new value exceeds given
206 /// threshold in compare to the old value.
207 ONIXS_CMEMDH_EXPORTED
208 bool
210  const Decimal&,
211  const Decimal&,
212  const Decimal&);
213 
214 /// Checks whether new value exceeds given
215 /// threshold in compare to the old value.
216 ONIXS_CMEMDH_EXPORTED
217 bool
219  const Decimal&,
220  Int32,
221  Int32);
222 
223 /// Defines tracking for BBO in MBO books.
225 {
226  BboThreshold price_;
227 
228 protected:
229  /// Lets grouping and value assignment control functioning.
230  template<class>
231  friend
232  class
234 
235  /// Instance of the group of setting which
236  /// the given set of settings belongs to.
237  const
238  SettingGroup&
239  group() const
240  {
241  return price_.group();
242  }
243 
244  /// Re-initializes as a copy of the other instance
245  /// without involving value assignment control services.
246  void
247  assignNoControl(
248  const MboBboTracking& other)
249  {
250  price_.
251  assignNoControl(
252  other.price_);
253  }
254 
255 public:
256  /// Initializes tracking settings
257  /// with optional grouping services.
259  const SettingGroup* group = NULL)
260  : price_(group)
261  {
262  }
263 
264  /// Initializes the instance as a copy of the other one.
265  ///
266  /// Attributes controlling value assignment aren't
267  /// cloned and thus only settings' values are copied.
269  const MboBboTracking& other)
270  : price_(other.price_)
271  {
272  }
274  /// Finalizes the instance.
275  ~MboBboTracking()
276  {
277  }
278 
279  /// Price tracking attributes.
280  const
281  BboThreshold&
282  price() const
283  {
284  return price_;
285  }
287  /// Price tracking attributes.
288  BboThreshold& price()
289  {
290  return price_;
291  }
292 
293  /// Indicates whether tracking enabled at all.
294  bool
295  enabled() const
296  {
297  return (
298  price_.enabled()
299  );
300  }
301 
302  /// Checks whether any of thresholds is exceeded.
303  bool
304  exceeded(
305  const Order& previous,
306  const Order& current) const
307  {
308  return
309  (
310  price_.enabled()
311  &&
313  (
314  price_.threshold(),
315  previous.price(),
316  current.price()
317  )
318  );
319  }
320 
321  /// Re-initializes the instance
322  /// as a copy of the other one.
324  operator =(
325  const MboBboTracking& other)
326  {
327  group().
328  controlAssignment
329  (
330  "MBO BBO Tracking Settings",
331  &MboBboTracking::assignNoControl,
332  *this,
333  other
334  );
335 
336  return *this;
337  }
338 };
339 
340 /// Serializes BBO tracking parameters into string.
341 ONIXS_CMEMDH_EXPORTED
342 void
343 toStr(
344  std::string&,
345  const MboBboTracking&);
346 
347 /// Serializes BBO tracking parameters into string.
348 inline
349 std::string
351  const MboBboTracking& tracking)
352 {
353  std::string str;
354 
355  toStr(str, tracking);
356 
357  return str;
358 }
359 
360 /// Defines tracking for BBO in implied books.
362 {
363  BboThreshold price_;
364  BboThreshold quantity_;
365 
366 protected:
367  /// Lets grouping and value assignment control functioning.
368  template<class>
369  friend
370  class
372 
373  /// Instance of the group of setting which
374  /// the given set of settings belongs to.
375  const
376  SettingGroup&
377  group() const
378  {
379  return price_.group();
380  }
381 
382  /// Re-initializes as a copy of the other instance
383  /// without involving value assignment control services.
384  void
385  assignNoControl(
386  const ImpliedBboTracking& other)
387  {
388  price_.assignNoControl(other.price_);
389  quantity_.assignNoControl(other.quantity_);
390  }
391 
392 public:
393  /// Initializes tracking with
394  /// optional grouping facilities.
396  const SettingGroup* group = NULL)
397  : price_(group), quantity_(group)
398  {
399  }
400 
401  /// Initializes the instance
402  /// as a copy of the other one.
403  ///
404  /// Attributes controlling value
405  /// assignment aren't cloned and
406  /// thus only settings are copied.
408  const ImpliedBboTracking& other)
409  : price_(other.price_)
410  , quantity_(other.quantity_)
411  {
412  }
414  /// Finalizes the instance.
416  {
417  }
418 
419  /// Price tracking attributes.
420  const
421  BboThreshold&
422  price() const
423  {
424  return price_;
425  }
427  /// Price tracking attributes.
428  BboThreshold& price()
429  {
430  return price_;
431  }
432 
433  /// Quantity tracking attributes.
434  const
435  BboThreshold&
436  quantity() const
437  {
438  return quantity_;
439  }
441  /// Quantity tracking attributes.
442  BboThreshold& quantity()
443  {
444  return quantity_;
445  }
446 
447  /// Indicates whether tracking enabled at all.
448  bool
449  enabled() const
450  {
451  return (
452  price_.enabled()
453  ||
454  quantity_.enabled()
455  );
456  }
457 
458  /// Checks whether any of thresholds is exceeded.
459  bool
460  exceeded(
461  const ImpliedPriceLevel& previous,
462  const ImpliedPriceLevel& current) const
463  {
464  return (
465  (price_.enabled()
466  &&
468  price_.threshold(),
469  previous.price(),
470  current.price()))
471  ||
472  (quantity_.enabled()
473  &&
475  quantity_.threshold(),
476  previous.quantity(),
477  current.quantity()))
478  );
479  }
480 
481  /// Re-initializes the instance
482  /// as a copy of the other one.
483  ///
484  /// Attributes controlling value
485  /// assignment aren't cloned and
486  /// thus only settings are copied.
488  operator =(
489  const ImpliedBboTracking& other)
490  {
491  group().
492  controlAssignment
493  (
494  "Implied BBO Tracking Settings",
495  &ImpliedBboTracking::assignNoControl,
496  *this,
497  other
498  );
499 
500  return *this;
501  }
502 };
503 
504 /// Serializes BBO tracking parameters into string.
505 ONIXS_CMEMDH_EXPORTED
506 void
507 toStr(
508  std::string&,
509  const ImpliedBboTracking&);
510 
511 /// Serializes BBO tracking parameters into string.
512 inline
513 std::string
515  const ImpliedBboTracking& tracking)
516 {
517  std::string str;
518 
519  toStr(str, tracking);
520 
521  return str;
522 }
523 
524 /// Defines tracking for BBO in direct books.
527 : public ImpliedBboTracking
528 {
529  BboThreshold numberOfOrders_;
530 
531 protected:
532  /// Lets grouping and value
533  /// assignment control functioning.
534  template<class>
535  friend
536  class
538 
539  /// Re-initializes as a copy of the other instance
540  /// without involving value assignment control services.
541  void
542  assignNoControl(
543  const DirectBboTracking& other)
544  {
545  ImpliedBboTracking::
546  assignNoControl(other);
547 
548  numberOfOrders_.
549  assignNoControl(
550  other.numberOfOrders_);
551  }
552 
553 public:
554  /// Initializes tracking with the
555  /// optional grouping services enabled.
557  const SettingGroup* group = NULL)
558  : ImpliedBboTracking(group)
559  , numberOfOrders_(group)
560  {
561  }
562 
563  /// Initializes the instance
564  /// as a copy of the other one.
565  ///
566  /// Attributes controlling value
567  /// assignment aren't cloned and
568  /// thus only settings are copied.
570  const DirectBboTracking& other)
572  static_cast
573  <const ImpliedBboTracking&>
574  (other))
575  , numberOfOrders_(
576  other.numberOfOrders_)
577  {
578  }
580  /// Finalizes the instance.
582  {
583  }
584 
585  /// Tracking for order quantity.
586  const
587  BboThreshold&
588  numberOfOrders() const
589  {
590  return numberOfOrders_;
591  }
592 
593  /// Tracking for order quantity.
594  BboThreshold&
595  numberOfOrders()
596  {
597  return numberOfOrders_;
598  }
599 
600  /// Indicates whether tracking enabled at all.
601  bool
602  enabled() const
603  {
604  return (
605  ImpliedBboTracking::enabled()
606  ||
607  numberOfOrders_.enabled()
608  );
609  }
610 
611  /// Checks whether any of thresholds is exceeded.
612  bool
613  exceeded(
614  const DirectPriceLevel& previous,
615  const DirectPriceLevel& current) const
616  {
617  return
618  (
620  exceeded
621  (
622  previous,
623  current
624  )
625  ||
626  (
627  numberOfOrders_.enabled()
628  &&
630  (
631  numberOfOrders_.threshold(),
632  previous.numberOfOrders(),
633  current.numberOfOrders()
634  )
635  )
636  );
637  }
638 
639  /// Re-initializes instance as
640  /// a copy of the other one.
641  ///
642  /// Attributes controlling value
643  /// assignment aren't cloned and
644  /// thus only settings are copied.
646  operator =(
647  const DirectBboTracking& other)
648  {
649  group().
650  controlAssignment
651  (
652  "Direct BBO Tracking Settings",
653  &DirectBboTracking::assignNoControl,
654  *this,
655  other
656  );
657 
658  return *this;
659  }
660 };
661 
662 /// Serializes BBO tracking parameters into string.
663 ONIXS_CMEMDH_EXPORTED
664 void
665 toStr(
666  std::string&,
667  const DirectBboTracking&);
668 
669 /// Serializes BBO tracking parameters into string.
670 inline
671 std::string
673  const DirectBboTracking& tracking)
674 {
675  std::string str;
676 
677  toStr(str, tracking);
678 
679  return str;
680 }
681 
682 /// Parameters affecting book management machinery for
683 /// a particular book type (direct, implied, consolidated).
684 template
685 <
686  class BboTracking
687 >
688 class
690 {
691  // Indicates whether feature is enabled.
692  bool maintain_;
693 
694  // Parameters for tracking.
695  BboTracking bboTracking_;
696 
697 protected:
698  /// Lets grouping and value
699  /// assignment control functioning.
700  friend
702  (
704  );
705 
706  /// Instance of the group of setting which
707  /// the given set of settings belongs to.
708  const
709  SettingGroup&
710  group() const
711  {
712  return bboTracking_.group();
713  }
715  /// Re-initializes as a copy of the other instance
716  /// without involving value assignment control services.
717  void
718  assignNoControl(
719  const BaseBookManagement& other)
720  {
721  maintain_ =
722  other.maintain_;
723 
724  bboTracking_.
725  assignNoControl(
726  other.bboTracking_);
727  }
729 public:
730  /// Initializes instance with the default values
731  /// and setting validation facilities enabled.
733  const SettingGroup* group = NULL)
734  : maintain_(false), bboTracking_(group)
735  {
736  }
737 
738  /// Initializes the instance
739  /// as a copy of the other one.
740  ///
741  /// Attributes controlling value
742  /// assignment aren't cloned and
743  /// thus only settings are copied.
745  const BaseBookManagement& other)
746  : maintain_(other.maintain_)
747  , bboTracking_(other.bboTracking_)
748  {
749  }
750 
751  /// Finalizes the instance.
753  {
754  }
755 
756  /// Forces to build order book of a particular kind.
757  ///
758  /// Unless parameter is set to 'true', Handler doesn't
759  /// construct and doesn't process data blocks for the
760  /// books of given kind. If book isn't built, book snapshot
761  /// retrieval is not possible.
762  ///
763  /// @note Default value is 'false'.
764  bool
765  maintain() const
766  {
767  return maintain_;
768  }
769 
770  /// Forces Handler to maintain order books.
771  void
772  maintain(
773  bool value)
774  {
775  group().
776  controlAssignment
777  (
778  "Maintain",
779  maintain_,
780  value
781  );
782  }
783 
784  /// Parameters affecting BBO tracking for
785  /// books which given settings refer to.
786  const
787  BboTracking&
788  bboTracking() const
789  {
790  return bboTracking_;
791  }
792 
793  /// Parameters affecting BBO tracking for
794  /// books which given settings refer to.
795  BboTracking& bboTracking()
796  {
797  return bboTracking_;
798  }
799 
800  /// Re-initializes the instance
801  /// as a copy of other one.
802  ///
803  /// Attributes controlling value
804  /// assignment aren't cloned and
805  /// thus only settings are copied.
807  operator =(
808  const
809  BaseBookManagement& other)
810  {
811  group().
812  controlAssignment
813  (
814  "Base Book Management Settings",
815  &BaseBookManagement::assignNoControl,
816  *this,
817  other
818  );
819 
820  return *this;
821  }
822 };
823 
824 /// Parameters affecting book management machinery for
825 /// a particular book type (direct, implied, consolidated).
826 template
827 <
828  class BboTracking,
829  typename Depth
830 >
831 class
833 : public BaseBookManagement
834 <
835  BboTracking
836 >
837 {
838  // Lets grouping and value assignment control functioning.
839  friend
841  (
843  );
844 
845  // Alias for the base class.
846  typedef
848  <
849  BboTracking
850  >
851  Base;
852 
853  //
854 
855  Depth defaultDepth_;
856 
857  // Re-initializes as a copy of the other instance
858  // without involving value assignment control services.
859  void
860  assignNoControl(
861  const FixedDepthBookManagement& other)
862  {
863  Base::assignNoControl(other);
864 
865  defaultDepth_ =
866  other.defaultDepth_;
867  }
869 public:
870  /// Initializes instance with defaults
871  /// and optional grouping facilities.
873  const SettingGroup* group = NULL,
874  Depth defaultDepth = 0)
875  : Base(group)
876  , defaultDepth_(
877  defaultDepth)
878  {
879  }
880 
881  /// Initializes the instance
882  /// as a copy of the other one.
883  ///
884  /// Attributes controlling value
885  /// assignment aren't cloned and
886  /// thus only settings are copied.
888  const
890  : Base(
891  static_cast
892  <const Base&>
893  (other))
894  , defaultDepth_(
895  other.defaultDepth_)
896  {
897  }
898 
899  /// Finalizes the instance.
901  {
902  }
903 
904  /// Defines default depth of order book for
905  /// the security whose definition wasn't
906  /// received or had no corresponding data.
907  Depth
908  defaultDepth() const
909  {
910  return defaultDepth_;
911  }
912 
913  /// Defines default depth of order book for
914  /// the security whose definition wasn't
915  /// received or had no corresponding data.
916  void
917  defaultDepth(
918  Depth value)
919  {
920  this->
921  group().
922  controlAssignment
923  (
924  "Default Depth",
925  defaultDepth_,
926  value
927  );
928  }
929 
930  /// Re-initializes the instance
931  /// as a copy of the other one.
932  ///
933  /// Attributes controlling value
934  /// assignment aren't cloned and
935  /// thus only settings are copied.
937  operator =(
938  const
940  {
941  this->
942  group().
943  controlAssignment
944  (
945  "Fixed Depth Book Management Settings",
946  &FixedDepthBookManagement::assignNoControl,
947  *this,
948  other
949  );
950 
951  return *this;
952  }
953 };
954 
955 /// Parameters affecting book management machinery
956 /// for a books having variable depth like MBO ones.
957 template
958 <
959  class BboTracking,
960  typename Depth
961 >
962 class
964 : public BaseBookManagement
965 <
966  BboTracking
967 >
968 {
969  // Lets grouping and value assignment control functioning.
970  friend
972  (
974  );
975 
976  // Alias for the base class.
977  typedef
979  <
980  BboTracking
981  >
982  Base;
983 
984  //
985 
986  Depth reserved_;
987 
988  // Re-initializes as a copy of the other instance
989  // without involving value assignment control services.
990  void
991  assignNoControl(
992  const AnyDepthBookManagement& other)
993  {
994  Base::assignNoControl(other);
995  }
997 public:
998  /// Initializes the instance with default values.
999  /// Optional parameter to enable grouping facilities.
1001  const SettingGroup* group = NULL)
1002  : Base(group)
1003  {
1004  }
1005 
1006  /// Initializes the instance
1007  /// as a copy of the other one.
1008  ///
1009  /// Attributes controlling value
1010  /// assignment aren't cloned and
1011  /// thus only settings are copied.
1013  const
1014  AnyDepthBookManagement& other)
1015  : Base(
1016  static_cast
1017  <const Base&>
1018  (other))
1019  {
1020  }
1021 
1022  /// Re-initializes the instance
1023  /// as a copy of the other one.
1024  ///
1025  /// Attributes controlling value
1026  /// assignment aren't cloned and
1027  /// thus only settings are copied.
1029  operator =(
1030  const
1031  AnyDepthBookManagement& other)
1032  {
1033  this->
1034  group().
1035  controlAssignment
1036  (
1037  "Any Depth Book Management Settings",
1038  &AnyDepthBookManagement::assignNoControl,
1039  *this,
1040  other
1041  );
1042 
1043  return *this;
1044  }
1045 };
1046 
1047 /// Defines book update notification strategies.
1049 {
1050  /// Integral type used as basement for constants.
1051  typedef UInt32 Base;
1052 
1053  enum Enum
1054  {
1055  /// Book update event is raised once security id is changed in
1056  /// sequence of market data entries being processed by the Handler.
1057  ///
1058  /// @warning Given strategy does not follow MDP policy
1059  /// on exposing order books and thus can be used on own risk!
1060  /// Also, books may not be in a valid state (especially consolidated),
1061  /// as far as exposed earlier than data for entire market event
1062  /// is processed.
1064 
1065  /// Book update event is raised at the end of market event.
1066  ///
1067  /// Direct books updates are raised at the end of real
1068  /// quotes updates, implied books updates are raised at
1069  /// the end of implied quotes updates and consolidated
1070  /// books updates are raised at the end of entire event.
1071  OnEndOfEvent
1072  };
1073 };
1074 
1075 /// Serializes book update notification policy into a string.
1076 ONIXS_CMEMDH_EXPORTED
1077 void
1078 toStr(
1079  std::string&,
1081 
1082 /// Serializes book update notification policy into a string.
1083 inline
1084 std::string
1087 {
1088  std::string str;
1089 
1090  toStr(str, strategy);
1091 
1092  return str;
1093 }
1094 
1095 // Aliases for instantiations.
1096 
1097 /// Management and tracking parameters for MBO books.
1098 typedef
1100 <
1102  SortedOrders::size_type
1103 >
1105 
1106 /// Management and tracking parameters for direct books.
1107 typedef
1109 <
1111  MbpBookDepth
1112 >
1114 
1115 /// Management and tracking parameters for implied books.
1116 typedef
1118 <
1120  MbpBookDepth
1121 >
1123 
1124 /// Management and tracking parameters for consolidated books.
1125 typedef
1127 <
1129 >
1131 
1132 /// Parameters affecting book management machinery.
1135 {
1136  // Lets grouping and value
1137  // assignment control functioning.
1138  friend
1140  (
1142  );
1143 
1144  // Subsets of parameters.
1145 
1146  MboBookManagement mboBooks_;
1147 
1148  DirectBookManagement directBooks_;
1149  ImpliedBookManagement impliedBooks_;
1150 
1151  ConsolidatedBookManagement consolidatedBooks_;
1152 
1153  BookUpdateNotification::Enum updateNotification_;
1154 
1155  // Casts the given instance to an
1156  // instance of SettingGroup class.
1157  const
1158  SettingGroup&
1159  group() const
1160  {
1161  return *this;
1162  }
1163 
1164  // Re-initializes the given instance
1165  // as a copy of the other one without
1166  // involving assignment control service.
1167  void
1168  assignNoControl(
1169  const BookManagement& other)
1170  {
1171  mboBooks_.
1172  assignNoControl(
1173  other.mboBooks_);
1174 
1175  directBooks_.
1176  assignNoControl(
1177  other.directBooks_);
1178 
1179  impliedBooks_.
1180  assignNoControl(
1181  other.impliedBooks_);
1182 
1183  consolidatedBooks_.
1184  assignNoControl(
1185  other.consolidatedBooks_);
1186 
1187  updateNotification_ =
1188  other.updateNotification_;
1189  }
1190 
1191 public:
1192  /// Initializes instance with default values.
1195  controller = NULL)
1196  : SettingGroup(controller)
1197  , mboBooks_(&group())
1198  , directBooks_(&group(), 10)
1199  , impliedBooks_(&group(), 2)
1200  , updateNotification_(
1202  OnEndOfEvent)
1203  {
1204  }
1205 
1206  /// Initializes the instance
1207  /// as a copy of the other one.
1208  ///
1209  /// Attributes controlling value
1210  /// assignment aren't cloned and
1211  /// thus only settings are copied.
1213  const BookManagement& other)
1214  : SettingGroup()
1215  , mboBooks_(
1216  other.mboBooks_)
1217  , directBooks_(
1218  other.directBooks_)
1219  , impliedBooks_(
1220  other.impliedBooks_)
1221  , consolidatedBooks_(
1222  other.consolidatedBooks_)
1223  , updateNotification_(
1224  other.updateNotification_)
1225  {
1226  }
1227 
1228  // Finalizes the instance.
1229  ~BookManagement()
1230  {
1231  }
1233  /// Management and tracking parameters for direct books.
1234  const
1236  mboBooks() const
1237  {
1238  return mboBooks_;
1239  }
1240 
1241  /// Management and tracking parameters for direct books.
1243  mboBooks()
1244  {
1245  return mboBooks_;
1246  }
1248  /// Management and tracking parameters for direct books.
1249  const
1251  directBooks() const
1252  {
1253  return directBooks_;
1254  }
1255 
1256  /// Management and tracking parameters for direct books.
1258  directBooks()
1259  {
1260  return directBooks_;
1261  }
1263  /// Management and tracking parameters for implied books.
1264  const
1266  impliedBooks() const
1267  {
1268  return impliedBooks_;
1269  }
1270 
1271  /// Management and tracking parameters for implied books.
1273  impliedBooks()
1274  {
1275  return impliedBooks_;
1276  }
1278  /// Management and tracking parameters for consolidated books.
1279  const
1281  consolidatedBooks() const
1282  {
1283  return consolidatedBooks_;
1284  }
1285 
1286  /// Management and tracking parameters for consolidated books.
1288  consolidatedBooks()
1289  {
1290  return consolidatedBooks_;
1291  }
1292 
1293  /// Defines the way Handler raises onBookUpdated callbacks.
1294  ///
1295  /// @note Default is BookUpdateNotification::OnEndOfEvent.
1297  updateNotification() const
1298  {
1299  return updateNotification_;
1300  }
1301 
1302  /// Defines the way Handler raises order book update event.
1303  void
1304  updateNotification(
1306  {
1307  group().
1308  controlAssignment
1309  (
1310  "Update Notification",
1311  updateNotification_,
1312  value
1313  );
1314  }
1315 
1316  /// Copies settings from the given instance.
1317  ///
1318  /// Attributes controlling value assignment aren't
1319  /// cloned and thus only settings' values are copied.
1321  operator =(
1322  const BookManagement& other)
1323  {
1324  group().
1325  controlAssignment
1326  (
1327  "Book Management Settings",
1328  &BookManagement::assignNoControl,
1329  *this,
1330  other
1331  );
1332 
1333  return *this;
1334  }
1335 };
1336 
1337 /// Serializes book management settings into string.
1338 ONIXS_CMEMDH_EXPORTED
1339 void
1340 toStr(
1341  std::string&,
1342  const BookManagement&);
1343 
1344 /// Serializes book management settings into string.
1345 inline
1346 std::string
1348  const BookManagement& settings)
1349 {
1350  std::string str;
1351 
1352  toStr(str, settings);
1353 
1354  return str;
1355 }
1356 
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:123
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