Orderbook Simulation
OrderbookSim is a C++ application simulating a financial market order book. It efficiently manages and matches buy and sell orders while calculating the Volume-Weighted Average Price (VWAP).
OrderModify.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include "Order.hpp"
12 #include <memory>
13 
23 class OrderModify {
24 private:
25  OrderId _orderId;
26  Price _price;
27  Side _side;
28  Quantity _quantity;
29 
30 public:
39  OrderModify(OrderId orderId, Side side, Price price, Quantity quantity)
40  : _orderId{ orderId }
41  , _price{ price }
42  , _side{ side }
43  , _quantity{ quantity }
44  { }
45 
50  OrderId getOrderId() const { return _orderId; }
51 
56  Price getPrice() const { return _price; }
57 
62  Side getSide() const { return _side; }
63 
68  Quantity getQuantity() const { return _quantity; }
69 
79  return std::make_shared<Order>(type, getOrderId(), getSide(), getPrice(), getQuantity());
80  }
81 };
OrderType
Specifies the different types of orders that can be used in a trading system.
Definition: OrderType.hpp:18
Defines the Order class and related types for managing orders in a trading system.
std::shared_ptr< Order > OrderPtr
A shared pointer to an Order object.
Definition: Order.hpp:163
Side
Represents the side of an order in a trading system (either buy or sell).
Definition: Side.hpp:16
std::int32_t Price
Represents the price of an order or trade.
Definition: Usings.hpp:21
std::uint32_t Quantity
Represents the quantity or volume of assets in an order or trade.
Definition: Usings.hpp:29
std::uint64_t OrderId
Represents a unique identifier for an order.
Definition: Usings.hpp:37
Represents a modification to an existing order.
Definition: OrderModify.hpp:23
OrderPtr toOrderPtr(OrderType type) const
Converts the order modification into a shared pointer to a new Order object.
Definition: OrderModify.hpp:78
OrderId getOrderId() const
Gets the order ID of the modified order.
Definition: OrderModify.hpp:50
OrderModify(OrderId orderId, Side side, Price price, Quantity quantity)
Constructs an OrderModify object with the specified parameters.
Definition: OrderModify.hpp:39
Price getPrice() const
Gets the price of the modified order.
Definition: OrderModify.hpp:56
Side getSide() const
Gets the side (buy or sell) of the modified order.
Definition: OrderModify.hpp:62
Quantity getQuantity() const
Gets the quantity of the modified order.
Definition: OrderModify.hpp:68