Struct UserDataConfig
pub struct UserDataConfig {
pub tbank: TbankConfig,
pub source: Arc<str>,
pub order_state_buffer: usize,
pub ping_interval: Duration,
pub price_grid: PriceGrid,
}Expand description
User data connector config. One connector = one account: tbank.account_id.
With None the connector uses the token’s only open account and refuses to start when there are several.
Several accounts of one token need several connectors, each with its own config that differs in
tbank.account_id and in source. Share one rate limiter between them.
§Examples
use brokapi_tbank::UserDataConfig;
use brokapi_tbank_protocol::TbankConfig;
let cfg = UserDataConfig::new(TbankConfig::sandbox("t.my-token").with_account("acc-main"), "tbank-ud-main");
assert_eq!(cfg.tbank.account_id.as_deref(), Some("acc-main"));
assert_eq!(cfg.order_state_buffer, 1024);Fields§
§tbank: TbankConfigEndpoint, token, account and timeouts of the API. Set account_id with
[TbankConfig::with_account] when the token sees more than one account.
source: Arc<str>Envelope source label, e.g. "tbank-ud-main". Give every account its own.
order_state_buffer: usizeLossless buffer capacity for the order state and executions subscriptions.
Own order states and trades are never dropped. If the consumer is so slow that the buffer fills up, an overflow event is sent and the trading gate closes until the next successful reconcile. Default 1024.
ping_interval: DurationServer ping period on the user data streams. A value outside 5 s to 120 s is brought into that range, both for the request and for the silence limit. A stream silent for three periods is treated as dead and reconnected. Default 30 s.
price_grid: PriceGridPrice steps the connector checks order prices against (default: empty, nothing is checked).
Fill it with [PriceGrid::learn] from the trading parameters of the instruments you trade. A
price off the step is then refused with Rejected (price_off_step) before anything is sent.
Implementations§
§impl UserDataConfig
impl UserDataConfig
pub fn new(tbank: TbankConfig, source: impl Into<Arc<str>>) -> UserDataConfig
pub fn new(tbank: TbankConfig, source: impl Into<Arc<str>>) -> UserDataConfig
A config with the default buffer (1024 events) and ping period (30 s).
source labels every Envelope of this connector. Give each account
its own label.
§Examples
use brokapi_tbank::UserDataConfig;
use brokapi_tbank_protocol::TbankConfig;
let cfg = UserDataConfig::new(TbankConfig::sandbox("t.my-token"), "tbank-ud");
assert_eq!(&*cfg.source, "tbank-ud");Trait Implementations§
§impl Clone for UserDataConfig
impl Clone for UserDataConfig
§fn clone(&self) -> UserDataConfig
fn clone(&self) -> UserDataConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for UserDataConfig
impl RefUnwindSafe for UserDataConfig
impl Send for UserDataConfig
impl Sync for UserDataConfig
impl Unpin for UserDataConfig
impl UnsafeUnpin for UserDataConfig
impl UnwindSafe for UserDataConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].