Slick OrderBook 1.1.0
High-Performance C++23 OrderBook Library
Loading...
Searching...
No Matches
slick::orderbook::OrderBookL3 Class Reference

Level 3 OrderBook - Individual order tracking with price-time priority. More...

#include <orderbook_l3.hpp>

Collaboration diagram for slick::orderbook::OrderBookL3:

Classes

struct  PriceComparator
 

Public Types

using PriceLevelMap = detail::FlatMap< Price, detail::PriceLevelL3, PriceComparator >
 

Public Member Functions

 OrderBookL3 (SymbolId symbol, std::size_t interested_num_levels=10, std::size_t initial_order_capacity=1024, std::size_t initial_level_capacity=32)
 Constructor.
 
virtual ~OrderBookL3 ()
 Destructor.
 
 OrderBookL3 (const OrderBookL3 &)=delete
 
OrderBookL3 & operator= (const OrderBookL3 &)=delete
 
 OrderBookL3 (OrderBookL3 &&) noexcept=default
 
OrderBookL3 & operator= (OrderBookL3 &&) noexcept=default
 
SymbolId symbol () const noexcept
 Get symbol ID.
 
bool addOrModifyOrder (OrderId order_id, Side side, Price price, Quantity quantity, Timestamp timestamp, uint64_t priority, uint64_t seq_num=0, bool is_last_in_batch=true)
 Add a new order or modify existing order if OrderId already exists If the order already exists, modifies its price and/or quantity.
 
bool addOrder (OrderId order_id, Side side, Price price, Quantity quantity, Timestamp timestamp, uint64_t priority=0, uint64_t seq_num=0, bool is_last_in_batch=true)
 Add a new order (strict - fails if order already exists)
 
bool modifyOrder (OrderId order_id, Price new_price, Quantity new_quantity, Timestamp new_timestamp, uint64_t new_priority=0, uint64_t seq_num=0, bool is_last_in_batch=true)
 Modify an existing order's price and/or quantity Compares new values with old to determine what changed.
 
bool deleteOrder (OrderId order_id, Timestamp timestamp, uint64_t seq_num=0, bool is_last_in_batch=true)
 Delete an order.
 
virtual bool executeOrder (OrderId order_id, Quantity executed_quantity, Timestamp timestamp, uint64_t seq_num=0, bool is_last_in_batch=true)
 Execute (partially fill) an order.
 
const detail::Order * findOrder (OrderId order_id) const noexcept
 Find order by OrderId.
 
template<Side SIDE>
const detail::PriceLevelL3 * getBestLevel () const noexcept
 Get the best price level for a given side.
 
const detail::PriceLevelL3 * getBestBid () const noexcept
 Get best bid (highest buy price)
 
const detail::PriceLevelL3 * getBestAsk () const noexcept
 Get best ask (lowest sell price)
 
TopOfBook getTopOfBook () const noexcept
 Get top-of-book snapshot (aggregated L2 view)
 
const PriceLevelMap & getLevelsL3 (Side side) const noexcept
 Get L3 price levels for a side (zero-copy access to full order data) Returns reference to flat_map, iterate with range-for.
 
std::vector< detail::PriceLevelL2 > getLevelsL2 (Side side, std::size_t depth=0) const
 Get aggregated L2 price levels for a side Converts L3 data to L2 by aggregating quantities at each price.
 
std::pair< const detail::PriceLevelL3 *, uint16_t > getLevel (Side side, Price price) const noexcept
 Get L3 price level by price Access the orders at this price via level->orders (IntrusiveList)
 
std::pair< detail::PriceLevelL3 *, uint16_t > getLevel (Side side, Price price) noexcept
 
const detail::PriceLevelL3 * getLevelByIndex (Side side, uint16_t index) const noexcept
 Get L3 price level by index (0 = best)
 
std::size_t levelCount (Side side) const noexcept
 Get number of price levels on a side.
 
std::size_t orderCount () const noexcept
 Get total number of orders.
 
std::size_t orderCount (Side side) const noexcept
 Get number of orders on a side.
 
bool isEmpty (Side side) const noexcept
 Check if a side is empty.
 
bool isEmpty () const noexcept
 Check if book is empty (both sides)
 
void clearSide (Side side, Timestamp timestamp=0)
 Clear all orders on one side Does not emit order/level updates, but refreshes the cached top-of-book (and notifies onTopOfBookUpdate if it changed)
 
void clear (Timestamp timestamp=0)
 Clear all orders (both sides) Refreshes the cached top-of-book (and notifies onTopOfBookUpdate if it changed)
 
void addObserver (std::shared_ptr< IOrderBookObserver > observer)
 Observer management.
 
bool removeObserver (const std::shared_ptr< IOrderBookObserver > &observer)
 
void clearObservers () noexcept
 
std::size_t observerCount () const noexcept
 
uint64_t getLastSeqNum () const noexcept
 Get last processed sequence number.
 
void emitSnapshot (Timestamp timestamp)
 Emit complete orderbook snapshot to observers (L3 MBO) Useful for replaying full book state to a new observer Calls onSnapshotBegin(), followed by onOrderUpdate() for each order, then onSnapshotEnd()
 

Protected Member Functions

std::tuple< detail::PriceLevelL3 *, uint16_t, bool > getOrCreateLevel (Side side, Price price)
 Get or create price level, returns pointer, index and if new level created.
 
bool removeLevelIfEmpty (Side side, Price price) noexcept
 Remove price level if empty.
 
void releaseSide (Side side) noexcept
 Free all orders and levels on one side without any notification.
 
void notifyOrderUpdate (const detail::Order *order, Quantity old_quantity, Price old_price, Timestamp timestamp, uint16_t level_index, uint8_t change_flags, uint64_t seq_num) const
 Notify observers of order update with level index and change flags.
 
void notifyOrderDelete (const detail::Order *order, Timestamp timestamp, uint16_t level_index, uint8_t change_flags, uint64_t seq_num) const
 Notify observers of order delete with level index.
 
uint16_t calculateLevelIndex (Side side, Price price) const noexcept
 Calculate price level index for a given side and price.
 
void notifyTrade (OrderId passive_order_id, OrderId aggressive_order_id, Side aggressor_side, Price price, Quantity quantity, Timestamp timestamp) const
 Notify observers of trade.
 
void notifyPriceLevelUpdate (Timestamp timestamp, Side side, Price price, Quantity total_quantity, size_t order_count, uint16_t level_index, uint8_t change_flags, uint64_t seq_num) const
 Notify observers of price level update (L2 aggregated view)
 
void notifyTopOfBookIfChanged (Timestamp timestamp)
 Notify observers of top-of-book update if best changed Updates cached_tob_ after notification.
 

Protected Attributes

SymbolId symbol_
 
std::array< PriceLevelMap, SideCount > levels_
 
detail::OrderMap order_map_
 
detail::ObjectPool< detail::Order > order_pool_
 
ObserverManager observers_
 
TopOfBook cached_tob_
 
uint64_t last_seq_num_
 
uint16_t change_starting_index_ = INVALID_INDEX
 
std::size_t interested_num_levels_
 

Detailed Description

Level 3 OrderBook - Individual order tracking with price-time priority.

Maintains full order-by-order state with individual order visibility. Provides automatic aggregated L2 view.

Features:

  • O(1) order lookup by OrderId
  • O(log n) price level operations
  • Priority-based order queuing at each price level
  • Automatic L2 aggregation from L3 data
  • Observer pattern for notifications
  • Zero-allocation order management via object pool

Thread Safety: Single writer, multiple readers (lock-free reads planned)

Memory Layout: Cache-aligned to 64 bytes for optimal performance

Usage:

OrderBookL3 book(symbol_id);
book.addOrder(order_id, Side::Buy, 10000, 100, timestamp, priority);
book.modifyOrder(order_id, 10100, 150); // Update price and quantity
// Iterate L3 levels (zero-copy)
for (const auto& [price, level] : book.getLevelsL3(Side::Buy)) {
for (const auto& order : level.orders) {
// Process individual order...
}
}
// Get aggregated L2 view
auto l2_levels = book.getLevelsL2(Side::Buy, 10); // Top 10 levels
book.deleteOrder(order_id);
Level 3 OrderBook - Individual order tracking with price-time priority.
const PriceLevelMap & getLevelsL3(Side side) const noexcept
Get L3 price levels for a side (zero-copy access to full order data) Returns reference to flat_map,...
Side
Order side - using enum for easy array indexing.
Definition types.hpp:35

Definition at line 62 of file orderbook_l3.hpp.

Member Typedef Documentation

◆ PriceLevelMap

Constructor & Destructor Documentation

◆ OrderBookL3() [1/3]

slick::orderbook::OrderBookL3::OrderBookL3 ( SymbolId  symbol,
std::size_t  interested_num_levels = 10,
std::size_t  initial_order_capacity = 1024,
std::size_t  initial_level_capacity = 32 
)
inlineexplicit

Constructor.

Parameters
symbolSymbol identifier
interested_num_levelsThe top N levels to track for observer notifications (0 = all levels)
initial_order_capacityInitial capacity for order pool
initial_level_capacityInitial capacity for price levels per side

Definition at line 14 of file orderbook_l3_impl.hpp.

References slick::orderbook::Buy, cached_tob_, levels_, slick::orderbook::Sell, slick::orderbook::TopOfBook::symbol, and symbol_.

◆ ~OrderBookL3()

slick::orderbook::OrderBookL3::~OrderBookL3 ( )
inlinevirtual

Destructor.

Definition at line 37 of file orderbook_l3_impl.hpp.

References slick::orderbook::Buy, releaseSide(), and slick::orderbook::Sell.

◆ OrderBookL3() [2/3]

slick::orderbook::OrderBookL3::OrderBookL3 ( const OrderBookL3 &  )
delete

◆ OrderBookL3() [3/3]

slick::orderbook::OrderBookL3::OrderBookL3 ( OrderBookL3 &&  )
defaultnoexcept

Member Function Documentation

◆ addObserver()

void slick::orderbook::OrderBookL3::addObserver ( std::shared_ptr< IOrderBookObserver >  observer)
inline

Observer management.

Definition at line 266 of file orderbook_l3.hpp.

◆ addOrder()

bool slick::orderbook::OrderBookL3::addOrder ( OrderId  order_id,
Side  side,
Price  price,
Quantity  quantity,
Timestamp  timestamp,
uint64_t  priority = 0,
uint64_t  seq_num = 0,
bool  is_last_in_batch = true 
)
inline

Add a new order (strict - fails if order already exists)

Parameters
order_idUnique order identifier
sideBuy or Sell
priceOrder price
quantityOrder quantity
timestampOrder timestamp
priorityPriority for sorting (defaults to timestamp)
seq_numExchange sequence number (0 = no tracking, default) Out-of-order updates (seq_num < last_seq_num) are rejected
is_last_in_batchSet to true if this is the last update in an external batch (enables batching of TopOfBook updates)
Returns
true if order was added successfully, false if OrderId already exists

Definition at line 124 of file orderbook_l3_impl.hpp.

References addOrModifyOrder(), slick::orderbook::detail::OrderMap::contains(), last_seq_num_, and order_map_.

◆ addOrModifyOrder()

bool slick::orderbook::OrderBookL3::addOrModifyOrder ( OrderId  order_id,
Side  side,
Price  price,
Quantity  quantity,
Timestamp  timestamp,
uint64_t  priority,
uint64_t  seq_num = 0,
bool  is_last_in_batch = true 
)
inline

Add a new order or modify existing order if OrderId already exists If the order already exists, modifies its price and/or quantity.

Parameters
order_idUnique order identifier
sideBuy or Sell (must match existing order's side if it exists)
priceOrder price
quantityOrder quantity
timestampOrder timestamp
priorityPriority for sorting (used only when adding new order)
seq_numExchange sequence number (0 = no tracking, default) Out-of-order updates (seq_num < last_seq_num) are rejected
is_last_in_batchSet to true if this is the last update in an external batch (enables batching of TopOfBook updates)
Returns
true if order was added or modified successfully

Definition at line 43 of file orderbook_l3_impl.hpp.

References change_starting_index_, deleteOrder(), slick::orderbook::detail::OrderMap::find(), getOrCreateLevel(), slick::orderbook::detail::OrderMap::insert(), slick::orderbook::INVALID_INDEX, last_seq_num_, slick::orderbook::LastInBatch, modifyOrder(), notifyOrderUpdate(), notifyPriceLevelUpdate(), notifyTopOfBookIfChanged(), order_map_, order_pool_, slick::orderbook::detail::Order::price, slick::orderbook::PriceChanged, slick::orderbook::detail::Order::priority, slick::orderbook::detail::Order::quantity, slick::orderbook::QuantityChanged, slick::orderbook::detail::Order::side, slick::orderbook::SideCount, SLICK_ASSERT, and SLICK_UNLIKELY.

Referenced by addOrder().

◆ calculateLevelIndex()

uint16_t slick::orderbook::OrderBookL3::calculateLevelIndex ( Side  side,
Price  price 
) const
inlineprotectednoexcept

Calculate price level index for a given side and price.

Definition at line 579 of file orderbook_l3_impl.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

◆ clear()

void slick::orderbook::OrderBookL3::clear ( Timestamp  timestamp = 0)
inline

Clear all orders (both sides) Refreshes the cached top-of-book (and notifies onTopOfBookUpdate if it changed)

Parameters
timestampTimestamp for the top-of-book update (0 = unknown)

Definition at line 523 of file orderbook_l3_impl.hpp.

References slick::orderbook::Buy, notifyTopOfBookIfChanged(), releaseSide(), and slick::orderbook::Sell.

◆ clearObservers()

void slick::orderbook::OrderBookL3::clearObservers ( )
inlinenoexcept

Definition at line 274 of file orderbook_l3.hpp.

◆ clearSide()

void slick::orderbook::OrderBookL3::clearSide ( Side  side,
Timestamp  timestamp = 0 
)
inline

Clear all orders on one side Does not emit order/level updates, but refreshes the cached top-of-book (and notifies onTopOfBookUpdate if it changed)

Parameters
sideBuy or Sell
timestampTimestamp for the top-of-book update (0 = unknown)

Definition at line 516 of file orderbook_l3_impl.hpp.

References notifyTopOfBookIfChanged(), releaseSide(), slick::orderbook::SideCount, and SLICK_ASSERT.

◆ deleteOrder()

bool slick::orderbook::OrderBookL3::deleteOrder ( OrderId  order_id,
Timestamp  timestamp,
uint64_t  seq_num = 0,
bool  is_last_in_batch = true 
)
inline

Delete an order.

Parameters
order_idOrder identifier
timestampTimestamp of the deletion (required)
seq_numExchange sequence number (0 = no tracking, default) Out-of-order updates (seq_num < last_seq_num) are rejected
is_last_in_batchSet to true if this is the last update in an external batch (enables batching of TopOfBook updates)
Returns
true if order was found and deleted

Definition at line 292 of file orderbook_l3_impl.hpp.

References change_starting_index_, slick::orderbook::detail::OrderMap::erase(), slick::orderbook::detail::OrderMap::find(), getLevel(), slick::orderbook::INVALID_INDEX, last_seq_num_, slick::orderbook::LastInBatch, notifyOrderDelete(), notifyPriceLevelUpdate(), notifyTopOfBookIfChanged(), order_map_, order_pool_, slick::orderbook::detail::Order::price, slick::orderbook::PriceChanged, slick::orderbook::QuantityChanged, removeLevelIfEmpty(), slick::orderbook::detail::Order::side, and slick::orderbook::detail::Order::timestamp.

Referenced by addOrModifyOrder(), executeOrder(), and modifyOrder().

◆ emitSnapshot()

void slick::orderbook::OrderBookL3::emitSnapshot ( Timestamp  timestamp)
inline

Emit complete orderbook snapshot to observers (L3 MBO) Useful for replaying full book state to a new observer Calls onSnapshotBegin(), followed by onOrderUpdate() for each order, then onSnapshotEnd()

Parameters
timestampSnapshot timestamp

Definition at line 722 of file orderbook_l3_impl.hpp.

References slick::orderbook::Buy, last_seq_num_, levels_, slick::orderbook::ObserverManager::notifyOrderUpdate(), slick::orderbook::ObserverManager::notifySnapshotBegin(), slick::orderbook::ObserverManager::notifySnapshotEnd(), observers_, slick::orderbook::OrderUpdate::order_id, slick::orderbook::PriceChanged, slick::orderbook::QuantityChanged, slick::orderbook::Sell, and symbol_.

◆ executeOrder()

bool slick::orderbook::OrderBookL3::executeOrder ( OrderId  order_id,
Quantity  executed_quantity,
Timestamp  timestamp,
uint64_t  seq_num = 0,
bool  is_last_in_batch = true 
)
inlinevirtual

Execute (partially fill) an order.

Parameters
order_idOrder identifier
executed_quantityQuantity executed
timestampTimestamp of the execution (required)
seq_numExchange sequence number (0 = no tracking, default) Out-of-order updates (seq_num < last_seq_num) are rejected
is_last_in_batchSet to true if this is the last update in an external batch (enables batching of TopOfBook updates)
Returns
true if order was found and executed

Definition at line 366 of file orderbook_l3_impl.hpp.

References deleteOrder(), slick::orderbook::detail::OrderMap::find(), last_seq_num_, modifyOrder(), order_map_, slick::orderbook::detail::Order::price, slick::orderbook::detail::Order::priority, slick::orderbook::detail::Order::quantity, SLICK_ASSERT, and SLICK_UNLIKELY.

◆ findOrder()

const detail::Order * slick::orderbook::OrderBookL3::findOrder ( OrderId  order_id) const
inlinenoexcept

Find order by OrderId.

Parameters
order_idOrder identifier
Returns
Pointer to order, or nullptr if not found

Definition at line 399 of file orderbook_l3_impl.hpp.

◆ getBestAsk()

const detail::PriceLevelL3 * slick::orderbook::OrderBookL3::getBestAsk ( ) const
inlinenoexcept

Get best ask (lowest sell price)

Returns
Pointer to best ask level, or nullptr if no asks

Definition at line 413 of file orderbook_l3_impl.hpp.

References levels_, and slick::orderbook::Sell.

Referenced by notifyTopOfBookIfChanged().

◆ getBestBid()

const detail::PriceLevelL3 * slick::orderbook::OrderBookL3::getBestBid ( ) const
inlinenoexcept

Get best bid (highest buy price)

Returns
Pointer to best bid level, or nullptr if no bids

Definition at line 403 of file orderbook_l3_impl.hpp.

References slick::orderbook::Buy, and levels_.

Referenced by notifyTopOfBookIfChanged().

◆ getBestLevel()

template<Side SIDE>
const detail::PriceLevelL3 * slick::orderbook::OrderBookL3::getBestLevel ( ) const
noexcept

Get the best price level for a given side.

Template Parameters
SIDE
Returns
Pointer to the best price level, or nullptr if no orders exist on that side

◆ getLastSeqNum()

uint64_t slick::orderbook::OrderBookL3::getLastSeqNum ( ) const
inlinenoexcept

Get last processed sequence number.

Returns
Last sequence number (0 if not tracking)

Definition at line 284 of file orderbook_l3.hpp.

◆ getLevel() [1/2]

std::pair< const detail::PriceLevelL3 *, uint16_t > slick::orderbook::OrderBookL3::getLevel ( Side  side,
Price  price 
) const
inlinenoexcept

Get L3 price level by price Access the orders at this price via level->orders (IntrusiveList)

Parameters
sideBuy or Sell
pricePrice level
Returns
Pair of pointer to L3 price level (or nullptr if not found) and level index

Definition at line 460 of file orderbook_l3_impl.hpp.

References slick::orderbook::INVALID_INDEX, slick::orderbook::SideCount, and SLICK_ASSERT.

Referenced by deleteOrder(), and modifyOrder().

◆ getLevel() [2/2]

std::pair< detail::PriceLevelL3 *, uint16_t > slick::orderbook::OrderBookL3::getLevel ( Side  side,
Price  price 
)
inlinenoexcept

◆ getLevelByIndex()

const detail::PriceLevelL3 * slick::orderbook::OrderBookL3::getLevelByIndex ( Side  side,
uint16_t  index 
) const
inlinenoexcept

Get L3 price level by index (0 = best)

Parameters
sideBuy or Sell
indexLevel index (0-based, 0 = best bid/ask)
Returns
Pointer to L3 price level, or nullptr if index out of range

Definition at line 482 of file orderbook_l3_impl.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

◆ getLevelsL2()

std::vector< detail::PriceLevelL2 > slick::orderbook::OrderBookL3::getLevelsL2 ( Side  side,
std::size_t  depth = 0 
) const
inline

Get aggregated L2 price levels for a side Converts L3 data to L2 by aggregating quantities at each price.

Parameters
sideBuy or Sell
depthMaximum number of levels (0 = all)
Returns
Vector of aggregated L2 price levels

Definition at line 426 of file orderbook_l3_impl.hpp.

References slick::orderbook::Buy, levels_, slick::orderbook::SideCount, and SLICK_ASSERT.

◆ getLevelsL3()

const PriceLevelMap & slick::orderbook::OrderBookL3::getLevelsL3 ( Side  side) const
inlinenoexcept

Get L3 price levels for a side (zero-copy access to full order data) Returns reference to flat_map, iterate with range-for.

Parameters
sideBuy or Sell
Returns
Reference to L3 price level map

Definition at line 203 of file orderbook_l3.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

◆ getOrCreateLevel()

std::tuple< detail::PriceLevelL3 *, uint16_t, bool > slick::orderbook::OrderBookL3::getOrCreateLevel ( Side  side,
Price  price 
)
inlineprotected

Get or create price level, returns pointer, index and if new level created.

Definition at line 548 of file orderbook_l3_impl.hpp.

References levels_, slick::orderbook::SideCount, and SLICK_ASSERT.

Referenced by addOrModifyOrder(), and modifyOrder().

◆ getTopOfBook()

TopOfBook slick::orderbook::OrderBookL3::getTopOfBook ( ) const
inlinenoexcept

Get top-of-book snapshot (aggregated L2 view)

Returns
TopOfBook structure with best bid/ask

Definition at line 422 of file orderbook_l3_impl.hpp.

References cached_tob_.

◆ isEmpty() [1/2]

bool slick::orderbook::OrderBookL3::isEmpty ( ) const
inlinenoexcept

Check if book is empty (both sides)

Returns
true if both sides are empty

Definition at line 512 of file orderbook_l3_impl.hpp.

References slick::orderbook::Buy, levels_, and slick::orderbook::Sell.

◆ isEmpty() [2/2]

bool slick::orderbook::OrderBookL3::isEmpty ( Side  side) const
inlinenoexcept

Check if a side is empty.

Parameters
sideBuy or Sell
Returns
true if side has no orders

Definition at line 507 of file orderbook_l3_impl.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

◆ levelCount()

std::size_t slick::orderbook::OrderBookL3::levelCount ( Side  side) const
inlinenoexcept

Get number of price levels on a side.

Parameters
sideBuy or Sell
Returns
Number of levels

Definition at line 493 of file orderbook_l3_impl.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

◆ modifyOrder()

bool slick::orderbook::OrderBookL3::modifyOrder ( OrderId  order_id,
Price  new_price,
Quantity  new_quantity,
Timestamp  new_timestamp,
uint64_t  new_priority = 0,
uint64_t  seq_num = 0,
bool  is_last_in_batch = true 
)
inline

Modify an existing order's price and/or quantity Compares new values with old to determine what changed.

Parameters
order_idOrder identifier
new_priceNew price
new_quantityNew quantity (0 = delete)
new_timestampTimestamp of the modification (required)
new_priorityNew priority (default: 0 = use new_timestamp as priority for FIFO ordering) Use non-zero to explicitly set queue position priority
seq_numExchange sequence number (0 = no tracking, default) Out-of-order updates (seq_num < last_seq_num) are rejected
is_last_in_batchSet to true if this is the last update in an external batch (enables batching of TopOfBook updates)
Returns
true if order was found and modified

Definition at line 144 of file orderbook_l3_impl.hpp.

References change_starting_index_, deleteOrder(), slick::orderbook::detail::OrderMap::find(), getLevel(), getOrCreateLevel(), slick::orderbook::INVALID_INDEX, last_seq_num_, slick::orderbook::LastInBatch, notifyOrderUpdate(), notifyPriceLevelUpdate(), notifyTopOfBookIfChanged(), order_map_, slick::orderbook::detail::Order::price, slick::orderbook::PriceChanged, slick::orderbook::detail::Order::priority, slick::orderbook::detail::Order::quantity, slick::orderbook::QuantityChanged, removeLevelIfEmpty(), slick::orderbook::detail::Order::side, SLICK_UNLIKELY, and slick::orderbook::detail::Order::timestamp.

Referenced by addOrModifyOrder(), and executeOrder().

◆ notifyOrderDelete()

void slick::orderbook::OrderBookL3::notifyOrderDelete ( const detail::Order *  order,
Timestamp  timestamp,
uint16_t  level_index,
uint8_t  change_flags,
uint64_t  seq_num 
) const
inlineprotected

◆ notifyOrderUpdate()

void slick::orderbook::OrderBookL3::notifyOrderUpdate ( const detail::Order *  order,
Quantity  old_quantity,
Price  old_price,
Timestamp  timestamp,
uint16_t  level_index,
uint8_t  change_flags,
uint64_t  seq_num 
) const
inlineprotected

◆ notifyPriceLevelUpdate()

void slick::orderbook::OrderBookL3::notifyPriceLevelUpdate ( Timestamp  timestamp,
Side  side,
Price  price,
Quantity  total_quantity,
size_t  order_count,
uint16_t  level_index,
uint8_t  change_flags,
uint64_t  seq_num 
) const
inlineprotected

Notify observers of price level update (L2 aggregated view)

Definition at line 662 of file orderbook_l3_impl.hpp.

References interested_num_levels_, slick::orderbook::ObserverManager::notifyPriceLevelUpdate(), observers_, and symbol_.

Referenced by addOrModifyOrder(), deleteOrder(), and modifyOrder().

◆ notifyTopOfBookIfChanged()

◆ notifyTrade()

void slick::orderbook::OrderBookL3::notifyTrade ( OrderId  passive_order_id,
OrderId  aggressive_order_id,
Side  aggressor_side,
Price  price,
Quantity  quantity,
Timestamp  timestamp 
) const
inlineprotected

Notify observers of trade.

Definition at line 643 of file orderbook_l3_impl.hpp.

References slick::orderbook::ObserverManager::notifyTrade(), observers_, and symbol_.

◆ observerCount()

std::size_t slick::orderbook::OrderBookL3::observerCount ( ) const
inlinenoexcept

Definition at line 278 of file orderbook_l3.hpp.

◆ operator=() [1/2]

OrderBookL3 & slick::orderbook::OrderBookL3::operator= ( const OrderBookL3 &  )
delete

◆ operator=() [2/2]

OrderBookL3 & slick::orderbook::OrderBookL3::operator= ( OrderBookL3 &&  )
defaultnoexcept

◆ orderCount() [1/2]

std::size_t slick::orderbook::OrderBookL3::orderCount ( ) const
inlinenoexcept

Get total number of orders.

Returns
Total order count

Definition at line 237 of file orderbook_l3.hpp.

◆ orderCount() [2/2]

std::size_t slick::orderbook::OrderBookL3::orderCount ( Side  side) const
inlinenoexcept

Get number of orders on a side.

Parameters
sideBuy or Sell
Returns
Number of orders on this side

Definition at line 498 of file orderbook_l3_impl.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

◆ releaseSide()

void slick::orderbook::OrderBookL3::releaseSide ( Side  side)
inlineprotectednoexcept

Free all orders and levels on one side without any notification.

Definition at line 529 of file orderbook_l3_impl.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

Referenced by ~OrderBookL3(), clear(), and clearSide().

◆ removeLevelIfEmpty()

bool slick::orderbook::OrderBookL3::removeLevelIfEmpty ( Side  side,
Price  price 
)
inlineprotectednoexcept

Remove price level if empty.

Definition at line 566 of file orderbook_l3_impl.hpp.

References slick::orderbook::SideCount, and SLICK_ASSERT.

Referenced by deleteOrder(), and modifyOrder().

◆ removeObserver()

bool slick::orderbook::OrderBookL3::removeObserver ( const std::shared_ptr< IOrderBookObserver > &  observer)
inline

Definition at line 270 of file orderbook_l3.hpp.

◆ symbol()

SymbolId slick::orderbook::OrderBookL3::symbol ( ) const
inlinenoexcept

Get symbol ID.

Definition at line 103 of file orderbook_l3.hpp.

Member Data Documentation

◆ cached_tob_

TopOfBook slick::orderbook::OrderBookL3::cached_tob_
protected

Definition at line 332 of file orderbook_l3.hpp.

Referenced by OrderBookL3(), getTopOfBook(), and notifyTopOfBookIfChanged().

◆ change_starting_index_

uint16_t slick::orderbook::OrderBookL3::change_starting_index_ = INVALID_INDEX
protected

Definition at line 334 of file orderbook_l3.hpp.

Referenced by addOrModifyOrder(), deleteOrder(), and modifyOrder().

◆ interested_num_levels_

std::size_t slick::orderbook::OrderBookL3::interested_num_levels_
protected

Definition at line 335 of file orderbook_l3.hpp.

Referenced by notifyPriceLevelUpdate().

◆ last_seq_num_

uint64_t slick::orderbook::OrderBookL3::last_seq_num_
protected

◆ levels_

std::array<PriceLevelMap, SideCount> slick::orderbook::OrderBookL3::levels_
protected

◆ observers_

ObserverManager slick::orderbook::OrderBookL3::observers_
protected

◆ order_map_

detail::OrderMap slick::orderbook::OrderBookL3::order_map_
protected

Definition at line 329 of file orderbook_l3.hpp.

Referenced by addOrder(), addOrModifyOrder(), deleteOrder(), executeOrder(), and modifyOrder().

◆ order_pool_

detail::ObjectPool<detail::Order> slick::orderbook::OrderBookL3::order_pool_
protected

Definition at line 330 of file orderbook_l3.hpp.

Referenced by addOrModifyOrder(), and deleteOrder().

◆ symbol_

SymbolId slick::orderbook::OrderBookL3::symbol_
protected

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