A class for managing orders.
More...
#include <OrderManager.h>
A class for managing orders.
◆ OrderManager()
ats::OrderManager::OrderManager |
( |
std::vector< std::string > |
symbols | ) |
|
Construct a new OrderManager with an initial symbols list.
- Parameters
-
symbols | an initial list of traded symbols |
◆ cancelOrder()
void ats::OrderManager::cancelOrder |
( |
long |
orderId, |
|
|
std::string |
symbol |
|
) |
| |
Cancel an order.
- Parameters
-
orderId | ID of the order |
symbol | Symbol of the order |
◆ createOrder() [1/2]
long ats::OrderManager::createOrder |
( |
Order & |
order | ) |
|
Add an order to the queue.
- Parameters
-
- Returns
- Order Id
◆ createOrder() [2/2]
long ats::OrderManager::createOrder |
( |
OrderType |
type, |
|
|
Side |
side, |
|
|
std::string |
symbol, |
|
|
double |
quantity, |
|
|
double |
price = 0 |
|
) |
| |
Create a new order and add it to the queue.
- Parameters
-
type | The type of order |
side | The side of the order |
symbol | The symbol to trade |
quantity | The quantity to trade |
price | The price to trade |
- Returns
- Order Id
◆ getCancelOrder()
std::pair< long, std::string > ats::OrderManager::getCancelOrder |
( |
| ) |
|
Get an order to cancel.
- Returns
- {id,symbol} of the order to cancel
◆ getLastOrderQty()
double ats::OrderManager::getLastOrderQty |
( |
| ) |
|
Get last filled order quantity.
- Returns
- -1 if not set, quantity of last filled order otherwise.
◆ getOldestOrder()
Order & ats::OrderManager::getOldestOrder |
( |
| ) |
|
Get the oldest order from the order queue.
- Returns
- Order& The oldest order in the queue
◆ getOrderById()
Order ats::OrderManager::getOrderById |
( |
long |
ID | ) |
|
Returns order by ID.
- Parameters
-
ID | ID of the order to return |
- Returns
- Order The requested order
◆ getSymbols()
std::vector< std::string > ats::OrderManager::getSymbols |
( |
| ) |
|
Get symbols currently ordered.
- Returns
- std::vector<std::string> a vector of symbols
◆ hasCancelOrders()
bool ats::OrderManager::hasCancelOrders |
( |
| ) |
|
Check if there are orders to be cancelled.
- Returns
- true if there are orders to cancel
-
false otherwise
◆ hasOrders()
bool ats::OrderManager::hasOrders |
( |
| ) |
|
Check if there are orders to be sent.
- Returns
- true if there are orders waiting to be sent
-
false otherwise
◆ isRunning()
bool ats::OrderManager::isRunning |
( |
| ) |
|
Check if the order manager is running.
- Returns
- true if the order manager is running, false otherwise
◆ processOrder()
void ats::OrderManager::processOrder |
( |
Order |
order | ) |
|
Process a single order.
- Parameters
-
order | The order to process |
◆ updateOpenOrders()
void ats::OrderManager::updateOpenOrders |
( |
std::unordered_map< long, Order > |
openOrders | ) |
|
Update open orders.
- Parameters
-
openOrders | the new list of open orders |
The documentation for this class was generated from the following files: