CppTrader  1.0.4.0
C++ Trader
Public Types | Public Member Functions | Friends | List of all members
CppTrader::Matching::OrderBook Class Reference

Order book. More...

#include <order_book.h>

Public Types

typedef CppCommon::BinTreeAVL< LevelNode, std::less< LevelNode > > Levels
 Price level container. More...
 

Public Member Functions

 OrderBook (MarketManager &manager, const Symbol &symbol)
 
 OrderBook (const OrderBook &)=delete
 
 OrderBook (OrderBook &&)=delete
 
 ~OrderBook ()
 
OrderBookoperator= (const OrderBook &)=delete
 
OrderBookoperator= (OrderBook &&)=delete
 
 operator bool () const noexcept
 Check if the order book is not empty. More...
 
bool empty () const noexcept
 Is the order book empty? More...
 
size_t size () const noexcept
 Get the order book size. More...
 
const Symbolsymbol () const noexcept
 Get the order book symbol. More...
 
const LevelNodebest_bid () const noexcept
 Get the order book best bid price level. More...
 
const LevelNodebest_ask () const noexcept
 Get the order book best ask price level. More...
 
const Levelsbids () const noexcept
 Get the order book bids container. More...
 
const Levelsasks () const noexcept
 Get the order book asks container. More...
 
const LevelNodebest_buy_stop () const noexcept
 Get the order book best buy stop order price level. More...
 
const LevelNodebest_sell_stop () const noexcept
 Get the order book best sell stop order price level. More...
 
const Levelsbuy_stop () const noexcept
 Get the order book buy stop orders container. More...
 
const Levelssell_stop () const noexcept
 Get the order book sell stop orders container. More...
 
const LevelNodebest_trailing_buy_stop () const noexcept
 Get the order book best trailing buy stop order price level. More...
 
const LevelNodebest_trailing_sell_stop () const noexcept
 Get the order book best trailing sell stop order price level. More...
 
const Levelstrailing_buy_stop () const noexcept
 Get the order book trailing buy stop orders container. More...
 
const Levelstrailing_sell_stop () const noexcept
 Get the order book trailing sell stop orders container. More...
 
const LevelNodeGetBid (uint64_t price) const noexcept
 Get the order book bid price level with the given price. More...
 
const LevelNodeGetAsk (uint64_t price) const noexcept
 Get the order book ask price level with the given price. More...
 
const LevelNodeGetBuyStopLevel (uint64_t price) const noexcept
 Get the order book buy stop level with the given price. More...
 
const LevelNodeGetSellStopLevel (uint64_t price) const noexcept
 Get the order book sell stop level with the given price. More...
 
const LevelNodeGetTrailingBuyStopLevel (uint64_t price) const noexcept
 Get the order book trailing buy stop level with the given price. More...
 
const LevelNodeGetTrailingSellStopLevel (uint64_t price) const noexcept
 Get the order book trailing sell stop level with the given price. More...
 

Friends

class MarketManager
 
template<class TOutputStream >
TOutputStream & operator<< (TOutputStream &stream, const OrderBook &order_book)
 

Detailed Description

Order book.

Order book is used to keep buy and sell orders in a price level order.

Not thread-safe.

Definition at line 28 of file order_book.h.

Member Typedef Documentation

◆ Levels

typedef CppCommon::BinTreeAVL<LevelNode, std::less<LevelNode> > CppTrader::Matching::OrderBook::Levels

Price level container.

Definition at line 34 of file order_book.h.

Constructor & Destructor Documentation

◆ OrderBook() [1/3]

CppTrader::Matching::OrderBook::OrderBook ( MarketManager manager,
const Symbol symbol 
)

Definition at line 15 of file order_book.cpp.

◆ OrderBook() [2/3]

CppTrader::Matching::OrderBook::OrderBook ( const OrderBook )
delete

◆ OrderBook() [3/3]

CppTrader::Matching::OrderBook::OrderBook ( OrderBook &&  )
delete

◆ ~OrderBook()

CppTrader::Matching::OrderBook::~OrderBook ( )

Definition at line 33 of file order_book.cpp.

Member Function Documentation

◆ asks()

const Levels& CppTrader::Matching::OrderBook::asks ( ) const
inlinenoexcept

Get the order book asks container.

Definition at line 64 of file order_book.h.

◆ best_ask()

const LevelNode* CppTrader::Matching::OrderBook::best_ask ( ) const
inlinenoexcept

Get the order book best ask price level.

Definition at line 59 of file order_book.h.

◆ best_bid()

const LevelNode* CppTrader::Matching::OrderBook::best_bid ( ) const
inlinenoexcept

Get the order book best bid price level.

Definition at line 57 of file order_book.h.

◆ best_buy_stop()

const LevelNode* CppTrader::Matching::OrderBook::best_buy_stop ( ) const
inlinenoexcept

Get the order book best buy stop order price level.

Definition at line 67 of file order_book.h.

◆ best_sell_stop()

const LevelNode* CppTrader::Matching::OrderBook::best_sell_stop ( ) const
inlinenoexcept

Get the order book best sell stop order price level.

Definition at line 69 of file order_book.h.

◆ best_trailing_buy_stop()

const LevelNode* CppTrader::Matching::OrderBook::best_trailing_buy_stop ( ) const
inlinenoexcept

Get the order book best trailing buy stop order price level.

Definition at line 77 of file order_book.h.

◆ best_trailing_sell_stop()

const LevelNode* CppTrader::Matching::OrderBook::best_trailing_sell_stop ( ) const
inlinenoexcept

Get the order book best trailing sell stop order price level.

Definition at line 79 of file order_book.h.

◆ bids()

const Levels& CppTrader::Matching::OrderBook::bids ( ) const
inlinenoexcept

Get the order book bids container.

Definition at line 62 of file order_book.h.

◆ buy_stop()

const Levels& CppTrader::Matching::OrderBook::buy_stop ( ) const
inlinenoexcept

Get the order book buy stop orders container.

Definition at line 72 of file order_book.h.

◆ empty()

bool CppTrader::Matching::OrderBook::empty ( ) const
inlinenoexcept

Is the order book empty?

Definition at line 48 of file order_book.h.

◆ GetAsk()

const LevelNode * CppTrader::Matching::OrderBook::GetAsk ( uint64_t  price) const
inlinenoexcept

Get the order book ask price level with the given price.

Parameters
price- Price
Returns
Pointer to the order book ask price level with the given price or nullptr

Definition at line 32 of file order_book.inl.

◆ GetBid()

const LevelNode * CppTrader::Matching::OrderBook::GetBid ( uint64_t  price) const
inlinenoexcept

Get the order book bid price level with the given price.

Parameters
price- Price
Returns
Pointer to the order book bid price level with the given price or nullptr

Definition at line 26 of file order_book.inl.

◆ GetBuyStopLevel()

const LevelNode * CppTrader::Matching::OrderBook::GetBuyStopLevel ( uint64_t  price) const
inlinenoexcept

Get the order book buy stop level with the given price.

Parameters
price- Price
Returns
Pointer to the order book buy stop level with the given price or nullptr

Definition at line 38 of file order_book.inl.

◆ GetSellStopLevel()

const LevelNode * CppTrader::Matching::OrderBook::GetSellStopLevel ( uint64_t  price) const
inlinenoexcept

Get the order book sell stop level with the given price.

Parameters
price- Price
Returns
Pointer to the order book sell stop level with the given price or nullptr

Definition at line 44 of file order_book.inl.

◆ GetTrailingBuyStopLevel()

const LevelNode * CppTrader::Matching::OrderBook::GetTrailingBuyStopLevel ( uint64_t  price) const
inlinenoexcept

Get the order book trailing buy stop level with the given price.

Parameters
price- Price
Returns
Pointer to the order book trailing buy stop level with the given price or nullptr

Definition at line 50 of file order_book.inl.

◆ GetTrailingSellStopLevel()

const LevelNode * CppTrader::Matching::OrderBook::GetTrailingSellStopLevel ( uint64_t  price) const
inlinenoexcept

Get the order book trailing sell stop level with the given price.

Parameters
price- Price
Returns
Pointer to the order book trailing sell stop level with the given price or nullptr

Definition at line 56 of file order_book.inl.

◆ operator bool()

CppTrader::Matching::OrderBook::operator bool ( ) const
inlineexplicitnoexcept

Check if the order book is not empty.

Definition at line 45 of file order_book.h.

◆ operator=() [1/2]

OrderBook& CppTrader::Matching::OrderBook::operator= ( const OrderBook )
delete

◆ operator=() [2/2]

OrderBook& CppTrader::Matching::OrderBook::operator= ( OrderBook &&  )
delete

◆ sell_stop()

const Levels& CppTrader::Matching::OrderBook::sell_stop ( ) const
inlinenoexcept

Get the order book sell stop orders container.

Definition at line 74 of file order_book.h.

◆ size()

size_t CppTrader::Matching::OrderBook::size ( ) const
inlinenoexcept

Get the order book size.

Definition at line 51 of file order_book.h.

◆ symbol()

const Symbol& CppTrader::Matching::OrderBook::symbol ( ) const
inlinenoexcept

Get the order book symbol.

Definition at line 54 of file order_book.h.

◆ trailing_buy_stop()

const Levels& CppTrader::Matching::OrderBook::trailing_buy_stop ( ) const
inlinenoexcept

Get the order book trailing buy stop orders container.

Definition at line 82 of file order_book.h.

◆ trailing_sell_stop()

const Levels& CppTrader::Matching::OrderBook::trailing_sell_stop ( ) const
inlinenoexcept

Get the order book trailing sell stop orders container.

Definition at line 84 of file order_book.h.

Friends And Related Function Documentation

◆ MarketManager

friend class MarketManager
friend

Definition at line 30 of file order_book.h.

◆ operator<<

template<class TOutputStream >
TOutputStream& operator<< ( TOutputStream &  stream,
const OrderBook order_book 
)
friend

Definition at line 13 of file order_book.inl.


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