pub struct SubscriptionSet { /* private fields */ }Expand description
Declarative subscription request — built up fluently, consumed by
crate::Station::subscribe.
Implementations§
Source§impl SubscriptionSet
impl SubscriptionSet
pub fn new() -> Self
Sourcepub fn add(
self,
exchange: ExchangeId,
symbol: impl Into<String>,
account_type: AccountType,
streams: impl IntoIterator<Item = Stream>,
) -> Self
pub fn add( self, exchange: ExchangeId, symbol: impl Into<String>, account_type: AccountType, streams: impl IntoIterator<Item = Stream>, ) -> Self
Add a subscription. symbol is canonical (e.g. "BTC-USDT",
"BTCUSDT", "BTC/USDT") — it is parsed into a canonical
Symbol and translated to the exchange-native form via
SymbolNormalizer. Use Self::add_raw for instrument IDs that
don’t fit the canonical BASE-QUOTE shape (Deribit options,
exchange-specific futures suffixes, etc.).
Sourcepub fn add_with_warm(
self,
exchange: ExchangeId,
symbol: impl Into<String>,
account_type: AccountType,
streams: impl IntoIterator<Item = Stream>,
warm_n: usize,
) -> Self
pub fn add_with_warm( self, exchange: ExchangeId, symbol: impl Into<String>, account_type: AccountType, streams: impl IntoIterator<Item = Stream>, warm_n: usize, ) -> Self
Add a subscription with an explicit warm-start depth override.
warm_n replaces the Station-wide warm_start_capacity for this
entry’s derived-stream cold-start seed (aggTrade page count for
count/volume-triggered bars; kline-approx page count for
price-path-triggered bars — see station::acquire_or_spawn_derived_body).
Non-derived (plain WS-backed) kinds ignore this — they always use
the Station-wide warm-start depth for their disk/REST seed.
Otherwise identical to Self::add — symbol is canonical and
translated via SymbolNormalizer.
Sourcepub fn add_raw(
self,
exchange: ExchangeId,
symbol: impl Into<String>,
account_type: AccountType,
streams: impl IntoIterator<Item = Stream>,
) -> Self
pub fn add_raw( self, exchange: ExchangeId, symbol: impl Into<String>, account_type: AccountType, streams: impl IntoIterator<Item = Stream>, ) -> Self
Add a subscription with a raw exchange-native symbol. symbol is
passed through to the connector verbatim — no SymbolNormalizer
translation. Use for instrument IDs that don’t fit the canonical
BASE-QUOTE shape:
- Deribit options:
"BTC-23MAY26-86000-C" - Futures with date suffix:
"BTCUSDT_240329" - Index symbols:
".DEFI","BTCUSD-PERP"
The caller is responsible for using the exact wire format the
exchange expects — Event.symbol on the handle will mirror the
raw string back.
Sourcepub fn add_authenticated(
self,
exchange: ExchangeId,
account_type: AccountType,
credentials: Credentials,
streams: impl IntoIterator<Item = Stream>,
) -> Self
pub fn add_authenticated( self, exchange: ExchangeId, account_type: AccountType, credentials: Credentials, streams: impl IntoIterator<Item = Stream>, ) -> Self
Add authenticated (private) streams for (exchange, account_type).
Credentials are forwarded to the WS connector so it can open an
authenticated channel. Multiple add_authenticated calls for the
same (exchange, account_type) pair will create separate entries;
Station’s acquire_or_spawn reuses an already-connected authenticated
WS if one is present in the hub for that pair.
symbol is ignored for account-wide private streams (BalanceUpdate).
Pass an empty string ("") or any placeholder — Event::symbol() for
those variants returns "" or the asset identifier.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for SubscriptionSet
impl Clone for SubscriptionSet
Source§fn clone(&self) -> SubscriptionSet
fn clone(&self) -> SubscriptionSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more