pub struct CacheApi<'a> { /* private fields */ }Expand description
User-facing cache API.
Point reads return owned snapshots where possible, so actor code does not retain a Ref into
the live Cache. Plural collection reads return owned snapshots of all matching values and
are intentionally named as bulk reads. Prefer the count, ID, or has_* methods in hot paths
when a full snapshot is not needed.
Implementations§
Source§impl<'a> CacheApi<'a>
impl<'a> CacheApi<'a>
Sourcepub fn calculate_unrealized_pnl(&self, position: &Position) -> Option<Money>
pub fn calculate_unrealized_pnl(&self, position: &Position) -> Option<Money>
Returns the unrealized PnL for the position using cached market data.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn oms_type(&self, position_id: &PositionId) -> Option<OmsType>
pub fn oms_type(&self, position_id: &PositionId) -> Option<OmsType>
Returns the OMS type for the position_id (if known).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_snapshot_bytes(
&self,
position_id: &PositionId,
) -> Option<Vec<Vec<u8>>>
pub fn position_snapshot_bytes( &self, position_id: &PositionId, ) -> Option<Vec<Vec<u8>>>
Returns serialized position snapshot frames for the position_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_snapshot_count(&self, position_id: &PositionId) -> usize
pub fn position_snapshot_count(&self, position_id: &PositionId) -> usize
Returns the number of stored position snapshots for the position_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_snapshots(
&self,
position_id: Option<&PositionId>,
account_id: Option<&AccountId>,
) -> Vec<Position>
pub fn position_snapshots( &self, position_id: Option<&PositionId>, account_id: Option<&AccountId>, ) -> Vec<Position>
Returns position snapshots matching the optional filters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_snapshots_from(
&self,
position_id: &PositionId,
skip: usize,
) -> Vec<Position>
pub fn position_snapshots_from( &self, position_id: &PositionId, skip: usize, ) -> Vec<Position>
Returns position snapshots for position_id starting from skip.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_snapshot_ids(
&self,
instrument_id: &InstrumentId,
) -> AHashSet<PositionId>
pub fn position_snapshot_ids( &self, instrument_id: &InstrumentId, ) -> AHashSet<PositionId>
Returns position snapshot IDs for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_order_ids(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<ClientOrderId>
pub fn client_order_ids( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<ClientOrderId>
Returns the client order IDs of all orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_order_ids_open(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<ClientOrderId>
pub fn client_order_ids_open( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<ClientOrderId>
Returns the client order IDs of all open orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_order_ids_closed(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<ClientOrderId>
pub fn client_order_ids_closed( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<ClientOrderId>
Returns the client order IDs of all closed orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_order_ids_active_local(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<ClientOrderId>
pub fn client_order_ids_active_local( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<ClientOrderId>
Returns the client order IDs of all locally active orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_order_ids_emulated(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<ClientOrderId>
pub fn client_order_ids_emulated( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<ClientOrderId>
Returns the client order IDs of all emulated orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_order_ids_inflight(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<ClientOrderId>
pub fn client_order_ids_inflight( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<ClientOrderId>
Returns the client order IDs of all in-flight orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_ids(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<PositionId>
pub fn position_ids( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<PositionId>
Returns the position IDs of all positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_open_ids(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<PositionId>
pub fn position_open_ids( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<PositionId>
Returns the position IDs of all open positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_closed_ids(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> AHashSet<PositionId>
pub fn position_closed_ids( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> AHashSet<PositionId>
Returns the position IDs of all closed positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn strategy_ids(&self) -> AHashSet<StrategyId>
pub fn strategy_ids(&self) -> AHashSet<StrategyId>
Sourcepub fn exec_algorithm_ids(&self) -> AHashSet<ExecAlgorithmId>
pub fn exec_algorithm_ids(&self) -> AHashSet<ExecAlgorithmId>
Returns the execution algorithm IDs in the cache.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn order(&self, client_order_id: &ClientOrderId) -> Option<OrderAny>
pub fn order(&self, client_order_id: &ClientOrderId) -> Option<OrderAny>
Returns an owned copy of the order for the client_order_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_order(
&self,
client_order_id: &ClientOrderId,
) -> Result<OrderAny, OrderLookupError>
pub fn try_order( &self, client_order_id: &ClientOrderId, ) -> Result<OrderAny, OrderLookupError>
Returns an owned copy of the order for the client_order_id.
§Errors
Returns an error if:
- The order is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn orders_for_ids(
&self,
client_order_ids: &[ClientOrderId],
context: &dyn Display,
) -> Vec<OrderAny>
pub fn orders_for_ids( &self, client_order_ids: &[ClientOrderId], context: &dyn Display, ) -> Vec<OrderAny>
Returns owned copies of the orders for client_order_ids.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_order_id(
&self,
venue_order_id: &VenueOrderId,
) -> Option<ClientOrderId>
pub fn client_order_id( &self, venue_order_id: &VenueOrderId, ) -> Option<ClientOrderId>
Returns the client order ID for the venue_order_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn venue_order_id(
&self,
client_order_id: &ClientOrderId,
) -> Option<VenueOrderId>
pub fn venue_order_id( &self, client_order_id: &ClientOrderId, ) -> Option<VenueOrderId>
Returns the venue order ID for the client_order_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn client_id(&self, client_order_id: &ClientOrderId) -> Option<ClientId>
pub fn client_id(&self, client_order_id: &ClientOrderId) -> Option<ClientId>
Returns the client ID indexed for the client_order_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> Vec<OrderAny>
pub fn orders( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> Vec<OrderAny>
Returns owned copies of all orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_open(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> Vec<OrderAny>
pub fn orders_open( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> Vec<OrderAny>
Returns owned copies of all open orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_closed(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> Vec<OrderAny>
pub fn orders_closed( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> Vec<OrderAny>
Returns owned copies of all closed orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_active_local(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> Vec<OrderAny>
pub fn orders_active_local( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> Vec<OrderAny>
Returns owned copies of all locally active orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_emulated(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> Vec<OrderAny>
pub fn orders_emulated( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> Vec<OrderAny>
Returns owned copies of all emulated orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_inflight(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> Vec<OrderAny>
pub fn orders_inflight( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> Vec<OrderAny>
Returns owned copies of all in-flight orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_for_position(&self, position_id: &PositionId) -> Vec<OrderAny>
pub fn orders_for_position(&self, position_id: &PositionId) -> Vec<OrderAny>
Returns owned copies of all orders for the position_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn order_exists(&self, client_order_id: &ClientOrderId) -> bool
pub fn order_exists(&self, client_order_id: &ClientOrderId) -> bool
Returns whether an order with the client_order_id exists.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_order_open(&self, client_order_id: &ClientOrderId) -> bool
pub fn is_order_open(&self, client_order_id: &ClientOrderId) -> bool
Returns whether an order with the client_order_id is open.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_order_closed(&self, client_order_id: &ClientOrderId) -> bool
pub fn is_order_closed(&self, client_order_id: &ClientOrderId) -> bool
Returns whether an order with the client_order_id is closed.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_order_active_local(&self, client_order_id: &ClientOrderId) -> bool
pub fn is_order_active_local(&self, client_order_id: &ClientOrderId) -> bool
Returns whether an order with the client_order_id is locally active.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_order_emulated(&self, client_order_id: &ClientOrderId) -> bool
pub fn is_order_emulated(&self, client_order_id: &ClientOrderId) -> bool
Returns whether an order with the client_order_id is emulated.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_order_inflight(&self, client_order_id: &ClientOrderId) -> bool
pub fn is_order_inflight(&self, client_order_id: &ClientOrderId) -> bool
Returns whether an order with the client_order_id is in-flight.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_order_pending_cancel_local(
&self,
client_order_id: &ClientOrderId,
) -> bool
pub fn is_order_pending_cancel_local( &self, client_order_id: &ClientOrderId, ) -> bool
Returns whether an order with the client_order_id is PENDING_CANCEL locally.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_open_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> usize
pub fn orders_open_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> usize
Returns the count of all open orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_closed_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> usize
pub fn orders_closed_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> usize
Returns the count of all closed orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_active_local_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> usize
pub fn orders_active_local_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> usize
Returns the count of all locally active orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_emulated_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> usize
pub fn orders_emulated_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> usize
Returns the count of all emulated orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_inflight_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> usize
pub fn orders_inflight_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> usize
Returns the count of all in-flight orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_total_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> usize
pub fn orders_total_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> usize
Returns the count of all orders matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_orders_open(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> bool
pub fn has_orders_open( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> bool
Returns whether any open order matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_orders_closed(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> bool
pub fn has_orders_closed( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> bool
Returns whether any closed order matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_orders_active_local(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> bool
pub fn has_orders_active_local( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> bool
Returns whether any locally active order matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_orders_emulated(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> bool
pub fn has_orders_emulated( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> bool
Returns whether any emulated order matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_orders_inflight(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> bool
pub fn has_orders_inflight( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> bool
Returns whether any in-flight order matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_orders(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> bool
pub fn has_orders( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> bool
Returns whether any order matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn order_list(&self, order_list_id: &OrderListId) -> Option<OrderList>
pub fn order_list(&self, order_list_id: &OrderListId) -> Option<OrderList>
Returns an owned copy of the order list for the order_list_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_order_list(
&self,
order_list_id: &OrderListId,
) -> Result<OrderList, OrderListLookupError>
pub fn try_order_list( &self, order_list_id: &OrderListId, ) -> Result<OrderList, OrderListLookupError>
Returns an owned copy of the order list for the order_list_id.
§Errors
Returns an error if:
- The order list is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn order_lists(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
) -> Vec<OrderList>
pub fn order_lists( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, ) -> Vec<OrderList>
Returns owned copies of all order lists matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn order_list_exists(&self, order_list_id: &OrderListId) -> bool
pub fn order_list_exists(&self, order_list_id: &OrderListId) -> bool
Returns whether an order list with the order_list_id exists.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_for_exec_algorithm(
&self,
exec_algorithm_id: &ExecAlgorithmId,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<OrderSide>,
) -> Vec<OrderAny>
pub fn orders_for_exec_algorithm( &self, exec_algorithm_id: &ExecAlgorithmId, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<OrderSide>, ) -> Vec<OrderAny>
Returns owned copies of all orders associated with the exec_algorithm_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn orders_for_exec_spawn(
&self,
exec_spawn_id: &ClientOrderId,
) -> Vec<OrderAny>
pub fn orders_for_exec_spawn( &self, exec_spawn_id: &ClientOrderId, ) -> Vec<OrderAny>
Returns owned copies of all orders with the exec_spawn_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn exec_spawn_total_quantity(
&self,
exec_spawn_id: &ClientOrderId,
active_only: bool,
) -> Option<Quantity>
pub fn exec_spawn_total_quantity( &self, exec_spawn_id: &ClientOrderId, active_only: bool, ) -> Option<Quantity>
Returns the total order quantity for the exec_spawn_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn exec_spawn_total_filled_qty(
&self,
exec_spawn_id: &ClientOrderId,
active_only: bool,
) -> Option<Quantity>
pub fn exec_spawn_total_filled_qty( &self, exec_spawn_id: &ClientOrderId, active_only: bool, ) -> Option<Quantity>
Returns the total filled quantity for all orders with the exec_spawn_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn exec_spawn_total_leaves_qty(
&self,
exec_spawn_id: &ClientOrderId,
active_only: bool,
) -> Option<Quantity>
pub fn exec_spawn_total_leaves_qty( &self, exec_spawn_id: &ClientOrderId, active_only: bool, ) -> Option<Quantity>
Returns the total leaves quantity for all orders with the exec_spawn_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position(&self, position_id: &PositionId) -> Option<Position>
pub fn position(&self, position_id: &PositionId) -> Option<Position>
Returns an owned copy of the position for the position_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_position(
&self,
position_id: &PositionId,
) -> Result<Position, PositionLookupError>
pub fn try_position( &self, position_id: &PositionId, ) -> Result<Position, PositionLookupError>
Returns an owned copy of the position for the position_id.
§Errors
Returns an error if:
- The position is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn position_for_order(
&self,
client_order_id: &ClientOrderId,
) -> Option<Position>
pub fn position_for_order( &self, client_order_id: &ClientOrderId, ) -> Option<Position>
Returns an owned copy of the position for the client_order_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_id(&self, client_order_id: &ClientOrderId) -> Option<PositionId>
pub fn position_id(&self, client_order_id: &ClientOrderId) -> Option<PositionId>
Returns the position ID for the client_order_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn positions(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> Vec<Position>
pub fn positions( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> Vec<Position>
Returns owned copies of all positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn positions_open(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> Vec<Position>
pub fn positions_open( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> Vec<Position>
Returns owned copies of all open positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn positions_closed(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> Vec<Position>
pub fn positions_closed( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> Vec<Position>
Returns owned copies of all closed positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn position_exists(&self, position_id: &PositionId) -> bool
pub fn position_exists(&self, position_id: &PositionId) -> bool
Returns whether a position with the position_id exists.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_position_open(&self, position_id: &PositionId) -> bool
pub fn is_position_open(&self, position_id: &PositionId) -> bool
Returns whether a position with the position_id is open.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn is_position_closed(&self, position_id: &PositionId) -> bool
pub fn is_position_closed(&self, position_id: &PositionId) -> bool
Returns whether a position with the position_id is closed.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn positions_open_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> usize
pub fn positions_open_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> usize
Returns the count of all open positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn positions_closed_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> usize
pub fn positions_closed_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> usize
Returns the count of all closed positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn positions_total_count(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> usize
pub fn positions_total_count( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> usize
Returns the count of all positions matching the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_positions_open(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> bool
pub fn has_positions_open( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> bool
Returns whether any open position matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_positions_closed(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> bool
pub fn has_positions_closed( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> bool
Returns whether any closed position matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_positions(
&self,
venue: Option<&Venue>,
instrument_id: Option<&InstrumentId>,
strategy_id: Option<&StrategyId>,
account_id: Option<&AccountId>,
side: Option<PositionSide>,
) -> bool
pub fn has_positions( &self, venue: Option<&Venue>, instrument_id: Option<&InstrumentId>, strategy_id: Option<&StrategyId>, account_id: Option<&AccountId>, side: Option<PositionSide>, ) -> bool
Returns whether any position matches the optional filter parameters.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn strategy_id_for_order(
&self,
client_order_id: &ClientOrderId,
) -> Option<StrategyId>
pub fn strategy_id_for_order( &self, client_order_id: &ClientOrderId, ) -> Option<StrategyId>
Returns the strategy ID for the client_order_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn strategy_id_for_position(
&self,
position_id: &PositionId,
) -> Option<StrategyId>
pub fn strategy_id_for_position( &self, position_id: &PositionId, ) -> Option<StrategyId>
Returns the strategy ID for the position_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn get(&self, key: &str) -> Result<Option<Bytes>>
pub fn get(&self, key: &str) -> Result<Option<Bytes>>
Returns the general cache value for the key (if found).
§Errors
Returns an error if:
- The
keyis invalid. - The cache is already mutably borrowed.
Sourcepub fn price(
&self,
instrument_id: &InstrumentId,
price_type: PriceType,
) -> Option<Price>
pub fn price( &self, instrument_id: &InstrumentId, price_type: PriceType, ) -> Option<Price>
Returns the price for the instrument_id and price_type (if found).
For Mid, returns None if no quote is cached or either price is a sentinel.
For quote precision p, the midpoint has precision p + 1 when exactly representable,
otherwise p, rounded half-even if necessary. The fallback applies when the precision
limit or raw range rules out p + 1, and when p is the maximum float precision (16),
so a midpoint of a float-convertible quote stays float-convertible.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn quotes(&self, instrument_id: &InstrumentId) -> Option<Vec<QuoteTick>>
pub fn quotes(&self, instrument_id: &InstrumentId) -> Option<Vec<QuoteTick>>
Returns all quotes for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn trades(&self, instrument_id: &InstrumentId) -> Option<Vec<TradeTick>>
pub fn trades(&self, instrument_id: &InstrumentId) -> Option<Vec<TradeTick>>
Returns all trades for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn mark_prices(
&self,
instrument_id: &InstrumentId,
) -> Option<Vec<MarkPriceUpdate>>
pub fn mark_prices( &self, instrument_id: &InstrumentId, ) -> Option<Vec<MarkPriceUpdate>>
Returns all mark price updates for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn index_prices(
&self,
instrument_id: &InstrumentId,
) -> Option<Vec<IndexPriceUpdate>>
pub fn index_prices( &self, instrument_id: &InstrumentId, ) -> Option<Vec<IndexPriceUpdate>>
Returns all index price updates for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn funding_rates(
&self,
instrument_id: &InstrumentId,
) -> Option<Vec<FundingRateUpdate>>
pub fn funding_rates( &self, instrument_id: &InstrumentId, ) -> Option<Vec<FundingRateUpdate>>
Returns all funding rate updates for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn instrument_statuses(
&self,
instrument_id: &InstrumentId,
) -> Option<Vec<InstrumentStatus>>
pub fn instrument_statuses( &self, instrument_id: &InstrumentId, ) -> Option<Vec<InstrumentStatus>>
Returns all instrument status updates for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn bars(&self, bar_type: &BarType) -> Option<Vec<Bar>>
pub fn bars(&self, bar_type: &BarType) -> Option<Vec<Bar>>
Returns all bars for the bar_type (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn order_book(&self, instrument_id: &InstrumentId) -> Option<OrderBook>
pub fn order_book(&self, instrument_id: &InstrumentId) -> Option<OrderBook>
Returns an owned copy of the order book for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_order_book(
&self,
instrument_id: &InstrumentId,
) -> Result<OrderBook, OrderBookLookupError>
pub fn try_order_book( &self, instrument_id: &InstrumentId, ) -> Result<OrderBook, OrderBookLookupError>
Returns an owned copy of the order book for the instrument_id.
§Errors
Returns an error if:
- The order book is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn own_order_book(
&self,
instrument_id: &InstrumentId,
) -> Option<OwnOrderBook>
pub fn own_order_book( &self, instrument_id: &InstrumentId, ) -> Option<OwnOrderBook>
Returns an owned copy of the own order book for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_own_order_book(
&self,
instrument_id: &InstrumentId,
) -> Result<OwnOrderBook, OwnOrderBookLookupError>
pub fn try_own_order_book( &self, instrument_id: &InstrumentId, ) -> Result<OwnOrderBook, OwnOrderBookLookupError>
Returns an owned copy of the own order book for the instrument_id.
§Errors
Returns an error if:
- The own order book is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn quote(&self, instrument_id: &InstrumentId) -> Option<QuoteTick>
pub fn quote(&self, instrument_id: &InstrumentId) -> Option<QuoteTick>
Returns the latest quote for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn quote_at_index(
&self,
instrument_id: &InstrumentId,
index: usize,
) -> Option<QuoteTick>
pub fn quote_at_index( &self, instrument_id: &InstrumentId, index: usize, ) -> Option<QuoteTick>
Returns the quote at index for the instrument_id (if found).
Index 0 is the most recent.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn trade(&self, instrument_id: &InstrumentId) -> Option<TradeTick>
pub fn trade(&self, instrument_id: &InstrumentId) -> Option<TradeTick>
Returns the latest trade for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn trade_at_index(
&self,
instrument_id: &InstrumentId,
index: usize,
) -> Option<TradeTick>
pub fn trade_at_index( &self, instrument_id: &InstrumentId, index: usize, ) -> Option<TradeTick>
Returns the trade at index for the instrument_id (if found).
Index 0 is the most recent.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn mark_price(
&self,
instrument_id: &InstrumentId,
) -> Option<MarkPriceUpdate>
pub fn mark_price( &self, instrument_id: &InstrumentId, ) -> Option<MarkPriceUpdate>
Returns the latest mark price update for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn index_price(
&self,
instrument_id: &InstrumentId,
) -> Option<IndexPriceUpdate>
pub fn index_price( &self, instrument_id: &InstrumentId, ) -> Option<IndexPriceUpdate>
Returns the latest index price update for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn funding_rate(
&self,
instrument_id: &InstrumentId,
) -> Option<FundingRateUpdate>
pub fn funding_rate( &self, instrument_id: &InstrumentId, ) -> Option<FundingRateUpdate>
Returns the latest funding rate update for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn instrument_status(
&self,
instrument_id: &InstrumentId,
) -> Option<InstrumentStatus>
pub fn instrument_status( &self, instrument_id: &InstrumentId, ) -> Option<InstrumentStatus>
Returns the latest instrument status update for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn instrument_close(
&self,
instrument_id: &InstrumentId,
) -> Option<InstrumentClose>
pub fn instrument_close( &self, instrument_id: &InstrumentId, ) -> Option<InstrumentClose>
Returns the cached close for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn bar(&self, bar_type: &BarType) -> Option<Bar>
pub fn bar(&self, bar_type: &BarType) -> Option<Bar>
Returns the latest bar for the bar_type (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn bar_at_index(&self, bar_type: &BarType, index: usize) -> Option<Bar>
pub fn bar_at_index(&self, bar_type: &BarType, index: usize) -> Option<Bar>
Returns the bar at index for the bar_type (if found).
Index 0 is the most recent.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn book_update_count(&self, instrument_id: &InstrumentId) -> usize
pub fn book_update_count(&self, instrument_id: &InstrumentId) -> usize
Returns the order book update count for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn quote_count(&self, instrument_id: &InstrumentId) -> usize
pub fn quote_count(&self, instrument_id: &InstrumentId) -> usize
Returns the quote tick count for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn trade_count(&self, instrument_id: &InstrumentId) -> usize
pub fn trade_count(&self, instrument_id: &InstrumentId) -> usize
Returns the trade tick count for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn mark_price_count(&self, instrument_id: &InstrumentId) -> usize
pub fn mark_price_count(&self, instrument_id: &InstrumentId) -> usize
Returns the mark price update count for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn index_price_count(&self, instrument_id: &InstrumentId) -> usize
pub fn index_price_count(&self, instrument_id: &InstrumentId) -> usize
Returns the index price update count for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn funding_rate_count(&self, instrument_id: &InstrumentId) -> usize
pub fn funding_rate_count(&self, instrument_id: &InstrumentId) -> usize
Returns the funding rate update count for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn instrument_status_count(&self, instrument_id: &InstrumentId) -> usize
pub fn instrument_status_count(&self, instrument_id: &InstrumentId) -> usize
Returns the instrument status update count for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_order_book(&self, instrument_id: &InstrumentId) -> bool
pub fn has_order_book(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains an order book for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_quote_ticks(&self, instrument_id: &InstrumentId) -> bool
pub fn has_quote_ticks(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains quotes for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_trade_ticks(&self, instrument_id: &InstrumentId) -> bool
pub fn has_trade_ticks(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains trades for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_mark_prices(&self, instrument_id: &InstrumentId) -> bool
pub fn has_mark_prices(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains mark price updates for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_index_prices(&self, instrument_id: &InstrumentId) -> bool
pub fn has_index_prices(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains index price updates for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_funding_rates(&self, instrument_id: &InstrumentId) -> bool
pub fn has_funding_rates(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains funding rate updates for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_instrument_statuses(&self, instrument_id: &InstrumentId) -> bool
pub fn has_instrument_statuses(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains instrument status updates for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_instrument_close(&self, instrument_id: &InstrumentId) -> bool
pub fn has_instrument_close(&self, instrument_id: &InstrumentId) -> bool
Returns whether the cache contains a close for the instrument_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn has_bars(&self, bar_type: &BarType) -> bool
pub fn has_bars(&self, bar_type: &BarType) -> bool
Returns whether the cache contains bars for the bar_type.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn get_xrate(
&self,
venue: Venue,
from_currency: Currency,
to_currency: Currency,
price_type: PriceType,
) -> Option<Decimal>
pub fn get_xrate( &self, venue: Venue, from_currency: Currency, to_currency: Currency, price_type: PriceType, ) -> Option<Decimal>
Returns the exchange rate for the given currencies and price type (if available).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn get_mark_xrate(
&self,
from_currency: Currency,
to_currency: Currency,
) -> Option<f64>
pub fn get_mark_xrate( &self, from_currency: Currency, to_currency: Currency, ) -> Option<f64>
Returns the mark exchange rate for the currency pair (if set).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn yield_curve(&self, key: &str) -> Option<Box<dyn Fn(f64) -> f64>>
pub fn yield_curve(&self, key: &str) -> Option<Box<dyn Fn(f64) -> f64>>
Returns the yield curve for the key (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn greeks(&self, instrument_id: &InstrumentId) -> Option<GreeksData>
pub fn greeks(&self, instrument_id: &InstrumentId) -> Option<GreeksData>
Returns an owned copy of the greeks data for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn option_greeks(
&self,
instrument_id: &InstrumentId,
) -> Option<OptionGreeks>
pub fn option_greeks( &self, instrument_id: &InstrumentId, ) -> Option<OptionGreeks>
Returns exchange-provided option greeks for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn currency(&self, code: &Ustr) -> Option<Currency>
pub fn currency(&self, code: &Ustr) -> Option<Currency>
Returns the currency for the code (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_currency(&self, code: &Ustr) -> Result<Currency, CurrencyLookupError>
pub fn try_currency(&self, code: &Ustr) -> Result<Currency, CurrencyLookupError>
Returns the currency for the code.
§Errors
Returns an error if:
- The currency is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn instrument(&self, instrument_id: &InstrumentId) -> Option<InstrumentAny>
pub fn instrument(&self, instrument_id: &InstrumentId) -> Option<InstrumentAny>
Returns an owned copy of the instrument for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_instrument(
&self,
instrument_id: &InstrumentId,
) -> Result<InstrumentAny, InstrumentLookupError>
pub fn try_instrument( &self, instrument_id: &InstrumentId, ) -> Result<InstrumentAny, InstrumentLookupError>
Returns an owned copy of the instrument for the instrument_id.
§Errors
Returns an error if:
- The instrument is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn instrument_ids(&self, venue: Option<&Venue>) -> Vec<InstrumentId>
pub fn instrument_ids(&self, venue: Option<&Venue>) -> Vec<InstrumentId>
Returns the instrument IDs in the cache, optionally filtered by venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn instruments(
&self,
venue: &Venue,
underlying: Option<&Ustr>,
) -> Vec<InstrumentAny>
pub fn instruments( &self, venue: &Venue, underlying: Option<&Ustr>, ) -> Vec<InstrumentAny>
Returns owned copies of all instruments for the venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn instruments_by_parent(
&self,
venue: &Venue,
root: &Ustr,
class: InstrumentClass,
) -> Vec<InstrumentAny>
pub fn instruments_by_parent( &self, venue: &Venue, root: &Ustr, class: InstrumentClass, ) -> Vec<InstrumentAny>
Returns owned copies of all instruments for the venue, parent root, and instrument
class.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn bar_types(
&self,
instrument_id: Option<&InstrumentId>,
price_type: Option<&PriceType>,
aggregation_source: AggregationSource,
) -> Vec<BarType>
pub fn bar_types( &self, instrument_id: Option<&InstrumentId>, price_type: Option<&PriceType>, aggregation_source: AggregationSource, ) -> Vec<BarType>
Returns the bar types in the cache, optionally filtered by instrument and price type.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn synthetic(
&self,
instrument_id: &InstrumentId,
) -> Option<SyntheticInstrument>
pub fn synthetic( &self, instrument_id: &InstrumentId, ) -> Option<SyntheticInstrument>
Returns an owned copy of the synthetic instrument for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_synthetic(
&self,
instrument_id: &InstrumentId,
) -> Result<SyntheticInstrument, SyntheticInstrumentLookupError>
pub fn try_synthetic( &self, instrument_id: &InstrumentId, ) -> Result<SyntheticInstrument, SyntheticInstrumentLookupError>
Returns an owned copy of the synthetic instrument for the instrument_id.
§Errors
Returns an error if:
- The synthetic instrument is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn synthetic_ids(&self) -> Vec<InstrumentId>
pub fn synthetic_ids(&self) -> Vec<InstrumentId>
Returns the synthetic instrument IDs in the cache.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn synthetics(&self) -> Vec<SyntheticInstrument>
pub fn synthetics(&self) -> Vec<SyntheticInstrument>
Returns owned copies of all synthetic instruments in the cache.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn pool(&self, instrument_id: &InstrumentId) -> Option<Pool>
pub fn pool(&self, instrument_id: &InstrumentId) -> Option<Pool>
Returns an owned copy of the pool for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn pool_ids(&self, venue: Option<&Venue>) -> Vec<InstrumentId>
pub fn pool_ids(&self, venue: Option<&Venue>) -> Vec<InstrumentId>
Returns the pool instrument IDs in the cache, optionally filtered by venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn pools(&self, venue: Option<&Venue>) -> Vec<Pool>
pub fn pools(&self, venue: Option<&Venue>) -> Vec<Pool>
Returns owned copies of all pools in the cache, optionally filtered by venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn pool_profiler(
&self,
instrument_id: &InstrumentId,
) -> Option<PoolProfiler>
pub fn pool_profiler( &self, instrument_id: &InstrumentId, ) -> Option<PoolProfiler>
Returns an owned copy of the pool profiler for the instrument_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn pool_profiler_ids(&self, venue: Option<&Venue>) -> Vec<InstrumentId>
pub fn pool_profiler_ids(&self, venue: Option<&Venue>) -> Vec<InstrumentId>
Returns the pool profiler instrument IDs in the cache, optionally filtered by venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn pool_profilers(&self, venue: Option<&Venue>) -> Vec<PoolProfiler>
pub fn pool_profilers(&self, venue: Option<&Venue>) -> Vec<PoolProfiler>
Returns owned copies of all pool profilers in the cache, optionally filtered by venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn account(&self, account_id: &AccountId) -> Option<AccountAny>
pub fn account(&self, account_id: &AccountId) -> Option<AccountAny>
Returns an owned copy of the account for the account_id (if found).
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn try_account(
&self,
account_id: &AccountId,
) -> Result<AccountAny, AccountLookupError>
pub fn try_account( &self, account_id: &AccountId, ) -> Result<AccountAny, AccountLookupError>
Returns an owned copy of the account for the account_id.
§Errors
Returns an error if:
- The account is not present in the cache.
- The cache is already mutably borrowed.
Sourcepub fn account_for_venue(&self, venue: &Venue) -> Option<AccountAny>
pub fn account_for_venue(&self, venue: &Venue) -> Option<AccountAny>
Returns an owned copy of the account for the venue (if found).
Returns None when more than one account is issued under the venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn account_id(&self, venue: &Venue) -> Option<AccountId>
pub fn account_id(&self, venue: &Venue) -> Option<AccountId>
Returns the account ID for the venue (if found).
Returns None when more than one account is issued under the venue.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn accounts(&self, account_id: &AccountId) -> Vec<AccountAny>
pub fn accounts(&self, account_id: &AccountId) -> Vec<AccountAny>
Returns owned copies of all accounts matching the account_id.
§Panics
Panics if the cache is already mutably borrowed.
Sourcepub fn accounts_all(&self) -> Vec<AccountAny>
pub fn accounts_all(&self) -> Vec<AccountAny>
Returns owned copies of every account in the cache.
§Panics
Panics if the cache is already mutably borrowed.