BetaTrader
A HFT Eco-System
Loading...
Searching...
No Matches
trading_core::Matcher Class Reference

The matching engine that pairs buy and sell orders. More...

#include <Matcher.h>

Collaboration diagram for trading_core::Matcher:
Collaboration graph

Public Member Functions

 Matcher (TradeIDGenerator *tradeIdGenerator)
 Constructs a new Matcher object.
 
virtual ~Matcher ()=default
 
virtual std::vector< common::Tradematch (common::Order *incomingOrder, OrderBook &orderBook)
 Matches an incoming order against the order book.
 

Private Member Functions

template<typename TMap >
void matchTable (common::Order *incomingOrder, TMap *restingMap, std::vector< common::Trade > &trades)
 A template function to match an incoming order against a map of resting orders.
 

Private Attributes

TradeIDGeneratormTradeIdGenerator
 A generator for unique trade IDs.
 

Detailed Description

The matching engine that pairs buy and sell orders.

This class is responsible for matching incoming orders against the existing orders in the order book. It generates trades when a match is found.

Constructor & Destructor Documentation

◆ ~Matcher()

virtual trading_core::Matcher::~Matcher ( )
virtualdefault

◆ Matcher()

trading_core::Matcher::Matcher ( TradeIDGenerator tradeIdGenerator)

Constructs a new Matcher object.

Parameters
tradeIdGeneratorA raw pointer to the trade ID generator.

Member Function Documentation

◆ match()

std::vector< common::Trade > trading_core::Matcher::match ( common::Order incomingOrder,
OrderBook orderBook 
)
virtual

Matches an incoming order against the order book.

Parameters
incomingOrderThe order to be matched.
orderBookThe order book to match against.
Returns
A vector of trades that were generated.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ matchTable()

template<typename TMap >
void trading_core::Matcher::matchTable ( common::Order incomingOrder,
TMap *  restingMap,
std::vector< common::Trade > &  trades 
)
private

A template function to match an incoming order against a map of resting orders.

Template Parameters
TMapThe type of the map of resting orders (BidMap or AskMap).
Parameters
incomingOrderThe order to be matched.
restingMapA raw pointer to the map of resting orders.
tradesA reference to a vector of trades to which any generated trades will be added.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mTradeIdGenerator

TradeIDGenerator* trading_core::Matcher::mTradeIdGenerator
private

A generator for unique trade IDs.


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