Skip to main content

SubscriptionSet

Struct SubscriptionSet 

Source
pub struct SubscriptionSet { /* private fields */ }
Expand description

Declarative subscription request — built up fluently, consumed by crate::Station::subscribe.

Implementations§

Source§

impl SubscriptionSet

Source

pub fn new() -> Self

Source

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.).

Source

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::addsymbol is canonical and translated via SymbolNormalizer.

Source

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.

Source

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.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Clone for SubscriptionSet

Source§

fn clone(&self) -> SubscriptionSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SubscriptionSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SubscriptionSet

Source§

fn default() -> SubscriptionSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more