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).
Public Member Functions | List of all members
OrderDetail Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ OrderDetail() [1/2]

OrderDetail::OrderDetail ( OrderType  type,
OrderId  id,
Side  side,
Price  price,
Quantity  qty 
)
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.

Parameters
typeThe type of the order.
idThe unique identifier of the order.
sideThe side of the order (Buy or Sell).
priceThe price of the order.
qtyThe quantity of the order.

◆ OrderDetail() [2/2]

OrderDetail::OrderDetail ( )
default

Default constructor.

Member Function Documentation

◆ getOrderId()

OrderId OrderDetail::getOrderId ( ) const

Retrieves the unique identifier of the order.

Retrieves the unique identifier for the order.

Returns
The OrderId of the order.

◆ getOrderType()

std::string OrderDetail::getOrderType ( ) const

Retrieves the order type as a string.

Returns
A string representing the type of the order.

◆ getPrice()

Price OrderDetail::getPrice ( ) const

Retrieves the price of the order.

Returns
The Price of the order.

◆ getQuantity()

Quantity OrderDetail::getQuantity ( ) const

Retrieves the quantity of the order.

Returns
The Quantity of the order.

◆ getSide()

std::string OrderDetail::getSide ( ) const

Retrieves the side (buy/sell) of the order as a string.

Returns
A string representing the side of the order.

◆ getTime()

std::string OrderDetail::getTime ( ) const

Retrieves the timestamp of the order in a string format.

Returns
A string representing the time the order was created, formatted as "YYYY-MM-DD HH:MM:SS".

◆ OrderType()

OrderType OrderDetail::OrderType ( ) const

Retrieves the order type as an enum value.

Returns
The OrderType of the order.

◆ setQuantity()

void OrderDetail::setQuantity ( Quantity  newValue)

Sets a new quantity for the order.

Updates the quantity of the order with a new value.

Parameters
newValueThe new quantity to set.

◆ Side()

Side OrderDetail::Side ( ) const

Retrieves the side (buy/sell) of the order as an enum value.

Returns
The Side of the order.

The documentation for this class was generated from the following files: