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

Type-safe nonzero price value used for price ordering. More...

#include <price.hpp>

Public Member Functions

 Price ()
 Constructs an invalid, zero-valued price.
 Price (std::uint64_t price)
 Constructs a price from its numeric value.
std::uint64_t getPrice () const
 Returns the underlying numeric price.
auto operator<=> (const Price &other) const
 Compares prices chronologically by numeric value.
bool isValid () const
 Returns whether the price is nonzero.

Detailed Description

Type-safe nonzero price value used for price ordering.

Definition at line 9 of file price.hpp.

Constructor & Destructor Documentation

◆ Price() [1/2]

lob::Price::Price ( )
inline

Constructs an invalid, zero-valued price.

Definition at line 15 of file price.hpp.

Referenced by operator<=>().

◆ Price() [2/2]

lob::Price::Price ( std::uint64_t price)
inline

Constructs a price from its numeric value.

Definition at line 18 of file price.hpp.

Member Function Documentation

◆ getPrice()

std::uint64_t lob::Price::getPrice ( ) const
inline

Returns the underlying numeric price.

Definition at line 21 of file price.hpp.

Referenced by lob::OrderBook::captureSnapshot().

◆ operator<=>()

auto lob::Price::operator<=> ( const Price & other) const
inline

Compares prices chronologically by numeric value.

Definition at line 24 of file price.hpp.

References Price().

◆ isValid()

bool lob::Price::isValid ( ) const
inline

Returns whether the price is nonzero.

Definition at line 28 of file price.hpp.


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