9 #ifndef CPPTRADER_MATCHING_MARKET_MANAGER_H
10 #define CPPTRADER_MATCHING_MARKET_MANAGER_H
15 #include "containers/hashmap.h"
16 #include "memory/allocator_pool.h"
48 typedef CppCommon::HashMap<uint64_t, OrderNode*, FastHash>
Orders;
232 CppCommon::DefaultMemoryManager _auxiliary_memory_manager;
235 CppCommon::PoolMemoryManager<CppCommon::DefaultMemoryManager> _level_memory_manager;
236 CppCommon::PoolAllocator<LevelNode, CppCommon::DefaultMemoryManager> _level_pool;
239 CppCommon::PoolMemoryManager<CppCommon::DefaultMemoryManager> _symbol_memory_manager;
240 CppCommon::PoolAllocator<Symbol, CppCommon::DefaultMemoryManager> _symbol_pool;
244 CppCommon::PoolMemoryManager<CppCommon::DefaultMemoryManager> _order_book_memory_manager;
245 CppCommon::PoolAllocator<OrderBook, CppCommon::DefaultMemoryManager> _order_book_pool;
249 CppCommon::PoolMemoryManager<CppCommon::DefaultMemoryManager> _order_memory_manager;
250 CppCommon::PoolAllocator<OrderNode, CppCommon::DefaultMemoryManager> _order_pool;
258 ErrorCode ModifyOrder(uint64_t
id, uint64_t new_price, uint64_t new_quantity,
bool mitigate,
bool recursive);
259 ErrorCode ReplaceOrder(uint64_t
id, uint64_t new_id, uint64_t new_price, uint64_t new_quantity,
bool recursive);
270 bool ActivateStopOrders(
OrderBook* order_book_ptr);
271 bool ActivateStopOrders(
OrderBook* order_book_ptr,
LevelNode* level_ptr, uint64_t stop_price);
275 uint64_t CalculateMatchingChain(
OrderBook* order_book_ptr,
LevelNode* level_ptr, uint64_t price, uint64_t volume);
277 void ExecuteMatchingChain(
OrderBook* order_book_ptr,
LevelNode* level_ptr, uint64_t price, uint64_t volume);
void DisableMatching()
Disable automatic matching.
CppCommon::HashMap< uint64_t, OrderNode *, FastHash > Orders
Orders container.
ErrorCode ReduceOrder(uint64_t id, uint64_t quantity)
Reduce the order by the given quantity.
MarketManager & operator=(MarketManager &&)=delete
MarketManager & operator=(const MarketManager &)=delete
const OrderBook * GetOrderBook(uint32_t id) const noexcept
Get the order book for the given symbol Id.
ErrorCode MitigateOrder(uint64_t id, uint64_t new_price, uint64_t new_quantity)
Mitigate the order.
bool IsMatchingEnabled() const noexcept
Is automatic matching enabled?
ErrorCode AddOrderBook(const Symbol &symbol)
Add a new order book.
const OrderBooks & order_books() const noexcept
Get the order books container.
ErrorCode ExecuteOrder(uint64_t id, uint64_t quantity)
Execute the order.
ErrorCode DeleteOrder(uint64_t id)
Delete the order.
void EnableMatching()
Enable automatic matching.
const Symbols & symbols() const noexcept
Get the symbols container.
ErrorCode AddSymbol(const Symbol &symbol)
Add a new symbol.
void Match()
Match crossed orders in all order books.
std::vector< OrderBook * > OrderBooks
Order books container.
MarketManager(const MarketManager &)=delete
ErrorCode ModifyOrder(uint64_t id, uint64_t new_price, uint64_t new_quantity)
Modify the order.
ErrorCode AddOrder(const Order &order)
Add a new order.
const Order * GetOrder(uint64_t id) const noexcept
Get the order with the given Id.
const Orders & orders() const noexcept
Get the orders container.
ErrorCode ReplaceOrder(uint64_t id, uint64_t new_id, uint64_t new_price, uint64_t new_quantity)
Replace the order with a similar order but different Id, price and quantity.
ErrorCode DeleteSymbol(uint32_t id)
Delete the symbol.
MarketManager(MarketManager &&)=delete
std::vector< Symbol * > Symbols
Symbols container.
ErrorCode DeleteOrderBook(uint32_t id)
Delete the order book.
const Symbol * GetSymbol(uint32_t id) const noexcept
Get the symbol with the given Id.
Fast hash helper definition.
Market handler definition.
Market manager inline implementation.
C++ Trader project definitions.