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

Top-of-book snapshot - best bid and ask. More...

#include <events.hpp>

Collaboration diagram for slick::orderbook::TopOfBook:

Public Member Functions

 TopOfBook () noexcept
 
 TopOfBook (SymbolId sym, Price bid, Quantity bid_qty, Price ask, Quantity ask_qty, Timestamp ts) noexcept
 
Price spread () const noexcept
 Calculate spread.
 
Price midPrice () const noexcept
 Calculate mid price.
 
bool isCrossed () const noexcept
 Check if book is crossed (bid >= ask, should not happen in normal conditions)
 
bool hasBid () const noexcept
 Check if book has valid bid.
 
bool hasAsk () const noexcept
 Check if book has valid ask.
 
bool isValid () const noexcept
 Check if book has both valid bid and ask.
 

Public Attributes

SymbolId symbol
 
Price best_bid
 
Quantity bid_quantity
 
Price best_ask
 
Quantity ask_quantity
 
Timestamp timestamp
 
std::array< uint8_t, 2 > change_flags {0, 0}
 

Detailed Description

Top-of-book snapshot - best bid and ask.

Definition at line 142 of file events.hpp.

Constructor & Destructor Documentation

◆ TopOfBook() [1/2]

slick::orderbook::TopOfBook::TopOfBook ( )
inlinenoexcept

Definition at line 151 of file events.hpp.

◆ TopOfBook() [2/2]

slick::orderbook::TopOfBook::TopOfBook ( SymbolId  sym,
Price  bid,
Quantity  bid_qty,
Price  ask,
Quantity  ask_qty,
Timestamp  ts 
)
inlinenoexcept

Definition at line 154 of file events.hpp.

Member Function Documentation

◆ hasAsk()

bool slick::orderbook::TopOfBook::hasAsk ( ) const
inlinenoexcept

Check if book has valid ask.

Definition at line 178 of file events.hpp.

◆ hasBid()

bool slick::orderbook::TopOfBook::hasBid ( ) const
inlinenoexcept

Check if book has valid bid.

Definition at line 173 of file events.hpp.

◆ isCrossed()

bool slick::orderbook::TopOfBook::isCrossed ( ) const
inlinenoexcept

Check if book is crossed (bid >= ask, should not happen in normal conditions)

Definition at line 168 of file events.hpp.

◆ isValid()

bool slick::orderbook::TopOfBook::isValid ( ) const
inlinenoexcept

Check if book has both valid bid and ask.

Definition at line 183 of file events.hpp.

◆ midPrice()

Price slick::orderbook::TopOfBook::midPrice ( ) const
inlinenoexcept

Calculate mid price.

Definition at line 163 of file events.hpp.

◆ spread()

Price slick::orderbook::TopOfBook::spread ( ) const
inlinenoexcept

Calculate spread.

Definition at line 158 of file events.hpp.

Member Data Documentation

◆ ask_quantity

Quantity slick::orderbook::TopOfBook::ask_quantity

◆ best_ask

◆ best_bid

◆ bid_quantity

Quantity slick::orderbook::TopOfBook::bid_quantity

◆ change_flags

std::array<uint8_t, 2> slick::orderbook::TopOfBook::change_flags {0, 0}

◆ symbol

SymbolId slick::orderbook::TopOfBook::symbol

◆ timestamp

Timestamp slick::orderbook::TopOfBook::timestamp

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