Expand description
Loads limits.toml (section [tbank]) through BrokerLimits::from_toml_section.
One BrokerLimiter per user (all accounts, all tokens, one IP): see the scope notes in the toml.
T-Bank counts its limits per user, not per account and not per token. So every connector of one
user must share ONE limiter, or the sum of their requests can pass the broker’s cap while each
connector thinks it is within its own quota. Build the limiter once and give each connector a
clone of the Arc.
The bundled defaults are the figures from the broker’s documentation. T-Bank makes the real limits dynamic (they depend on the user’s tariff), so the figures here are a safe start and not verified against the live API.
§Examples
use std::sync::Arc;
use brokapi_runtime::BrokerLimiter;
use brokapi_tbank::limits::default_limits;
// One limiter for everything one user runs. Give `Arc::clone(&limiter)` to every connector:
// all market data connectors and all user data connectors, whatever their account.
let limiter = BrokerLimiter::new(&default_limits());
let for_account_a = Arc::clone(&limiter);
let for_account_b = Arc::clone(&limiter);
assert!(Arc::ptr_eq(&for_account_a, &for_account_b));Constants§
- DEFAULT_
LIMITS_ TOML - The bundled default limits, as documented by T-Bank (the text of
limits.toml).
Functions§
- default_
limits - The bundled default limits of T-Bank, ready for
BrokerLimiter::new. - limits_
from_ toml_ path - Reads the
[tbank]section of a limits file on disk. - limits_
from_ toml_ str - Reads the
[tbank]section of a limits file given as text.