|
BetaTrader
A HFT Eco-System
|
Represents the order book for a single financial instrument. More...
#include <OrderBook.h>

Public Types | |
| using | AskMap = std::map< common::Price, PriceLevel > |
| A map of prices to price levels for sell orders, sorted in ascending order. | |
| using | BidMap = std::map< common::Price, PriceLevel, std::greater<> > |
| A map of prices to price levels for buy orders, sorted in descending order. | |
| using | PriceLevel = std::deque< common::Order * > |
| A deque of orders at a specific price level. | |
Public Member Functions | |
| OrderBook (common::Symbol symbol, MarketDataPublisher &publisher) | |
| Constructs a new OrderBook. | |
| virtual | ~OrderBook ()=default |
| virtual bool | cancelOrder (const common::OrderID &orderId) |
| Cancels an order from the order book. | |
| virtual AskMap * | getAskMap () |
| Gets a raw pointer to the ask map. | |
| virtual BidMap * | getBidMap () |
| Gets a raw pointer to the bid map. | |
| virtual void | insertOrder (common::Order *order) |
| Inserts an order into the order book. | |
| virtual void | publishSnapshot (common::SessionID sessionId) const |
| Publishes a full snapshot of the current order book for a specific session. | |
Private Attributes | |
| AskMap | mAskMap |
| The map of sell orders. | |
| BidMap | mBidMap |
| The map of buy orders. | |
| MarketDataPublisher & | mPublisher |
| common::Symbol | mSymbol |
Represents the order book for a single financial instrument.
The order book maintains two separate books for buy (bid) and sell (ask) orders, organized by price levels. It provides methods for inserting and canceling orders and publishes market data updates.
| using trading_core::OrderBook::AskMap = std::map<common::Price, PriceLevel> |
A map of prices to price levels for sell orders, sorted in ascending order.
| using trading_core::OrderBook::BidMap = std::map<common::Price, PriceLevel, std::greater<> > |
A map of prices to price levels for buy orders, sorted in descending order.
| using trading_core::OrderBook::PriceLevel = std::deque<common::Order*> |
A deque of orders at a specific price level.
| trading_core::OrderBook::OrderBook | ( | common::Symbol | symbol, |
| MarketDataPublisher & | publisher | ||
| ) |
Constructs a new OrderBook.
| symbol | The symbol this order book represents. |
| publisher | A reference to the market data publisher. |
|
virtualdefault |
|
virtual |
Cancels an order from the order book.
| orderId | The ID of the order to be cancelled. |


|
virtual |
Gets a raw pointer to the ask map.

|
virtual |
Gets a raw pointer to the bid map.

|
virtual |
Inserts an order into the order book.
| order | A raw pointer to the order to be inserted. |


|
virtual |
Publishes a full snapshot of the current order book for a specific session.
| sessionId | The session to send the snapshot to. |

|
private |
The map of sell orders.
|
private |
The map of buy orders.
|
private |
|
private |