SecurityOrdersSnapshot
Path in Local Pack include/security_orders_snapshot.h
Description of your current orders. Only orders with Adding or Active status are taken into account. In deleting_amount_by_dir method orders with Deleting status are also counted.
The snapshot is updated before every update in strategy. It remains unchanged during single update processing.
Methods
Name | Description |
---|---|
volume() | Volume of the orders with given price and direction. |
size_by_dir() | Number of your orders with given direction. |
active_orders_count() | Number of your active orders with given direction. |
active_orders_volume() | Volume of your active orders with given direction. |
orders_by_dir() | Vector of your orders with given direction. |
orders_by_dir_as_map() | Your orders with given direction as a map. |
deleting_amount_by_dir() | Volume of your orders which have been sent to deletion. |
Methods description
volume()
Takes a direction and a price.
Returns total volume of the orders with given price and direction.
Amount volume(Dir dir, Price price) const;
def volume(self, dir, price)
size_by_dir()
Takes a direction.
Returns a number of your current orders with given direction.
size_t size_by_dir(Dir dir) const;
def size_by_dir(self, dir)
active_orders_count()
Takes a direction.
Returns a number of your active orders with given direction, i.e. orders with Active status.
size_t active_orders_count(Dir dir) const;
def active_orders_count(self, dir)
active_orders_volume()
Takes a direction.
Returns total volume of your active orders with given direction, i.e. orders with Active status.
Amount active_orders_volume(Dir dir) const;
def active_orders_volume(self, dir)
orders_by_dir()
Takes a direction.
Returns a vector of pointers to your orders with given direction.
const Orders& orders_by_dir(Dir dir) const;
def orders_by_dir(self, dir)
orders_by_dir_as_map()
Takes a direction.
Returns a map from price to vector of pointers to your orders with given direction. Note: the map is always ordered by price in ascending order.
OrdersMap orders_by_dir_as_map(Dir dir) const;
def orders_by_dir_as_map(self, dir)
Here is an example of using this method. We iterate through all of our bids and output the current number of bids with given price.
auto orders_map = order_book.orders().orders_by_dir_as_map(BID);
for (auto it = orders_map.cbegin(); it != orders_map.cend(); ++it) {
SCREEN() << "price: " << it->first << " amount: " << it->second.size()
}
orders_map = order_book.orders().orders_by_dir_as_map(BID)
for price, orders in orders_map.iteritems():
print 'price: %s amount: %s' % (price, len(orders))
deleting_amount_by_dir()
Takes a direction.
Returns a total volume of your orders with given direction, which had been sent to deletion, but have not been deleted (the ones with Deleting status) yet.
Amount deleting_amount_by_dir(Dir dir) const;
def deleting_amount_by_dir(self, dir)