JayBeams
0.1
Another project to have fun coding.
|
Maintain the ITCH-5.0 order book for a single security. More...
#include <order_book.hpp>
Public Types | |
using | book_type_config = typename book_type::config |
Public Member Functions | |
order_book (book_type_config const &cfg) | |
Initialize an empty order book. More... | |
bool | handle_add_order (buy_sell_indicator_t side, price4_t px, int qty) |
Handle a new order. More... | |
bool | handle_order_reduced (buy_sell_indicator_t side, price4_t px, int reduced_qty) |
Handle an order reduction, which includes executions, cancels and replaces. More... | |
Accessors | |
half_quote | best_bid () const |
half_quote | worst_bid () const |
half_quote | best_offer () const |
half_quote | worst_offer () const |
book_depth_t | buy_count () const |
book_depth_t | sell_count () const |
book_depth_t | get_book_depth () const |
Private Attributes | |
book_type::buys_t | buy_ |
book_type::sells_t | sell_ |
Maintain the ITCH-5.0 order book for a single security.
ITCH-5.0, like other market data feeds provide order-by-order detail, that is, the feed includes a message for each order received by the exchange, as well as the changes to these orders, i.e. when the execute, when their quantity (and/or price) is modified, and when they are canceled.. Such feeds are sometimes called Level III feeds. Typically only orders that do not immediately execute in full are included in the feed.
There is substantial variation in the format of the messages, and some variation as to whether executions are represented differently than a partial cancel, and whether changes in price are allowed or create new order ids.
This class encapsulates the order book data structure as well as its configuration.
This class receives a stream of (unnormalized) ITCH-5.0 messages for a single security, and organizes the orders in a book, i.e. a data structure where orders at the same price are grouped together, and one can quickly ask:
This is a template class.
book_type | defines data structure type of price book, both sides buy and sell. Must be compatible with jb::itch5::map_based_order_book |
cfg | book_type config |
Definition at line 57 of file order_book.hpp.
using jb::itch5::order_book< book_type >::book_type_config = typename book_type::config |
Definition at line 59 of file order_book.hpp.
|
inlineexplicit |
Initialize an empty order book.
Definition at line 62 of file order_book.hpp.
|
inline |
Definition at line 73 of file order_book.hpp.
References jb::itch5::order_book< book_type >::buy_.
Referenced by jb::itch5::generate_inside(), and jb::itch5::record_latency_stats().
|
inline |
Definition at line 83 of file order_book.hpp.
References jb::itch5::order_book< book_type >::sell_.
Referenced by jb::itch5::generate_inside(), and jb::itch5::record_latency_stats().
|
inline |
Definition at line 92 of file order_book.hpp.
References jb::itch5::order_book< book_type >::buy_.
Referenced by jb::itch5::order_book< book_type >::get_book_depth().
|
inline |
Definition at line 101 of file order_book.hpp.
References jb::itch5::order_book< book_type >::buy_count(), and jb::itch5::order_book< book_type >::sell_count().
|
inline |
Handle a new order.
Update the quantity at the right price level in the correct side of the book.
side | whether the order is a buy or a sell |
px | the price of the order |
qty | the quantity of the order |
Definition at line 118 of file order_book.hpp.
References jb::itch5::order_book< book_type >::buy_, and jb::itch5::order_book< book_type >::sell_.
|
inline |
Handle an order reduction, which includes executions, cancels and replaces.
side | whether the order is a buy or a sell |
px | the price of the order |
reduced_qty | the executed quantity of the order |
Definition at line 134 of file order_book.hpp.
References jb::itch5::order_book< book_type >::buy_, and jb::itch5::order_book< book_type >::sell_.
Referenced by jb::itch5::compute_book< book_type >::do_reduce().
|
inline |
Definition at line 95 of file order_book.hpp.
References jb::itch5::order_book< book_type >::sell_.
Referenced by jb::itch5::order_book< book_type >::get_book_depth().
|
inline |
Definition at line 78 of file order_book.hpp.
References jb::itch5::order_book< book_type >::buy_.
|
inline |
Definition at line 88 of file order_book.hpp.
References jb::itch5::order_book< book_type >::sell_.
|
private |
Definition at line 143 of file order_book.hpp.
Referenced by jb::itch5::order_book< book_type >::best_bid(), jb::itch5::order_book< book_type >::buy_count(), jb::itch5::order_book< book_type >::handle_add_order(), jb::itch5::order_book< book_type >::handle_order_reduced(), and jb::itch5::order_book< book_type >::worst_bid().
|
private |
Definition at line 144 of file order_book.hpp.
Referenced by jb::itch5::order_book< book_type >::best_offer(), jb::itch5::order_book< book_type >::handle_add_order(), jb::itch5::order_book< book_type >::handle_order_reduced(), jb::itch5::order_book< book_type >::sell_count(), and jb::itch5::order_book< book_type >::worst_offer().