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§
Source§impl MarketDataConfig
impl MarketDataConfig
Sourcepub fn new(bcs: BcsConfig, source: impl Into<Arc<str>>) -> Self
pub fn new(bcs: BcsConfig, source: impl Into<Arc<str>>) -> Self
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§
Source§impl Clone for MarketDataConfig
impl Clone for MarketDataConfig
Source§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 more