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

High-level manager for partitions and command dispatch. More...

#include <TradingCore.h>

Collaboration diagram for trading_core::TradingCore:
Collaboration graph

Public Types

using ExecutionReportCallback = std::function< void(const fix::ExecutionReport &)>
 

Public Member Functions

 TradingCore ()
 
 TradingCore (data::DatabaseWorker *dbWorker, bool autoInitPartitions=true)
 
 TradingCore (std::unique_ptr< data::DatabaseWorker > dbWorker, std::unique_ptr< data::AuthRepository > authRepo, std::unique_ptr< data::TradeIDRepository > tradeIDRepo, std::unique_ptr< TradeIDGenerator > tradeIDGen, std::unique_ptr< OrderIDGenerator > orderIDGen, bool autoInitPartitions=true)
 
virtual ~TradingCore ()
 
std::optional< common::InstrumentfindPartitionForOrder (common::OrderID orderId) const
 
data::AuthRepositorygetAuthRepository () const
 
data::DatabaseWorkergetDatabaseWorker () const
 
const ExecutionReportCallbackgetExecutionReportCallback () const
 
MarketDataPublishergetMarketDataPublisher ()
 
std::optional< common::OrdergetOrder (common::OrderID orderId) const
 
std::optional< common::OrdergetOrderByClientOrderId (const std::string &clientOrderId) const
 
OrderIDGeneratorgetOrderIDGenerator ()
 
PartitiongetPartition (common::Instrument instrument) const
 
void setPartition (common::Instrument instrument, std::unique_ptr< Partition > partition)
 
void start ()
 
void stop ()
 
void stopAcceptingCommands ()
 
virtual void submitCommand (std::unique_ptr< Command > command) const
 
virtual void subscribeToExecutions (ExecutionReportCallback callback)
 
virtual void subscribeToMarketData (common::Symbol symbol, common::SessionID sessionId)
 
virtual void unsubscribeFromMarketData (common::SessionID sessionId)
 
virtual void unsubscribeFromMarketData (common::Symbol symbol, common::SessionID sessionId)
 
void waitAllQueuesIdle () const
 

Static Public Member Functions

static TradingCoregetInstance ()
 

Private Member Functions

void initPartitions ()
 

Private Attributes

std::unique_ptr< data::AuthRepositorymAuthRepo
 
data::DatabaseWorkermDatabaseWorker = nullptr
 
std::mutex mExecutionCallbackMutex
 
ExecutionReportCallback mExecutionReportCallback
 
MarketDataPublisher mMarketDataPublisher
 
std::unique_ptr< OrderIDGeneratormOrderIDGenerator
 
std::unique_ptr< data::DatabaseWorkermOwnedDatabaseWorker
 
std::unique_ptr< PartitionmPartitions [static_cast< int >(common::Instrument::COUNT)]
 
std::unique_ptr< TradeIDGeneratormTradeIDGenerator
 
std::unique_ptr< data::TradeIDRepositorymTradeIDRepo
 

Detailed Description

High-level manager for partitions and command dispatch.

Member Typedef Documentation

◆ ExecutionReportCallback

Constructor & Destructor Documentation

◆ TradingCore() [1/3]

trading_core::TradingCore::TradingCore ( )
Here is the call graph for this function:

◆ TradingCore() [2/3]

trading_core::TradingCore::TradingCore ( data::DatabaseWorker dbWorker,
bool  autoInitPartitions = true 
)
explicit
Here is the call graph for this function:

◆ TradingCore() [3/3]

trading_core::TradingCore::TradingCore ( std::unique_ptr< data::DatabaseWorker dbWorker,
std::unique_ptr< data::AuthRepository authRepo,
std::unique_ptr< data::TradeIDRepository tradeIDRepo,
std::unique_ptr< TradeIDGenerator tradeIDGen,
std::unique_ptr< OrderIDGenerator orderIDGen,
bool  autoInitPartitions = true 
)
Here is the call graph for this function:

◆ ~TradingCore()

trading_core::TradingCore::~TradingCore ( )
virtual
Here is the call graph for this function:

Member Function Documentation

◆ findPartitionForOrder()

std::optional< common::Instrument > trading_core::TradingCore::findPartitionForOrder ( common::OrderID  orderId) const
Here is the caller graph for this function:

◆ getAuthRepository()

data::AuthRepository * trading_core::TradingCore::getAuthRepository ( ) const
Here is the caller graph for this function:

◆ getDatabaseWorker()

data::DatabaseWorker * trading_core::TradingCore::getDatabaseWorker ( ) const
Here is the caller graph for this function:

◆ getExecutionReportCallback()

const TradingCore::ExecutionReportCallback & trading_core::TradingCore::getExecutionReportCallback ( ) const

◆ getInstance()

TradingCore & trading_core::TradingCore::getInstance ( )
static

◆ getMarketDataPublisher()

MarketDataPublisher & trading_core::TradingCore::getMarketDataPublisher ( )
Here is the caller graph for this function:

◆ getOrder()

std::optional< common::Order > trading_core::TradingCore::getOrder ( common::OrderID  orderId) const
Here is the call graph for this function:

◆ getOrderByClientOrderId()

std::optional< common::Order > trading_core::TradingCore::getOrderByClientOrderId ( const std::string &  clientOrderId) const

◆ getOrderIDGenerator()

OrderIDGenerator * trading_core::TradingCore::getOrderIDGenerator ( )
Here is the caller graph for this function:

◆ getPartition()

Partition * trading_core::TradingCore::getPartition ( common::Instrument  instrument) const
Here is the caller graph for this function:

◆ initPartitions()

void trading_core::TradingCore::initPartitions ( )
private
Here is the caller graph for this function:

◆ setPartition()

void trading_core::TradingCore::setPartition ( common::Instrument  instrument,
std::unique_ptr< Partition partition 
)

◆ start()

void trading_core::TradingCore::start ( )
Here is the caller graph for this function:

◆ stop()

void trading_core::TradingCore::stop ( )
Here is the caller graph for this function:

◆ stopAcceptingCommands()

void trading_core::TradingCore::stopAcceptingCommands ( )

◆ submitCommand()

void trading_core::TradingCore::submitCommand ( std::unique_ptr< Command command) const
virtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ subscribeToExecutions()

void trading_core::TradingCore::subscribeToExecutions ( ExecutionReportCallback  callback)
virtual
Here is the caller graph for this function:

◆ subscribeToMarketData()

void trading_core::TradingCore::subscribeToMarketData ( common::Symbol  symbol,
common::SessionID  sessionId 
)
virtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsubscribeFromMarketData() [1/2]

void trading_core::TradingCore::unsubscribeFromMarketData ( common::SessionID  sessionId)
virtual
Here is the call graph for this function:

◆ unsubscribeFromMarketData() [2/2]

void trading_core::TradingCore::unsubscribeFromMarketData ( common::Symbol  symbol,
common::SessionID  sessionId 
)
virtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ waitAllQueuesIdle()

void trading_core::TradingCore::waitAllQueuesIdle ( ) const
Here is the call graph for this function:

Member Data Documentation

◆ mAuthRepo

std::unique_ptr<data::AuthRepository> trading_core::TradingCore::mAuthRepo
private

◆ mDatabaseWorker

data::DatabaseWorker* trading_core::TradingCore::mDatabaseWorker = nullptr
private

◆ mExecutionCallbackMutex

std::mutex trading_core::TradingCore::mExecutionCallbackMutex
mutableprivate

◆ mExecutionReportCallback

ExecutionReportCallback trading_core::TradingCore::mExecutionReportCallback
private

◆ mMarketDataPublisher

MarketDataPublisher trading_core::TradingCore::mMarketDataPublisher
private

◆ mOrderIDGenerator

std::unique_ptr<OrderIDGenerator> trading_core::TradingCore::mOrderIDGenerator
private

◆ mOwnedDatabaseWorker

std::unique_ptr<data::DatabaseWorker> trading_core::TradingCore::mOwnedDatabaseWorker
private

◆ mPartitions

std::unique_ptr<Partition> trading_core::TradingCore::mPartitions[static_cast< int >(common::Instrument::COUNT)]
private

◆ mTradeIDGenerator

std::unique_ptr<TradeIDGenerator> trading_core::TradingCore::mTradeIDGenerator
private

◆ mTradeIDRepo

std::unique_ptr<data::TradeIDRepository> trading_core::TradingCore::mTradeIDRepo
private

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