1 #ifndef jb_itch5_map_based_order_book_hpp 2 #define jb_itch5_map_based_order_book_hpp 16 template <
typename compare_t>
51 template <
typename compare_t>
60 if (levels_.empty()) {
63 auto i = levels_.begin();
69 if (levels_.empty()) {
72 auto i = levels_.rbegin();
78 return levels_.size();
89 auto emp_tup = levels_.emplace(px, 0);
90 emp_tup.first->second += qty;
91 return emp_tup.first == levels_.begin();
102 auto price_it = levels_.find(px);
103 if (price_it == levels_.end()) {
104 throw jb::feed_error(
"trying to reduce a non-existing price level");
107 price_it->second -= reduced_qty;
108 if (price_it->second < 0) {
114 bool inside_change = (price_it == levels_.begin());
115 if (price_it->second <= 0) {
116 levels_.erase(price_it);
118 return inside_change;
133 template <
typename ordering,
class DUMMY =
void>
135 static bool constexpr ascending =
false;
144 template <
class DUMMY>
146 static bool constexpr ascending =
true;
161 #endif // jb_itch5_map_based_order_book_hpp static half_quote empty_quote()
half_quote empty_bid()
The value used to represent an empty bid.
Base class for all configuration objects.
Communicate feed error exceptions.
void validate() const override
empty
map_based_book_side(map_based_order_book::config const &cfg)
Initializes an empty side order book.
static half_quote empty_quote()
Define the types of buy and sell sides data structure.
template specialization struct to handle differences between BUY and SELL version SELL side ...
half_quote best_quote() const
bool add_order(price4_t px, int qty)
Add a price and quantity to the side order book.
bool is_ascending() const
Testing hook.
half_quote worst_quote() const
std::pair< price4_t, int > half_quote
A simple representation for price + quantity.
#define config_object_constructors(NAME)
std::size_t count() const
Represent one side of the book.
bool reduce_order(price4_t px, int reduced_qty)
Reduce the quantity for a given price.
half_quote empty_offer()
The value used to represent an empty offer.
Configure an map_based_order_book config object.
std::map< price4_t, int, compare_t > levels_
The top-level namespace for the JayBeams library.