pub struct DynamicSubscribers {}Expand description
The subscribers DynamicStreams cannot build for itself.
Most venues are served by a stateless WebSocketSubscriber,
which DynamicStreams constructs on its own. A venue whose subscriber carries credentials —
or shares one connection among its streams — needs one built by the caller and supplied here,
through DynamicStreams::init_with. A subscription to such a venue with no subscriber
supplied fails with DataError::SubscriberRequired.
Venues that need one:
- Alpaca (
alpacafeature):AlpacaCrypto,AlpacaIexandAlpacaSip. - London Strategic Edge (
lsefeature): everyLse*dataset. - Massive (
massivefeature):MassiveStocks,MassiveCrypto,MassiveForexandMassiveOptions.
§Example
ⓘ
use rustrade_data::exchange::lse::live::LseSubscriber;
use rustrade_data::streams::builder::dynamic::{DynamicStreams, DynamicSubscribers};
use rustrade_data::subscription::SubKind;
use rustrade_instrument::{
exchange::ExchangeId, instrument::market_data::kind::MarketDataInstrumentKind,
};
let subscribers = DynamicSubscribers::default().with_lse(LseSubscriber::from_env()?);
// Two datasets and both kinds: four streams, one connection.
let streams = DynamicStreams::init_with(&subscribers, [[
(ExchangeId::LseCrypto, "btc", "usd", MarketDataInstrumentKind::Spot, SubKind::PublicTrades),
(ExchangeId::LseCrypto, "btc", "usd", MarketDataInstrumentKind::Spot, SubKind::OrderBooksL1),
(ExchangeId::LseEquities, "aapl", "usd", MarketDataInstrumentKind::Spot, SubKind::PublicTrades),
(ExchangeId::LseEquities, "aapl", "usd", MarketDataInstrumentKind::Spot, SubKind::OrderBooksL1),
]])
.await?;Trait Implementations§
Source§impl Clone for DynamicSubscribers
impl Clone for DynamicSubscribers
Source§impl Debug for DynamicSubscribers
impl Debug for DynamicSubscribers
Auto Trait Implementations§
impl Freeze for DynamicSubscribers
impl RefUnwindSafe for DynamicSubscribers
impl Send for DynamicSubscribers
impl Sync for DynamicSubscribers
impl Unpin for DynamicSubscribers
impl UnsafeUnpin for DynamicSubscribers
impl UnwindSafe for DynamicSubscribers
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<Instrument> DynamicAlpacaInstrument for Instrument
impl<Instrument> DynamicHyperliquidInstrument for Instrument
impl<Instrument> DynamicLseInstrument for Instrument
impl<Instrument> DynamicMassiveInstrument for Instrument
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more