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).
Trade.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 #include "TradeInfo.hpp"
11 #include <vector>
12 
20 class Trade {
21 private:
22  TradeInfo _bidTrade;
23  TradeInfo _askTrade;
25 public:
32  Trade(const TradeInfo& bidTrade, const TradeInfo& askTrade)
33  : _bidTrade{ bidTrade }, _askTrade{ askTrade }
34  {}
35 
44  const TradeInfo& getBidTrade() const;
45 
54  const TradeInfo& getAskTrade() const;
55 };
56 
64 using Trades = std::vector<Trade>;
Defines the TradeInfo struct, which holds essential information for a trade.
std::vector< Trade > Trades
A type alias for a collection of Trade objects.
Definition: Trade.hpp:64
Represents a completed trade, containing information about the bid and ask sides.
Definition: Trade.hpp:20
Trade(const TradeInfo &bidTrade, const TradeInfo &askTrade)
Constructs a Trade object with specified bid and ask trade details.
Definition: Trade.hpp:32
const TradeInfo & getBidTrade() const
Retrieves the bid-side trade information of this Trade.
Definition: Trade.cpp:19
const TradeInfo & getAskTrade() const
Retrieves the ask-side trade information of this Trade.
Definition: Trade.cpp:31
Holds essential information about a trade, including order ID, price, and quantity.
Definition: TradeInfo.hpp:19