ExchangeTransformer

Trait ExchangeTransformer 

Source
pub trait ExchangeTransformer<Exchange, InstrumentKey, Kind>
where Self: Transformer<Output = MarketEvent<InstrumentKey, Kind::Event>, Error = DataError> + Sized, Kind: SubscriptionKind,
{ // Required method fn init<'life0, 'async_trait>( instrument_map: Map<InstrumentKey>, initial_snapshots: &'life0 [MarketEvent<InstrumentKey, Kind::Event>], ws_sink_tx: UnboundedSender<WsMessage>, ) -> Pin<Box<dyn Future<Output = Result<Self, DataError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; }
Expand description

Defines how to construct a Transformer used by MarketStreams to translate exchange specific types to normalised Barter types.

Required Methods§

Source

fn init<'life0, 'async_trait>( instrument_map: Map<InstrumentKey>, initial_snapshots: &'life0 [MarketEvent<InstrumentKey, Kind::Event>], ws_sink_tx: UnboundedSender<WsMessage>, ) -> Pin<Box<dyn Future<Output = Result<Self, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialise a new Self, also fetching any market data snapshots required for the associated Exchange and SubscriptionKind market stream to function.

The mpsc::UnboundedSender can be used by Self to send messages back to the exchange.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Exchange, InstrumentKey, Kind, Input> ExchangeTransformer<Exchange, InstrumentKey, Kind> for StatelessTransformer<Exchange, InstrumentKey, Kind, Input>
where Exchange: Connector + Send, InstrumentKey: Clone + Send, Kind: SubscriptionKind + Send, Input: Identifier<Option<SubscriptionId>> + for<'de> Deserialize<'de>, MarketIter<InstrumentKey, Kind::Event>: From<(ExchangeId, InstrumentKey, Input)>,

Source§

impl<InstrumentKey> ExchangeTransformer<Binance<BinanceServerFuturesUsd>, InstrumentKey, OrderBooksL2> for BinanceFuturesUsdOrderBooksL2Transformer<InstrumentKey>
where InstrumentKey: Clone + PartialEq + Send + Sync,

Source§

impl<InstrumentKey> ExchangeTransformer<Binance<BinanceServerSpot>, InstrumentKey, OrderBooksL2> for BinanceSpotOrderBooksL2Transformer<InstrumentKey>
where InstrumentKey: Clone + PartialEq + Send + Sync,

Source§

impl<InstrumentKey, Server> ExchangeTransformer<Bybit<Server>, InstrumentKey, OrderBooksL2> for BybitOrderBooksL2Transformer<InstrumentKey>
where InstrumentKey: Clone + PartialEq + Send + Sync,