Leka
A low-latency C++20 price-time-priority limit order book and matching engine
▶ Replay viewer
Loading...
Searching...
No Matches
execution.cpp
1// src/matching/execution.cpp
2#include "lob/matching/execution.hpp"
3
4namespace lob {
5 /** Records one execution between an incoming and resting order. */
6 Execution::Execution(OrderId incomingOrderId, OrderId restingOrderId, Price executionPrice, Quantity executionQuantity)
7 : incomingOrderId(incomingOrderId), restingOrderId(restingOrderId), executionPrice(executionPrice), executionQuantity(executionQuantity) {}
8
10 return incomingOrderId;
11 }
12
14 return restingOrderId;
15 }
16
18 return executionPrice;
19 }
20
22 return executionQuantity;
23 }
24
25 /** Checks that all execution identifiers, price, and quantity are valid. */
26 bool Execution::isValid() const {
27 return incomingOrderId.isValid() && restingOrderId.isValid() && executionPrice.isValid() && executionQuantity.isValid();
28 }
29} // namespace lob
bool isValid() const
Returns whether all execution fields are valid.
Definition execution.cpp:26
Quantity getExecutionQuantity() const
Returns the executed quantity.
Definition execution.cpp:21
OrderId getIncomingOrderId() const
Returns the incoming order ID.
Definition execution.cpp:9
Execution(OrderId incomingOrderId, OrderId restingOrderId, Price executionPrice, Quantity executionQuantity)
Constructs an execution at the resting order's price.
Definition execution.cpp:6
OrderId getRestingOrderId() const
Returns the resting order ID.
Definition execution.cpp:13
Price getExecutionPrice() const
Returns the execution price.
Definition execution.cpp:17
Type-safe identifier for an order; zero is reserved as invalid.
Definition order_id.hpp:10
Type-safe nonzero price value used for price ordering.
Definition price.hpp:9
Type-safe unsigned order quantity; zero represents a filled state.
Definition quantity.hpp:8
bool isValid() const
Returns whether the quantity is valid for a submitted order.
Definition quantity.hpp:23