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).
Enumerations | Functions
OrderType.hpp File Reference

Defines the OrderType enum and related utility functions for handling different order types. More...

#include <string>

Go to the source code of this file.

Enumerations

enum class  OrderType {
  GoodTillCancel , FillAndKill , Market , GoodForDay ,
  FillOrKill
}
 Specifies the different types of orders that can be used in a trading system. More...
 

Functions

std::string orderTypeToString (OrderType type)
 Converts an OrderType to its corresponding string representation. More...
 
OrderType intToOrdertType (int type)
 Converts an integer value to the corresponding OrderType. More...
 

Detailed Description

Defines the OrderType enum and related utility functions for handling different order types.

The OrderType enum represents various types of orders in a trading system, and utility functions are provided to convert between the enum and string representations or integer values.

Enumeration Type Documentation

◆ OrderType

enum OrderType
strong

Specifies the different types of orders that can be used in a trading system.

Each type of order has specific rules for how it should be handled in the order book.

Enumerator
GoodTillCancel 

Stays active unless filled or explicitly canceled by the trader.

FillAndKill 

Attempts to fill as much as possible immediately and cancels the remaining part.

Market 

Executes at the best available current price.

GoodForDay 

Remains active until the end of the trading day, then cancels automatically if unfilled.

FillOrKill 

Either fully fills or cancels, with no partial filling allowed.

Function Documentation

◆ intToOrdertType()

OrderType intToOrdertType ( int  type)
inline

Converts an integer value to the corresponding OrderType.

This function maps integer values to OrderType values, allowing for easy conversions from user inputs or data sources where order types are represented by integers.

Parameters
typeAn integer representing the order type.
Returns
The corresponding OrderType. If the integer does not match any order type, defaults to GoodTillCancel.

◆ orderTypeToString()

std::string orderTypeToString ( OrderType  type)
inline

Converts an OrderType to its corresponding string representation.

This function provides a string representation of each order type for easier display and logging.

Parameters
typeThe OrderType to convert to a string.
Returns
A string representing the order type (e.g., "GoodTillCancel", "Market").