pub trait SubscriptionConverter<T: Debug> {
// Required methods
fn convert(options: &SubscriptionOptions) -> T;
fn create_trade_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T;
fn create_orderbook_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
depth: Option<u32>,
update_speed: Option<u64>,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T;
fn create_ticker_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T;
fn create_kline_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
interval: &str,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T;
}Expand description
Generic trait for converting standardized subscription options to exchange-specific formats
This trait defines the interface that all exchange-specific subscription converters must implement to convert from the standardized SubscriptionOptions structure to the exchange’s native format.
Required Methods§
Sourcefn convert(options: &SubscriptionOptions) -> T
fn convert(options: &SubscriptionOptions) -> T
Convert standardized SubscriptionOptions to exchange-specific format
This method must be implemented by each exchange to convert the common subscription options into a format that can be sent directly to the exchange’s WebSocket API.
§Arguments
options- The standardized subscription options
§Returns
An exchange-specific subscription message/request of type T
Sourcefn create_trade_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T
fn create_trade_subscription( ticket: &str, symbols: SmallVec<[String; 8]>, is_snapshot_only: Option<bool>, is_realtime_only: Option<bool>, additional_params: Option<&[(&str, &str)]>, ) -> T
Create a trade subscription message for the specified symbols
§Arguments
ticket- A unique identifier for the subscription (correlation ID)symbols- List of symbols to subscribe tois_snapshot_only- Optional flag to only receive snapshot datais_realtime_only- Optional flag to only receive real-time updatesadditional_params- Optional additional parameters for the exchange
§Returns
An exchange-specific subscription message/request
Sourcefn create_orderbook_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
depth: Option<u32>,
update_speed: Option<u64>,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T
fn create_orderbook_subscription( ticket: &str, symbols: SmallVec<[String; 8]>, depth: Option<u32>, update_speed: Option<u64>, is_snapshot_only: Option<bool>, is_realtime_only: Option<bool>, additional_params: Option<&[(&str, &str)]>, ) -> T
Create an orderbook subscription message for the specified symbols
§Arguments
ticket- A unique identifier for the subscription (correlation ID)symbols- List of symbols to subscribe todepth- Optional depth levelupdate_speed- Optional update speed in millisecondsis_snapshot_only- Optional flag to only receive snapshot datais_realtime_only- Optional flag to only receive real-time updatesadditional_params- Optional additional parameters for the exchange
§Returns
An exchange-specific subscription message/request
Sourcefn create_ticker_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T
fn create_ticker_subscription( ticket: &str, symbols: SmallVec<[String; 8]>, is_snapshot_only: Option<bool>, is_realtime_only: Option<bool>, additional_params: Option<&[(&str, &str)]>, ) -> T
Create a ticker subscription message for the specified symbols
§Arguments
ticket- A unique identifier for the subscription (correlation ID)symbols- List of symbols to subscribe tois_snapshot_only- Optional flag to only receive snapshot datais_realtime_only- Optional flag to only receive real-time updatesadditional_params- Optional additional parameters for the exchange
§Returns
An exchange-specific subscription message/request
Sourcefn create_kline_subscription(
ticket: &str,
symbols: SmallVec<[String; 8]>,
interval: &str,
is_snapshot_only: Option<bool>,
is_realtime_only: Option<bool>,
additional_params: Option<&[(&str, &str)]>,
) -> T
fn create_kline_subscription( ticket: &str, symbols: SmallVec<[String; 8]>, interval: &str, is_snapshot_only: Option<bool>, is_realtime_only: Option<bool>, additional_params: Option<&[(&str, &str)]>, ) -> T
Create a kline/candlestick subscription message for the specified symbols
§Arguments
ticket- A unique identifier for the subscription (correlation ID)symbols- List of symbols to subscribe tointerval- Time interval (e.g., “1m”, “1h”, “1d”)is_snapshot_only- Optional flag to only receive snapshot datais_realtime_only- Optional flag to only receive real-time updatesadditional_params- Optional additional parameters for the exchange
§Returns
An exchange-specific subscription message/request
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.