|
order_book 0.3.0
Exchange feed order book that prints the best bid and offer
|
#include <order_book.hpp>
Public Member Functions | |
| std::expected< bool, BookError > | apply (std::string_view order, const Event &event) |
| Bbo | bbo () const |
| Current best bid and offer. | |
| std::size_t | order_count () const |
| Number of resting orders on both sides. | |
| std::size_t | level_count () const |
| Number of price levels on both sides. | |
Order book for one ticker, replayed from the exchange's own feed
The exchange has already matched the orders: each message applies to the resting order it names, and the book never matches orders itself. Each price level keeps a running total and a count of its orders, and every order is reachable from its ID in expected constant time. Each side lists its levels worst price first, so most adds and removals touch only its end.
Definition at line 42 of file order_book.hpp.
|
nodiscard |
Apply event to the order with ID order, returning whether the best bid or offer changed; on a BookError the book is unchanged. An exception, such as running out of memory, can leave the book inconsistent, so the book must not be used after one.
|
inlinenodiscard |
Number of price levels on both sides.
Definition at line 53 of file order_book.hpp.
|
inlinenodiscard |
Number of resting orders on both sides.
Definition at line 51 of file order_book.hpp.