JayBeams  0.1
Another project to have fun coding.
Classes | Public Member Functions | Private Attributes | List of all members
jb::itch5::map_based_book_side< compare_t > Class Template Reference

Represent one side of the book. More...

#include <map_based_order_book.hpp>

Classes

struct  side
 template specialization struct to handle differences between BUY and SELL version SELL side More...
 
struct  side< std::greater< price4_t >, DUMMY >
 version BUY side More...
 

Public Member Functions

 map_based_book_side (map_based_order_book::config const &cfg)
 Initializes an empty side order book. More...
 
half_quote best_quote () const
 
half_quote worst_quote () const
 
std::size_t count () const
 
bool add_order (price4_t px, int qty)
 Add a price and quantity to the side order book. More...
 
bool reduce_order (price4_t px, int reduced_qty)
 Reduce the quantity for a given price. More...
 
bool is_ascending () const
 Testing hook. More...
 

Private Attributes

std::map< price4_t, int, compare_t > levels_
 

Detailed Description

template<typename compare_t>
class jb::itch5::map_based_book_side< compare_t >

Represent one side of the book.

Class implementation of struct map_based_order_book buy and side types.

Template Parameters
compare_tfunction object class type to sort the side

Definition at line 17 of file map_based_order_book.hpp.

Constructor & Destructor Documentation

◆ map_based_book_side()

template<typename compare_t >
jb::itch5::map_based_book_side< compare_t >::map_based_book_side ( map_based_order_book::config const &  cfg)
inlineexplicit

Initializes an empty side order book.

Definition at line 55 of file map_based_order_book.hpp.

Member Function Documentation

◆ add_order()

template<typename compare_t >
bool jb::itch5::map_based_book_side< compare_t >::add_order ( price4_t  px,
int  qty 
)
inline

Add a price and quantity to the side order book.

Parameters
pxthe price of the new order
qtythe quantity of the new order
Returns
true if the inside changed

Definition at line 88 of file map_based_order_book.hpp.

◆ best_quote()

template<typename compare_t >
half_quote jb::itch5::map_based_book_side< compare_t >::best_quote ( ) const
inline
Returns
the best side price and quantity

Definition at line 59 of file map_based_order_book.hpp.

◆ count()

template<typename compare_t >
std::size_t jb::itch5::map_based_book_side< compare_t >::count ( ) const
inline
Returns
the number of levels with non-zero quantity for the order side.

Definition at line 77 of file map_based_order_book.hpp.

◆ is_ascending()

template<typename compare_t >
bool jb::itch5::map_based_book_side< compare_t >::is_ascending ( ) const
inline

Testing hook.

Returns
true if side is in ascending order (BUY side) To discriminate different implementations for buy and sell sides during testing.

Definition at line 127 of file map_based_order_book.hpp.

◆ reduce_order()

template<typename compare_t >
bool jb::itch5::map_based_book_side< compare_t >::reduce_order ( price4_t  px,
int  reduced_qty 
)
inline

Reduce the quantity for a given price.

Parameters
pxthe price of the order that was reduced
reduced_qtythe quantity reduced in the order
Returns
true if the inside changed

Definition at line 101 of file map_based_order_book.hpp.

References JB_LOG, and jb::warning.

◆ worst_quote()

template<typename compare_t >
half_quote jb::itch5::map_based_book_side< compare_t >::worst_quote ( ) const
inline
Returns
the worst side price and quantity

Definition at line 68 of file map_based_order_book.hpp.

Member Data Documentation

◆ levels_

template<typename compare_t >
std::map<price4_t, int, compare_t> jb::itch5::map_based_book_side< compare_t >::levels_
private

Definition at line 155 of file map_based_order_book.hpp.


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