#include <orderbook.hpp>
|
| | OrderBook ()=default |
| | OrderBook (const OrderBook &)=delete |
| OrderBook & | operator= (const OrderBook &)=delete |
| | OrderBook (OrderBook &&) noexcept=default |
| OrderBook & | operator= (OrderBook &&) noexcept=default |
| AddOrderResult | addOrder (OrderId orderId, Side side, std::optional< Price > price, Quantity totalQuantity, Quantity filledQuantity, TimeInForce timeInForce, OrderType orderType) noexcept |
| bool | removeOrder (OrderId orderId) noexcept |
| AmendOrderStatus | amendOrder (OrderId orderId, Quantity newQuantity) noexcept |
| AmendOrderResult | amendOrder (OrderId orderId, Price newPrice) noexcept |
| AmendOrderResult | amendOrder (OrderId orderId, Quantity newQuantity, Price newPrice) noexcept |
| const OrderBookMap & | getBuyBook () const noexcept |
| const OrderBookMap & | getSellBook () const noexcept |
| std::optional< Order > | getOrder (OrderId orderId) const noexcept |
| std::size_t | orderCount () const noexcept |
| std::size_t | orderLookupSize () const noexcept |
◆ AmendOrderStatus
| Enumerator |
|---|
| CANNOT_AMEND | |
| AMENDED_IN_PLACE | |
| AMENDED | |
| REMOVED | |
◆ OrderBook() [1/3]
| exchange::server::OrderBook::OrderBook |
( |
| ) |
|
|
default |
◆ OrderBook() [2/3]
| exchange::server::OrderBook::OrderBook |
( |
const OrderBook & | | ) |
|
|
delete |
◆ OrderBook() [3/3]
| exchange::server::OrderBook::OrderBook |
( |
OrderBook && | | ) |
|
|
defaultnoexcept |
◆ addOrder()
Try to match an order to what currently exists on the book, if possible, and then potentially add it to the book in the case of GTC limit orders.
- Parameters
-
| orderId | The id of the incoming order |
| side | The side of the incoming order (BUY or SELL) |
| price | The price of the incoming order, if it is a limit order |
| totalQuantity | The original quantity of the incoming order |
| filledQuantity | The quantity of the incoming order that was already filled |
| timeInForce | The time in force of the incoming order |
| orderType | Whether the incoming order is a limit order or a market order |
- Returns
- A list of matches performed between the incoming order and orders resting on the book, if any
◆ amendOrder() [1/3]
Modify the price of a GTC limit order that is currently resting on the book. Always resets time priority.
- Parameters
-
| orderId | The id of the order to amend |
| newPrice | The new price of the order |
◆ amendOrder() [2/3]
Modify the quantity of a GTC limit order that is currently resting on the book. Specifying a quantity less than the original one does not reset time priority.
- Parameters
-
| orderId | The id of the order to amend |
| newQuantity | The new total quantity of the order |
◆ amendOrder() [3/3]
Modify the quantity and price of a GTC limit order that is currently resting on the book. Resets time priority, unless the price is unchanged and the quantity only decreases, which is treated the same as amending the quantity on its own.
- Parameters
-
| orderId | The id of the order to amend |
| newQuantity | The new total quantity of the order |
| newPrice | The new price of the order |
◆ getBuyBook()
| const OrderBookMap & exchange::server::OrderBook::getBuyBook |
( |
| ) |
const |
|
nodiscardnoexcept |
Getter for a read-only view of the buy book.
- Returns
- A read-only view of the buy book.
◆ getOrder()
| std::optional< Order > exchange::server::OrderBook::getOrder |
( |
OrderId | orderId | ) |
const |
|
nodiscardnoexcept |
Getter for a specific order in the orderbook by order id.
- Parameters
-
| orderId | The id of the order to fetch. |
- Returns
- A copy of the order with the given order id, if an order with the given order id exists.
◆ getSellBook()
| const OrderBookMap & exchange::server::OrderBook::getSellBook |
( |
| ) |
const |
|
nodiscardnoexcept |
Getter for a read-only view of the sell book.
- Returns
- A read-only view of the sell book.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ orderCount()
| std::size_t exchange::server::OrderBook::orderCount |
( |
| ) |
const |
|
nodiscardnoexcept |
Returns the number of orders in both the buy and the sell books.
Time complexity is O(number of price levels). Do not use on the hot path.
- Returns
- The number of orders in both the buy and the sell books.
◆ orderLookupSize()
| std::size_t exchange::server::OrderBook::orderLookupSize |
( |
| ) |
const |
|
nodiscardnoexcept |
Returns the size of the order lookup table.
- Returns
- The size of the lookup table. Should be equal to the result of orderCount().
◆ removeOrder()
| bool exchange::server::OrderBook::removeOrder |
( |
OrderId | orderId | ) |
|
|
noexcept |
Remove a GTC limit order that is currently resting on the book.
- Parameters
-
| orderId | The id of the order to remove |
- Returns
- True if the order is resting on the book, false otherwise
The documentation for this class was generated from the following files: