libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
messages.hpp
Go to the documentation of this file.
1 #ifndef ISIMUD_EXCHANGES_MIT_common_MESSAGES_HPP
2 #define ISIMUD_EXCHANGES_MIT_common_MESSAGES_HPP
3 
4 /******************************************************************************
5 ** Copyright © 2015 by J.M.McGuiness, isimud@hussar.me.uk
6 **
7 ** This library is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU Lesser General Public
9 ** License as published by the Free Software Foundation; either
10 ** version 2.1 of the License, or (at your option) any later version.
11 **
12 ** This library is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ** Lesser General Public License for more details.
16 **
17 ** You should have received a copy of the GNU Lesser General Public
18 ** License along with this library; if not, write to the Free Software
19 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 
23 #include "types.hpp"
24 
25 #include "../../common/iso_10383_mic_codes.hpp"
26 
27 #include "core/blatant_old_msvc_compiler_hacks.hpp"
28 #include "core/memops.hpp"
29 
30 namespace isimud { namespace ISIMUD_VER_NAMESPACE { namespace exchanges { namespace MIT {
31 
32 /**
33  From <a href="http://www.londonstockexchange.com/products-and-services/technical-library/millennium-exchange-technical-specifications/mit203160615.pdf">"MIT203 - MILLENNIUM EXCHANGE Native Trading Gateway", Issue 11.6,
34 17 August 2015</a>
35 */
36 namespace common {
37 
38 struct logon_args_t {
39  using UserName_t=common::UserName_t;
40  using Password_t=common::Password_t;
41 
42  const UserName_t username{{}};
43  const Password_t password{{}};
44  const Password_t new_password{{}};
45 };
46 struct logoff_args_t {
47  const Reason_t reason{{}};
48 };
49 
50 /**
51  Section: "8.2 Message header"
52 */
53 class Header {
54 public:
55  enum : bool {
56  has_static_size=true ///< The message is statically-sized, not dynamically, so sizeof(the derived message-type) is the amount to copy, i.e. length() returns sizeof(the derived message-type).
57  };
58  using ClientOrderID_t=common::ClientOrderID_t;
59  using OrderID_t=common::OrderID_t;
60  using MsgTypes_t=common::MsgType_t;
61 
62  const std::int8_t start_of_message=2;
63  const std::int16_t length_;
64  const MsgType_t type_;
65 
66  MsgType_t type() const noexcept(true) {
67  return type_;
68  }
69  std::uint16_t length() const noexcept(true) {
70  assert(length_>=0);
71  return length_+sizeof(Header);
72  }
73 
74  bool is_valid() const noexcept(true) {
75  return start_of_message==2 && length()>=sizeof(Header);
76  }
77 
78 protected:
79  template<class MsgT>
80  explicit constexpr Header(MsgT const *) noexcept(true) FORCE_INLINE;
81 } __attribute__((packed));
82 
83 /**
84  Section: "8.3.1 Logon"
85 */
86 struct LogonRequest : public Header {
87  using Header_t=Header;
88  using logon_args_t=common::logon_args_t;
89  enum : MsgType_t {
90  static_type=static_cast<MsgType_t>(AdminMsgType::LogonRequest)
91  };
92  enum : std::size_t {
93  header_t_size=sizeof(Header_t)
94  };
95 
96  const logon_args_t::UserName_t userName;
97  const logon_args_t::Password_t password;
98  const logon_args_t::Password_t newPassword;
99  const std::uint8_t messageVersion=1;
100 
101  constexpr LogonRequest(const logon_args_t::UserName_t &UN, const logon_args_t::Password_t &P, const logon_args_t::Password_t &NP) noexcept(true) FORCE_INLINE;
102  explicit constexpr LogonRequest(logon_args_t const &a) noexcept(true) FORCE_INLINE;
103 
104  /// Create a message from the source message.
105  /**
106  If an error is generated, then this function will need to be specialised for the particular Msg-type.
107 
108  \param msg The source message from which the target message should be created.
109  */
110  template<class SrcMsg> explicit __stdcall
111  LogonRequest(SrcMsg const &msg) noexcept(true)=delete FORCE_INLINE;
112 } __attribute__((packed));
113 
114 /**
115  Section: "8.3.2 Logon Reply"
116 */
117 template<class RejectCode>
118 struct LogonReply : public Header {
119  using Header_t=Header;
120  using RejectCode_t=RejectCode;
121  enum : MsgType_t {
122  static_type=static_cast<MsgType_t>(AdminMsgType::LogonReply)
123  };
124  enum : std::size_t {
125  header_t_size=sizeof(Header_t)
126  };
127  /// Allow a client connected to the exchange to process the LogonReply message.
128  struct respond;
129 
130  RejectCode_t rejectCode_;
131  PasswordExpiryDayCount_t passwordExpiryDayCount;
132 
133  LogonReply() noexcept(true) FORCE_INLINE;
134 
135  RejectCode_t rejectCode() const noexcept(true) FORCE_INLINE {
136  return rejectCode_;
137  }
138  void rejectCode(RejectCode_t const &rc) noexcept(true) FORCE_INLINE {
139  rejectCode_=rc;
140  }
141 } __attribute__((packed));
142 
143 /**
144  Section: "8.3.3 Logout"
145 */
146 struct LogoutRequest : public Header {
147  using Header_t=Header;
148  enum : MsgType_t {
149  static_type=static_cast<MsgType_t>(AdminMsgType::LogoutRequest)
150  };
151  enum : std::size_t {
152  header_t_size=sizeof(Header_t)
153  };
154 
155  const Reason_t reason_;
156 
157  constexpr explicit LogoutRequest() noexcept(true) FORCE_INLINE;
158  constexpr explicit LogoutRequest(Reason_t r) noexcept(true) FORCE_INLINE;
159  constexpr explicit LogoutRequest(logoff_args_t const &a) noexcept(true) FORCE_INLINE;
160 
161  /// Create a message from the source message.
162  /**
163  If an error is generated, then this function will need to be specialised for the particular Msg-type.
164 
165  \param msg The source message from which the target message should be created.
166  */
167  template<class SrcMsg> explicit constexpr __stdcall
168  LogoutRequest(SrcMsg const &msg, Reason_t r) noexcept(true)=delete FORCE_INLINE;
169 
170  const Reason_t &reason() const noexcept(true) {
171  return reason_;
172  }
173 } __attribute__((packed));
174 
175 /**
176  Section: "8.3.4 Heartbeat"
177 */
178 struct Heartbeat : public Header {
179  using Header_t=Header;
180  enum : MsgType_t {
181  static_type=static_cast<MsgType_t>(AdminMsgType::Heartbeat)
182  };
183  enum : std::size_t {
184  header_t_size=sizeof(Header_t)
185  };
186 
187  constexpr Heartbeat() noexcept(true) FORCE_INLINE;
188 
189  /// Create a message from the source message.
190  /**
191  If an error is generated, then this function will need to be specialised for the particular Msg-type.
192 
193  \param msg The source message from which the target message should be created.
194  */
195  template<class SrcMsg> explicit constexpr __stdcall
196  Heartbeat(SrcMsg const &msg) noexcept(true)=delete FORCE_INLINE;
197 } __attribute__((packed));
198 
199 /**
200  Section: "8.3.5 Missed Message Request"
201 */
202 struct MissedMessageRequest : public Header {
203  using Header_t=Header;
204  enum : MsgType_t {
205  static_type=static_cast<MsgType_t>(AdminMsgType::MissedMessageRequest)
206  };
207  enum : std::size_t {
208  header_t_size=sizeof(Header_t)
209  };
210 
211  const AppID appID;
212  const SeqNum_t lastMsgSeqNum;
213 
214  constexpr MissedMessageRequest(AppID a, SeqNum_t l) noexcept(true) FORCE_INLINE;
215 } __attribute__((packed));
216 
217 /**
218  Section: "8.3.6 Missed Message Request Ack"
219 */
221  using Header_t=Header;
222  enum : MsgType_t {
223  static_type=static_cast<MsgType_t>(AdminMsgType::MissedMessageRequestAck)
224  };
225  enum class ResponseType : uint8_t {
226  Successful=0,
228  InvalidAppID=2,
230  };
231  enum : std::size_t {
232  header_t_size=sizeof(Header_t)
233  };
234 
236 
237  MissedMessageRequestAck() noexcept(true) FORCE_INLINE;
238 } __attribute__((packed));
239 
240 /**
241  Section: "8.3.7 Missed Message Report"
242 */
243 struct MissedMessageReport : public Header {
244  using Header_t=Header;
245  enum : MsgType_t {
246  static_type=static_cast<MsgType_t>(AdminMsgType::MissedMessageReport)
247  };
248  enum class ResponseType : int8_t {
252  };
253  enum : std::size_t {
254  header_t_size=sizeof(Header_t)
255  };
256 
258 
259  MissedMessageReport() noexcept(true) FORCE_INLINE;
260 } __attribute__((packed));
261 
262 /**
263  Section: "8.3.8 Reject"
264 */
265 template<class RejectCode, RejectCode RejectCodeNum>
266 struct Reject : public Header {
267  using Header_t=Header;
268  using RejectCode_t=RejectCode;
269  enum : MsgType_t {
270  static_type=static_cast<MsgType_t>(AdminMsgType::Reject)
271  };
272  enum : std::size_t {
273  header_t_size=sizeof(Header_t)
274  };
275  static inline constexpr const RejectCode_t unknown_msg=RejectCodeNum;
276 
277  RejectCode_t rejectCode_;
278  RejectReason_t rejectReason;
280  ClientOrderID_t clientOrderID_;
281 
282  Reject() noexcept(true) FORCE_INLINE;
283  explicit Reject(RejectCode_t const rc) noexcept(true) FORCE_INLINE;
284  Reject(ClientOrderID_t const &clID, RejectCode_t const rc) noexcept(true) FORCE_INLINE;
285 
286  ClientOrderID_t const &clientOrderID() const noexcept(true) {
287  return clientOrderID_;
288  }
289  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
290  libjmmcg::memcpy_opt(clID, clientOrderID_);
291  }
292 
293  RejectCode_t rejectCode() const noexcept(true) {
294  return rejectCode_;
295  }
296  void rejectCode(RejectCode_t const &rc) noexcept(true) {
297  rejectCode_=rc;
298  }
299 } __attribute__((packed));
300 
301 /**
302  Section: "8.3.9 System Status"
303 */
304 struct SystemStatus : public Header {
305  using Header_t=Header;
306  enum : MsgType_t {
307  static_type=static_cast<MsgType_t>(AdminMsgType::SystemStatus)
308  };
309  enum : std::size_t {
310  header_t_size=sizeof(Header_t)
311  };
312 
315 
316  SystemStatus() noexcept(true) FORCE_INLINE;
317 } __attribute__((packed));
318 
319 template<class Specific1, class Specific2, class Specific3>
320 struct NewOrder : public Header {
321  using Header_t=Header;
322  enum : MsgType_t {
323  static_type=static_cast<MsgType_t>(ClientMsgType::NewOrder)
324  };
325  enum : std::size_t {
326  header_t_size=sizeof(Header_t)
327  };
328  using specific1_t=Specific1;
329  using specific2_t=Specific2;
330  using specific3_t=Specific3;
331 
332  ClientOrderID_t clientOrderID_;
333  TraderID_t traderID{"\0\0\0\0\0\0\0\0\0\0"};
334  Account_t account{"\0\0\0\0\0\0\0\0\0"};
336  specific1_t specific1;
339  ExpireDateTime_t expireDateTime=0;
341  specific2_t specific2;
342  Price_t limitPrice_;
346  specific3_t specific3;
347 
348  constexpr __stdcall NewOrder(SeqNum_t seqNum, ClientOrderID_t const &clID, OrderType const oT, TIF const t, Side const s, SecurityID_t instID, typename specific2_t::order_qty_t ordQty, Price_t p) noexcept(true) FORCE_INLINE;
349 
350  SecurityID_t instrumentID() const noexcept(true) {
351  return specific1.instrumentID();
352  }
353  void instrumentID(SecurityID_t i) noexcept(true) {
354  specific1.instrumentID(i);
355  }
356 
357  typename specific2_t::order_qty_t orderQty() const noexcept(true) {
358  return specific2.orderQty();
359  }
360  void orderQty(typename specific2_t::order_qty_t i) noexcept(true) {
361  specific2.orderQty(i);
362  }
363 
364  OrderType orderType() const noexcept(true) {
365  return orderType_;
366  }
367  void orderType(OrderType i) noexcept(true) {
368  orderType_=i;
369  }
370 
371  Side side() const noexcept(true) {
372  return side_;
373  }
374  void side(Side i) noexcept(true) {
375  side_=i;
376  }
377 
378  ClientOrderID_t const &clientOrderID() const noexcept(true) {
379  return clientOrderID_;
380  }
381  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
382  libjmmcg::memcpy_opt(clID, clientOrderID_);
383  }
384 
385  Price_t limitPrice() const noexcept(true) {
386  return limitPrice_;
387  }
388  void limitPrice(Price_t p) noexcept(true) {
389  limitPrice_=p;
390  }
391 
392  TIF tif() const noexcept(true) {
393  return tif_;
394  }
395  void tif(TIF t) noexcept(true) {
396  tif_=t;
397  }
398 } __attribute__((packed));
399 
400 template<class Specific1, class Specific2>
401 struct NewQuote : public Header {
402  using Header_t=Header;
403  enum : MsgType_t {
404  static_type=static_cast<MsgType_t>(ClientMsgType::NewQuote)
405  };
406  enum : std::size_t {
407  header_t_size=sizeof(Header_t)
408  };
409  using specific1_t=Specific1;
410  using specific2_t=Specific2;
411 
412  ClientOrderID_t clientOrderID_;
413  TraderID_t traderID;
415  SecurityID_t instrumentID_;
416  specific1_t specific1;
419  specific2_t specific2;
420 
421  constexpr NewQuote() noexcept(true) FORCE_INLINE;
422 
423  ClientOrderID_t const &clientOrderID() const noexcept(true) {
424  return clientOrderID_;
425  }
426  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
427  libjmmcg::memcpy_opt(clID, clientOrderID_);
428  }
429 
430  SecurityID_t instrumentID() const noexcept(true) {
431  return instrumentID_;
432  }
433  void instrumentID(SecurityID_t i) noexcept(true) {
434  instrumentID_=i;
435  }
436 } __attribute__((packed));
437 
438 template<class Specific1, class Specific2, class Specific3>
440  using Header_t=Header;
441  enum : MsgType_t {
443  };
444  enum : std::size_t {
445  header_t_size=sizeof(Header_t)
446  };
447  using specific1_t=Specific1;
448  using specific2_t=Specific2;
449  using specific3_t=Specific3;
450 
451  ClientOrderID_t clientOrderID_;
452  ClientOrderID_t originalClientOrderID_;
453  OrderID_t orderID;
454  specific1_t specific1;
455  ExpireDateTime_t expireDateTime;
456  specific2_t specific2;
457  Price_t limitPrice_;
458  Account_t account;
461  Price_t stoppedPrice;
462  specific3_t specific3;
463 
464  constexpr OrderCancelReplaceRequest(common::ClientOrderID_t const &clID, ClientOrderID_t const &origclID, SecurityID_t instID, typename specific2_t::order_qty_t ordQty, Price_t const p, TIF t, Side s) noexcept(true) FORCE_INLINE;
465 
466  SecurityID_t instrumentID() const noexcept(true) {
467  return specific1.instrumentID();
468  }
469  void instrumentID(SecurityID_t i) noexcept(true) {
470  specific1.instrumentID(i);
471  }
472 
473  ClientOrderID_t const &clientOrderID() const noexcept(true) {
474  return clientOrderID_;
475  }
476  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
477  libjmmcg::memcpy_opt(clID, clientOrderID_);
478  }
479 
480  ClientOrderID_t const &originalClientOrderID() const noexcept(true) {
481  return originalClientOrderID_;
482  }
483  void originalClientOrderID(ClientOrderID_t const &clID) noexcept(true) {
484  libjmmcg::memcpy_opt(clID, originalClientOrderID_);
485  }
486 
487  Price_t limitPrice() const noexcept(true) {
488  return limitPrice_;
489  }
490  void limitPrice(Price_t p) noexcept(true) {
491  limitPrice_=p;
492  }
493 
494  typename specific2_t::order_qty_t orderQty() const noexcept(true) {
495  return specific2.orderQty();
496  }
497  void orderQty(typename specific2_t::order_qty_t i) noexcept(true) {
498  specific2.orderQty(i);
499  }
500 
501  Side side() const noexcept(true) {
502  return side_;
503  }
504  void side(Side i) noexcept(true) {
505  side_=i;
506  }
507 
508  TIF tif() const noexcept(true) {
509  return tif_;
510  }
511  void tif(TIF t) noexcept(true) {
512  tif_=t;
513  }
514 } __attribute__((packed));
515 
518  ReservedField9_t reservedField;
519 } __attribute__((packed));
520 
521 /**
522  Section: "8.4.4 Order Cancel Request"
523 */
524 template<class Specific1, class Specific2=OrderCancelRequestSpecific2>
525 struct OrderCancelRequest : public Header {
526  using Header_t=Header;
527  enum : MsgType_t {
528  static_type=static_cast<MsgType_t>(ClientMsgType::OrderCancelRequest)
529  };
530  enum : std::size_t {
531  header_t_size=sizeof(Header_t)
532  };
533  using specific1_t=Specific1;
534  using specific2_t=Specific2;
535 
536  ClientOrderID_t clientOrderID_;
537  ClientOrderID_t originalClientOrderID_;
538  OrderID_t orderID;
539  specific1_t specific1;
541  specific2_t specific2;
542 
543  constexpr OrderCancelRequest(ClientOrderID_t const &clID, ClientOrderID_t const &origclID, SecurityID_t instID, Side side) noexcept(true) FORCE_INLINE;
544 
545  ClientOrderID_t const &clientOrderID() const noexcept(true) {
546  return clientOrderID_;
547  }
548  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
549  libjmmcg::memcpy_opt(clID, clientOrderID_);
550  }
551 
552  ClientOrderID_t const &originalClientOrderID() const noexcept(true) {
553  return originalClientOrderID_;
554  }
555  void originalClientOrderID(ClientOrderID_t const &clID) noexcept(true) {
556  libjmmcg::memcpy_opt(clID, originalClientOrderID_);
557  }
558 
559  SecurityID_t instrumentID() const noexcept(true) {
560  return specific1.instrumentID();
561  }
562  void instrumentID(SecurityID_t i) noexcept(true) {
563  specific1.instrumentID(i);
564  }
565 
566  Side side() const noexcept(true) {
567  return side_;
568  }
569  void side(Side s) noexcept(true) {
570  side_=s;
571  }
572 } __attribute__((packed));
573 
574 /**
575  Section: "8.4.5 Order Mass Cancel Request"
576 */
577 template<class Specific1, class Specific2=OrderCancelRequestSpecific2>
579  using Header_t=Header;
580  enum : MsgType_t {
581  static_type=static_cast<MsgType_t>(ClientMsgType::OrderMassCancelRequest)
582  };
583  enum : std::size_t {
584  header_t_size=sizeof(Header_t)
585  };
586  using specific1_t=Specific1;
587  using specific2_t=Specific2;
588 
589  ClientOrderID_t clientOrderID_;
591  specific1_t specific1;
593  specific2_t specific2;
594 
595  explicit constexpr OrderMassCancelRequest(SecurityID_t instID) noexcept(true) FORCE_INLINE;
596 
597  ClientOrderID_t const &clientOrderID() const noexcept(true) {
598  return clientOrderID_;
599  }
600  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
601  libjmmcg::memcpy_opt(clID, clientOrderID_);
602  }
603 } __attribute__((packed));
604 
605 template<class Specific1, class Specific2>
606 struct ExecutionReport : public Header {
607  using Header_t=Header;
608  enum : MsgType_t {
609  static_type=static_cast<MsgType_t>(ServerMsgType::ExecutionReport)
610  };
611  enum : std::size_t {
612  header_t_size=sizeof(Header_t)
613  };
614  using specific1_t=Specific1;
615  using specific2_t=Specific2;
616  using RejectCode_t=typename specific1_t::RejectCode_t;
617 
619  SeqNum_t sequenceNumber;
620  ExecutionID_t executionID;
621  ClientOrderID_t clientOrderID_;
622  OrderID_t orderID;
624  ExecutionReportRefID_t executionReportRefID;
626  RejectCode_t orderRejectCode_;
627  Price_t executedPrice_;
628  specific1_t specific1;
629  SecurityID_t instrumentID_;
631  const std::int8_t reservedField2=0;
633  uint64_t secondaryOrderID=0;
634  Counterparty_t counterparty;
636  uint64_t tradeMatchID;
637  TransactTime_t transactTime;
638  specific2_t specific2;
639 
640  constexpr ExecutionReport() noexcept(true) FORCE_INLINE;
641  constexpr ExecutionReport(SeqNum_t seqNum, ClientOrderID_t const &clID, AppID aID, ExecType eT, Price_t const price, SecurityID_t instID, Side s) noexcept(true) FORCE_INLINE;
642  constexpr ExecutionReport(SeqNum_t seqNum, ClientOrderID_t const &clID, ExecType eT, Price_t const price, SecurityID_t instID, Side s, typename specific1_t::order_qty_t execdQty, typename specific1_t::order_qty_t leavesQty) noexcept(true) FORCE_INLINE;
643 
644  ExecType execType() const noexcept(true) {
645  return execType_;
646  }
647  void execType(ExecType e) noexcept(true) {
648  execType_=e;
649  }
650 
651  ClientOrderID_t const &clientOrderID() const noexcept(true) {
652  return clientOrderID_;
653  }
654  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
655  libjmmcg::memcpy_opt(clID, clientOrderID_);
656  }
657 
658  SecurityID_t instrumentID() const noexcept(true) {
659  return instrumentID_;
660  }
661  void instrumentID(SecurityID_t i) noexcept(true) {
662  instrumentID_=i;
663  }
664 
665  Price_t executedPrice() const noexcept(true) {
666  return executedPrice_;
667  }
668  void executedPrice(Price_t p) noexcept(true) {
669  executedPrice_=p;
670  }
671 
672  OrderStatus orderStatus() const noexcept(true) {
673  return orderStatus_;
674  }
675  void orderStatus(OrderStatus os) noexcept(true) {
676  orderStatus_=os;
677  }
678 
679  typename specific1_t::order_qty_t executedQty() const noexcept(true) {
680  return specific1.executedQty;
681  }
682  void executedQty(typename specific1_t::order_qty_t eq) noexcept(true) {
683  specific1.executedQty=eq;
684  }
685 
686  typename specific1_t::order_qty_t leavesQty() const noexcept(true) {
687  return specific1.leavesQty;
688  }
689  void leavesQty(typename specific1_t::order_qty_t eq) noexcept(true) {
690  specific1.leavesQty=eq;
691  }
692 
693  Side side() const noexcept(true) {
694  return side_;
695  }
696  void side(Side s) noexcept(true) {
697  side_=s;
698  }
699 
700  RejectCode_t orderRejectCode() const noexcept(true) {
701  return orderRejectCode_;
702  }
703  void orderRejectCode(RejectCode_t r) noexcept(true) {
705  }
706 } __attribute__((packed));
707 
708 template<class RejectCode>
710  using RejectCode_t=RejectCode;
711 
712  RejectCode_t cancelRejectReason_;
713  TransactTime_t transactTime;
714  ReservedField10_t reservedField;
715 };
716 
717 /**
718  Section: "8.4.7 Order Cancel Reject"
719 */
720 template<class Specific>
721 struct OrderCancelReject : public Header {
722  using Header_t=Header;
723  enum : MsgType_t {
724  static_type=static_cast<MsgType_t>(ServerMsgType::OrderCancelReject)
725  };
726  enum : std::size_t {
727  header_t_size=sizeof(Header_t)
728  };
729  using specific_t=Specific;
730  using RejectCode_t=typename specific_t::RejectCode_t;
731 
733  SeqNum_t sequenceNumber;
734  ClientOrderID_t clientOrderID_;
735  OrderID_t orderID;
736  specific_t specific;
737 
738  OrderCancelReject() noexcept(true) FORCE_INLINE;
739  OrderCancelReject(SeqNum_t seqNum, ClientOrderID_t const &clID) noexcept(true) FORCE_INLINE;
740 
741  ClientOrderID_t const &clientOrderID() const noexcept(true) {
742  return clientOrderID_;
743  }
744  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
745  libjmmcg::memcpy_opt(clID, clientOrderID_);
746  }
747 
748  RejectCode_t cancelRejectReason() const noexcept(true) {
749  return specific.cancelRejectReason_;
750  }
751  void cancelRejectReason(RejectCode_t r) noexcept(true) {
752  specific.cancelRejectReason_=r;
753  }
754 } __attribute__((packed));
755 
756 template<class RejectCode>
758  using RejectCode_t=RejectCode;
759 
761  TransactTime_t transactTime;
762  ReservedField10_t reservedField;
763 } __attribute__((packed));
764 
765 /**
766  Section: "8.4.8 Order Mass Cancel Report"
767 */
768 template<class Specific>
769 struct OrderMassCancelReport : public Header {
770  using Header_t=Header;
771  enum : MsgType_t {
772  static_type=static_cast<MsgType_t>(ServerMsgType::OrderMassCancelReport)
773  };
774  enum : std::size_t {
775  header_t_size=sizeof(Header_t)
776  };
777  using specific_t=Specific;
778  using RejectCode_t=typename specific_t::RejectCode_t;
779 
781  SeqNum_t sequenceNumber;
782  ClientOrderID_t clientOrderID_;
785  specific_t specific;
786 
787  OrderMassCancelReport() noexcept(true) FORCE_INLINE;
788 
789  ClientOrderID_t const &clientOrderID() const noexcept(true) {
790  return clientOrderID_;
791  }
792  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
793  libjmmcg::memcpy_opt(clID, clientOrderID_);
794  }
795 } __attribute__((packed));
796 
797 template<class RejectCode, RejectCode UnknownInstrument>
799  using RejectCode_t=RejectCode;
800  static inline constexpr const RejectCode_t unknown_instrument=UnknownInstrument;
801 
802  ReservedField10_t reservedField;
803 } __attribute__((packed));
804 
805 /**
806  Section: "8.5.1 Business Reject"
807 */
808 template<class Specific>
809 struct BusinessReject : public Header {
810  using Header_t=Header;
811  enum : MsgType_t {
812  static_type=static_cast<MsgType_t>(ServerMsgType::BusinessMessageReject)
813  };
814  enum : std::size_t {
815  header_t_size=sizeof(Header_t)
816  };
817  using specific_t=Specific;
818  using RejectCode_t=typename specific_t::RejectCode_t;
819  static inline constexpr const RejectCode_t unknown_instrument=specific_t::unknown_instrument;
820 
822  SeqNum_t sequenceNumber;
823  RejectCode_t rejectCode_;
824  ClientOrderID_t clientOrderID_;
825  OrderID_t orderID;
826  TransactTime_t transactTime;
827  specific_t specific;
828 
829  BusinessReject() noexcept(true) FORCE_INLINE;
830  BusinessReject(SeqNum_t seqNum, ClientOrderID_t const &clID) noexcept(true) FORCE_INLINE;
831 
832  RejectCode_t rejectCode() const noexcept(true) {
833  return rejectCode_;
834  }
835  void rejectCode(RejectCode_t const &rc) noexcept(true) {
836  rejectCode_=rc;
837  }
838 
839  ClientOrderID_t const &clientOrderID() const noexcept(true) {
840  return clientOrderID_;
841  }
842  void clientOrderID(ClientOrderID_t const &clID) noexcept(true) {
843  libjmmcg::memcpy_opt(clID, clientOrderID_);
844  }
845 } __attribute__((packed));
846 
847 } } } } }
848 
849 #include "messages_impl.hpp"
850 
851 #endif