order_book 0.3.0
Exchange feed order book that prints the best bid and offer
Loading...
Searching...
No Matches
order_book::LevelPool Class Reference

#include <levels.hpp>

Classes

struct  Added
 The level an add went to, and whether it changed its book's best bid or offer. More...

Public Member Functions

Added add (BookLevels &book, const AddOrder &order, std::uint16_t locate=0)
bool reduce (BookLevels &book, std::uint32_t level, Shares quantity, bool removed)
Bbo bbo (const BookLevels &book) const
 Best bid and offer of book.
const LevelRecord & operator[] (std::uint32_t level) const
 The record of level level.
std::size_t size () const
 Number of levels in every book.

Detailed Description

Level records for one or more books, reached by handle

An order keeps its level's handle, so an execution or delete reaches the level without a search. Handle 0 is never given out, so that 0 can mean none. Removed levels' handles are reused.

Handles and each level's order count are 32 bits, so a pool holds fewer than 2^32 levels at once and a level fewer than 2^32 orders; past either, a handle or a count wraps. Neither is checked: reaching them takes tens of GB of book state.

Definition at line 60 of file levels.hpp.

Member Function Documentation

◆ add()

LevelPool::Added order_book::LevelPool::add ( BookLevels & book,
const AddOrder & order,
std::uint16_t locate = 0 )
inline

Add order to book, whose levels are in this pool, creating its level if the price is new; locate names the book where the pool serves several

Definition at line 104 of file levels.hpp.

◆ bbo()

Bbo order_book::LevelPool::bbo ( const BookLevels & book) const
inlinenodiscard

Best bid and offer of book.

Definition at line 148 of file levels.hpp.

◆ operator[]()

const LevelRecord & order_book::LevelPool::operator[] ( std::uint32_t level) const
inlinenodiscard

The record of level level.

Definition at line 78 of file levels.hpp.

◆ reduce()

bool order_book::LevelPool::reduce ( BookLevels & book,
std::uint32_t level,
Shares quantity,
bool removed )
inline

Take quantity off level level of book, and one order off it if removed, removing the level once it has no orders; returns whether the best bid or offer changed

Definition at line 121 of file levels.hpp.

◆ size()

std::size_t order_book::LevelPool::size ( ) const
inlinenodiscard

Number of levels in every book.

Definition at line 83 of file levels.hpp.


The documentation for this class was generated from the following file: