4#include "lob/order/order_side.hpp"
5#include "lob/order/order_type.hpp"
6#include "lob/types/order_id.hpp"
7#include "lob/types/price.hpp"
8#include "lob/types/quantity.hpp"
9#include "lob/types/sequence_number.hpp"
10#include "lob/types/timestamp.hpp"
27 Order* nextOrder{
nullptr};
28 Order* previousOrder{
nullptr};
34 Timestamp timestamp, OrderSide orderSide, OrderType orderType,
Type-safe identifier for an order; zero is reserved as invalid.
Order(OrderId orderId, Price price, Quantity originalQuantity, Timestamp timestamp, OrderSide orderSide, OrderType orderType, SequenceNumber sequenceNumber)
Constructs an order with remaining quantity equal to the original quantity.
Quantity getOriginalQuantity() const
Returns the quantity submitted when the order was created.
Order * getPreviousOrder() const
Returns the previous order in this price level's FIFO, or nullptr at the head.
void setNextOrder(Order *nextOrder)
Sets the next order in the FIFO.
SequenceNumber getSequenceNumber() const
Returns the deterministic processing sequence.
Order * getNextOrder() const
Returns the next order in this price level's FIFO, or nullptr at the tail.
void setPreviousOrder(Order *previousOrder)
Sets the previous order in the FIFO.
OrderId getOrderId() const
Returns the unique order identifier.
OrderSide getOrderSide() const
Returns whether this is a buy or sell order.
Price getPrice() const
Returns the limit or reference price.
OrderType getOrderType() const
Returns the order type.
bool isSell() const
Returns true for a sell order.
PriceLevel * getPriceLevel() const
Returns the price level this order rests on, or nullptr when unlinked.
bool isValid() const
Returns whether the order state satisfies its structural invariants.
Timestamp getTimestamp() const
Returns the order timestamp.
void reduceRemainingQuantity(Quantity quantity)
Decreases remaining quantity; throws if the reduction would underflow.
bool isFullyFilled() const
Returns true when remaining quantity is zero.
Quantity getRemainingQuantity() const
Returns the quantity that has not yet executed.
void setRemainingQuantity(Quantity quantity)
Updates quantity while the order remains at its current price level.
bool isMarket() const
Returns true for a market order.
void setPriceLevel(PriceLevel *priceLevel)
Sets the owning price level; nullptr marks the order as unlinked.
bool isLimit() const
Returns true for a limit order.
bool isBuy() const
Returns true for a buy order.
Maintains FIFO resting orders at one price.
Type-safe nonzero price value used for price ordering.
Type-safe unsigned order quantity; zero represents a filled state.
Monotonic engine sequence used for deterministic processing order.
Nanoseconds since the Unix epoch; zero is reserved as invalid.