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