1 #ifndef ISIMUD_EXCHANGES_ORDER_BOOK_ORDER_BOOK_HPP
2 #define ISIMUD_EXCHANGES_ORDER_BOOK_ORDER_BOOK_HPP
21 #include "../common/config.h"
23 #include "core/exception.hpp"
29 #include <experimental/iterator>
44 template<
class MsgType>
47 using msg_details_t=MsgType;
48 using price_t=
typename msg_details_t::Price_t;
49 using quantity_t=
typename msg_details_t::Quantity_t;
50 using side_t=
typename msg_details_t::Side;
51 using symbol_t=
typename msg_details_t::SecurityID_t;
52 using order_t=
typename msg_details_t::NewOrder_t;
53 using execution_t=
typename msg_details_t::ExecutionReport;
54 using lock_traits=libjmmcg::
ppd::api_lock_traits<libjmmcg::
ppd::platform_api, libjmmcg::
ppd::heavyweight_threading>;
55 using exception_type=lock_traits::exception_type;
58 using sequence_number_t=
typename msg_details_t::SeqNum_t;
62 struct internal_order
final :
public order_t {
63 using element_type=order_t;
65 const sequence_number_t sequence_number_;
67 internal_order(sequence_number_t seq, element_type
const &o)
noexcept(
true);
68 internal_order(internal_order
const &)
noexcept(
true)=
default;
73 internal_order &operator=(internal_order
const &o)
noexcept(
true);
87 bool operator()(value_type
const &l, value_type
const &r)
const noexcept(
true);
92 bool operator()(value_type
const &l, value_type
const &r)
const noexcept(
true);
100 bool empty()
const noexcept(
true);
114 bool empty()
const noexcept(
true);
130 bool empty()
const noexcept(
true);
142 price_t
agreed_spread(symbol_t
const &symbol)
const noexcept(
true);
152 void place(order_t
const &order)
noexcept(
false);
160 void cancel(order_t
const &order)
noexcept(
false);
180 template<
class MsgTypes1>
184 struct open_orders_t {
192 using msg_order_id_t=
typename msg_details_t::ClientOrderID_t;
194 msg_order_id_t order_id_;
196 bool operator==(order_id_t
const &)
noexcept(
true);
198 order_id_t &operator++()
noexcept(
true);
199 [[nodiscard]] order_id_t operator++(
int)
noexcept(
true);
206 sequence_number_t sequence_number_{};
207 order_id_t order_id_{};
208 all_open_orders_t all_open_orders_;