Struct MarketDataConfig
pub struct MarketDataConfig {
pub bcs: BcsConfig,
pub source: Arc<str>,
pub reconnect_min: Duration,
pub reconnect_max: Duration,
pub subscribe_ack_timeout: Duration,
}Expand description
Settings of MarketDataConnector.
§Examples
use std::time::Duration;
use brokapi_bcs_protocol::config::BcsConfig;
use brokapi_bcs::MarketDataConfig;
let mut cfg = MarketDataConfig::new(BcsConfig::new("refresh-token".into()), "bcs-md");
assert_eq!(&*cfg.source, "bcs-md");
// Wait at most 10 seconds between reconnects instead of the default 30.
cfg.reconnect_max = Duration::from_secs(10);Fields§
§bcs: BcsConfigClient settings of the BCS API: refresh token, timeouts, endpoints, write switch.
source: Arc<str>Envelope source label, e.g. "bcs-md".
reconnect_min: DurationPause before the first reconnect of the WebSocket, doubling up to reconnect_max
(default 0.5 s, as at T-Bank and Finam).
reconnect_max: DurationUpper bound of the pause (default 30 s). The pause returns to reconnect_min once a connection
has lived 10 seconds.
subscribe_ack_timeout: DurationHow long a subscribe_* call waits for the broker to confirm the subscription (default 3 s). The call
returns when the broker has confirmed: what happens after that is delivered. A refusal is returned as
Rejected (subscription_refused). If nothing comes in time, the call fails with Transport and the
subscription is taken back, so the call can be repeated.
Implementations§
§impl MarketDataConfig
impl MarketDataConfig
pub fn new(bcs: BcsConfig, source: impl Into<Arc<str>>) -> MarketDataConfig
pub fn new(bcs: BcsConfig, source: impl Into<Arc<str>>) -> MarketDataConfig
Creates a config with the default reconnect pauses (0.5 s up to 30 s) and a 3 s wait for the confirmation of a subscription.
source is the label put in every Envelope this connector emits,
so a bot with several connectors can tell them apart.
Trait Implementations§
§impl Clone for MarketDataConfig
impl Clone for MarketDataConfig
§fn clone(&self) -> MarketDataConfig
fn clone(&self) -> MarketDataConfig
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 MarketDataConfig
impl RefUnwindSafe for MarketDataConfig
impl Send for MarketDataConfig
impl Sync for MarketDataConfig
impl Unpin for MarketDataConfig
impl UnsafeUnpin for MarketDataConfig
impl UnwindSafe for MarketDataConfig
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].