pub struct MarketDataConfig {
pub tbank: TbankConfig,
pub source: Arc<str>,
pub ping_interval: Duration,
}Expand description
Market data connector config. Not tied to an account: one per broker (token) is enough.
Build it with MarketDataConfig::new and change the public fields if needed.
§Examples
use brokapi_tbank::MarketDataConfig;
use brokapi_tbank_protocol::TbankConfig;
let mut cfg = MarketDataConfig::new(TbankConfig::sandbox("t.my-token"), "tbank-md");
cfg.ping_interval = std::time::Duration::from_secs(10);
assert_eq!(&*cfg.source, "tbank-md");Fields§
§tbank: TbankConfigEndpoint, token and timeouts of the API. tbank.account_id is ignored by market data.
source: Arc<str>Envelope source label, e.g. "tbank-md".
ping_interval: DurationServer ping period on the stream. T-Bank accepts 5 s to 180 s: a value outside that range is brought into it, both for the request and for the silence limit. A stream silent for three periods is treated as dead and reconnected. Default 30 s.
Implementations§
Source§impl MarketDataConfig
impl MarketDataConfig
Sourcepub fn new(tbank: TbankConfig, source: impl Into<Arc<str>>) -> Self
pub fn new(tbank: TbankConfig, source: impl Into<Arc<str>>) -> Self
A config with the default ping period (30 s).
source labels every Envelope this connector emits, so that you
can tell connectors apart when they write into one channel.
§Examples
use brokapi_tbank::MarketDataConfig;
use brokapi_tbank_protocol::TbankConfig;
let cfg = MarketDataConfig::new(TbankConfig::production("t.my-token"), "tbank-md");
assert_eq!(&*cfg.source, "tbank-md");Trait Implementations§
Source§impl Clone for MarketDataConfig
impl Clone for MarketDataConfig
Source§fn clone(&self) -> MarketDataConfig
fn clone(&self) -> MarketDataConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
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>,
Applies the layer to a service and wraps it in [
Layered].