Skip to main content

init_market_stream

Function init_market_stream 

Source
pub async fn init_market_stream<Exchange, Instrument, Kind>(
    policy: ReconnectionBackoffPolicy,
    subscriber: Exchange::Subscriber,
    subscriptions: Vec<Subscription<Exchange, Instrument, Kind>>,
) -> Result<impl Stream<Item = MarketStreamResult<Instrument::Key, Kind::Event>>, DataError>
where Exchange: StreamSelector<Instrument, Kind>, Instrument: InstrumentData + Display, Kind: SubscriptionKind + Display, Subscription<Exchange, Instrument, Kind>: Identifier<Exchange::Channel> + Identifier<Exchange::Market>,
Expand description

Initialises a reconnecting MarketStream using a collection of Subscriptions.

The provided ReconnectionBackoffPolicy dictates how the exponential backoff scales between reconnections.

The subscriber is cloned into the reconnect closure, so authenticated subscribers will have their credentials available on reconnection.