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).
|
Stores details of an individual order in the orderbook. More...
#include <OrderDetail.hpp>
Public Member Functions | |
OrderDetail (OrderType type, OrderId id, Side side, Price price, Quantity qty) | |
Constructs an OrderDetail with specified parameters. More... | |
OrderDetail ()=default | |
Default constructor. More... | |
std::string | getOrderType () const |
Retrieves the order type as a string. More... | |
OrderType | OrderType () const |
Retrieves the order type as an enum value. More... | |
OrderId | getOrderId () const |
Retrieves the unique identifier of the order. More... | |
std::string | getSide () const |
Retrieves the side (buy/sell) of the order as a string. More... | |
Side | Side () const |
Retrieves the side (buy/sell) of the order as an enum value. More... | |
Price | getPrice () const |
Retrieves the price of the order. More... | |
Quantity | getQuantity () const |
Retrieves the quantity of the order. More... | |
std::string | getTime () const |
Retrieves the timestamp of the order in a string format. More... | |
void | setQuantity (Quantity newValue) |
Sets a new quantity for the order. More... | |
Stores details of an individual order in the orderbook.
The OrderDetail class contains information about an order, including its type, side (buy/sell), price, quantity, and creation timestamp. It provides functions to retrieve and set these values.
|
inline |
Constructs an OrderDetail with specified parameters.
Initializes an OrderDetail instance with order type, ID, side, price, and quantity. The creation timestamp is set to the current time.
type | The type of the order. |
id | The unique identifier of the order. |
side | The side of the order (Buy or Sell). |
price | The price of the order. |
qty | The quantity of the order. |
|
default |
Default constructor.
OrderId OrderDetail::getOrderId | ( | ) | const |
Retrieves the unique identifier of the order.
Retrieves the unique identifier for the order.
std::string OrderDetail::getOrderType | ( | ) | const |
Retrieves the order type as a string.
Price OrderDetail::getPrice | ( | ) | const |
Retrieves the price of the order.
Quantity OrderDetail::getQuantity | ( | ) | const |
Retrieves the quantity of the order.
std::string OrderDetail::getSide | ( | ) | const |
Retrieves the side (buy/sell) of the order as a string.
std::string OrderDetail::getTime | ( | ) | const |
Retrieves the timestamp of the order in a string format.
OrderType OrderDetail::OrderType | ( | ) | const |
Retrieves the order type as an enum value.
void OrderDetail::setQuantity | ( | Quantity | newValue | ) |
Sets a new quantity for the order.
Updates the quantity of the order with a new value.
newValue | The new quantity to set. |
Side OrderDetail::Side | ( | ) | const |
Retrieves the side (buy/sell) of the order as an enum value.