18 #ifndef ORDER_ENTRY_LIMIT_ORDER_BOOK_STRUCTURES_HPP
19 #define ORDER_ENTRY_LIMIT_ORDER_BOOK_STRUCTURES_HPP
21 #include "doubly_linked_list.hpp"
22 #include "binary_search_tree.hpp"
37 enum class Side : bool { Sell =
false, Buy =
true };
45 return static_cast<Side>(!
static_cast<bool>(side));
96 Limit* limit_ =
nullptr,
138 BST::Node<
Price>(order->price),
247 #endif // ORDER_ENTRY_LIMIT_ORDER_BOOK_STRUCTURES_HPP
Side operator!(Side side)
Return the opposite side using the invert operator.
Definition: structures.hpp:44
Logic for sending/receiving application messages in a financial market.
Definition: authorizer.hpp:26
int64_t Capital
the amount of capital in a user account
Definition: structures.hpp:152
A trading account for a LimitOrderBook client.
Definition: structures.hpp:155
A single order in the LimitOrderBook.
Definition: structures.hpp:65
const UID uid
the day-unique ID for this particular order
Definition: structures.hpp:67
Volume volume
the total amount of volume at this limit price
Definition: structures.hpp:124
const Side side
a boolean determining whether the order id a buy (true) or sell (false)
Definition: structures.hpp:69
uint32_t Quantity
a type for order quantities
Definition: structures.hpp:51
Order * order_tail
the last order in the queue (last to execute)
Definition: structures.hpp:128
virtual void market_fill(Order *limit, Order *market)
Fill a market order.
Definition: structures.hpp:229
uint32_t Count
a type for limit price order counts
Definition: structures.hpp:113
Limit(Order *order)
Initialize a new limit.
Definition: structures.hpp:137
const Price price
the limit price for the order (market price if market order)
Definition: structures.hpp:73
Order * order_head
the first order in the queue (next to execute)
Definition: structures.hpp:126
Account(Shares shares_=0, Capital capital_=0)
Create an account with given values.
Definition: structures.hpp:168
Count count
the number of orders at this limit price
Definition: structures.hpp:120
void limit(Order *order)
Place a limit order.
Definition: structures.hpp:176
uint64_t Price
a type for order prices
Definition: structures.hpp:53
int64_t Shares
the number of shares in a user account
Definition: structures.hpp:150
Limit()
Initialize a new limit.
Definition: structures.hpp:131
std::set< Order * > orders
the set of active orders for the account
Definition: structures.hpp:161
virtual void limit_fill(Order *limit, Order *market)
Fill a limit order.
Definition: structures.hpp:210
Order(UID uid_, Side side_, Quantity quantity_, Price price_, Limit *limit_=nullptr, Account *account_=nullptr)
Initialize a new order data.
Definition: structures.hpp:91
uint64_t Volume
a type for limit total volume
Definition: structures.hpp:115
Account * account
the account this order belongs to
Definition: structures.hpp:77
Side
the possible sides for the LimitTree
Definition: structures.hpp:37
virtual void limit_partial(Order *limit, Order *market)
Partially fill a limit order.
Definition: structures.hpp:220
const uint32_t _padding
padding for byte alignment
Definition: structures.hpp:122
void cancel(Order *order)
Cancel a limit order.
Definition: structures.hpp:182
Shares shares
the number of shares owned by the account
Definition: structures.hpp:157
A price limit containing a FIFO queue of Order objects.
Definition: structures.hpp:118
Quantity quantity
the quantity of the order, i.e., the number of shares
Definition: structures.hpp:71
Order()
Initialize a new order data.
Definition: structures.hpp:80
uint64_t UID
a type for order IDs
Definition: structures.hpp:49
Capital capital
the total capital the account has (funds)
Definition: structures.hpp:159
virtual void market_partial(Order *limit, Order *market)
Partially fill a market order.
Definition: structures.hpp:238
void fill(Side side, Quantity quantity, Price price)
Fill a market order on given side with quantity and price.
Definition: structures.hpp:190
Limit * limit
the limit this order falls under
Definition: structures.hpp:75