Leka
A low-latency C++20 price-time-priority limit order book and matching engine
▶ Replay viewer
Loading...
Searching...
No Matches
lob::BookSnapshot Struct Reference

Top-of-book depth plus the counters a viewer needs for context. More...

#include <order_book_snapshot.hpp>

Public Member Functions

void reset ()
 Clears the vectors without releasing their capacity, so a caller reusing one snapshot across captures stops allocating after warmup.

Public Attributes

std::uint64_t sequence = 0
 Number of events applied to the book before this snapshot.
std::uint64_t tsNs = 0
 Engine timestamp of the most recently applied event, in nanoseconds.
std::uint64_t bestBidRaw = 0
 Best bid price in raw units, or 0 when no bids rest.
std::uint64_t bestAskRaw = 0
 Best ask price in raw units, or 0 when no asks rest.
std::vector< BookSnapshotLevelbids
 Top levels, best first.
std::vector< BookSnapshotLevelasks
std::size_t bidLevelCount = 0
 Occupied level count per side, which may exceed the captured depth.
std::size_t askLevelCount = 0

Detailed Description

Top-of-book depth plus the counters a viewer needs for context.

Levels are ordered best-first on each side: bids descending in price, asks ascending. A side with no resting liquidity yields an empty vector and a zero best price, zero being Price's own reserved invalid value.

Definition at line 48 of file order_book_snapshot.hpp.

Member Function Documentation

◆ reset()

void lob::BookSnapshot::reset ( )
inline

Clears the vectors without releasing their capacity, so a caller reusing one snapshot across captures stops allocating after warmup.

Definition at line 69 of file order_book_snapshot.hpp.

References bestAskRaw, bestBidRaw, bidLevelCount, bids, sequence, and tsNs.

Member Data Documentation

◆ sequence

std::uint64_t lob::BookSnapshot::sequence = 0

Number of events applied to the book before this snapshot.

Definition at line 50 of file order_book_snapshot.hpp.

Referenced by reset().

◆ tsNs

std::uint64_t lob::BookSnapshot::tsNs = 0

Engine timestamp of the most recently applied event, in nanoseconds.

Definition at line 52 of file order_book_snapshot.hpp.

Referenced by reset().

◆ bestBidRaw

std::uint64_t lob::BookSnapshot::bestBidRaw = 0

Best bid price in raw units, or 0 when no bids rest.

Definition at line 55 of file order_book_snapshot.hpp.

Referenced by lob::OrderBook::captureSnapshot(), and reset().

◆ bestAskRaw

std::uint64_t lob::BookSnapshot::bestAskRaw = 0

Best ask price in raw units, or 0 when no asks rest.

Definition at line 57 of file order_book_snapshot.hpp.

Referenced by lob::OrderBook::captureSnapshot(), and reset().

◆ bids

std::vector<BookSnapshotLevel> lob::BookSnapshot::bids

Top levels, best first.

Definition at line 60 of file order_book_snapshot.hpp.

Referenced by lob::OrderBook::captureSnapshot(), and reset().

◆ asks

std::vector<BookSnapshotLevel> lob::BookSnapshot::asks

Definition at line 61 of file order_book_snapshot.hpp.

◆ bidLevelCount

std::size_t lob::BookSnapshot::bidLevelCount = 0

Occupied level count per side, which may exceed the captured depth.

Definition at line 64 of file order_book_snapshot.hpp.

Referenced by lob::OrderBook::captureSnapshot(), and reset().

◆ askLevelCount

std::size_t lob::BookSnapshot::askLevelCount = 0

Definition at line 65 of file order_book_snapshot.hpp.


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