rustrade_data/transformer/
mod.rs1use crate::{
2 error::DataError,
3 event::MarketEvent,
4 subscription::{Map, SubscriptionKind},
5};
6use rustrade_integration::{Transformer, protocol::websocket::WsMessage};
7use std::future::Future;
8use tokio::sync::mpsc;
9
10pub mod stateless;
13
14pub trait ExchangeTransformer<Exchange, InstrumentKey, Kind>
17where
18 Self: Transformer<Output = MarketEvent<InstrumentKey, Kind::Event>, Error = DataError> + Sized,
19 Kind: SubscriptionKind,
20{
21 fn init(
26 instrument_map: Map<InstrumentKey>,
27 initial_snapshots: &[MarketEvent<InstrumentKey, Kind::Event>],
28 ws_sink_tx: mpsc::UnboundedSender<WsMessage>,
29 ) -> impl Future<Output = Result<Self, DataError>> + Send
30 where
31 InstrumentKey: Sync,
32 Kind::Event: Sync;
33}