Skip to main content

default_limits

Function default_limits 

Source
pub fn default_limits() -> BrokerLimits
Expand description

The bundled default limits of T-Bank, ready for BrokerLimiter::new.

Every unary method of the API has a route (placing and cancelling orders have buckets of their own). A method name without a route spends the "*" default route, so no call is free.

§Panics

Never in practice: the bundled file is checked by this crate’s tests.

§Examples

use brokapi_tbank::limits::default_limits;

let limits = default_limits();
// Placing and cancelling spend different buckets: a busy cancel loop cannot starve placing.
assert!(limits.buckets_for("PostOrder").contains(&"order_post".to_string()));
assert!(limits.buckets_for("CancelOrder").contains(&"order_cancel".to_string()));