pub struct StreamClient { /* private fields */ }Implementations§
Source§impl StreamClient
impl StreamClient
pub fn new( config: StreamConfig, auth_manager: AuthManager, identity: StreamerIdentity, ) -> Result<Self>
pub fn with_coordinator(self, coordinator: Arc<dyn Coordinator>) -> Result<Self>
Sourcepub async fn subscribe_level_one_equities(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_level_one_equities(&self, symbols: &[&str]) -> Result<()>
Convenience: subscribe to Level One Equities for given symbols
Sourcepub async fn unsubscribe_level_one_equities(
&self,
symbols: &[&str],
) -> Result<()>
pub async fn unsubscribe_level_one_equities( &self, symbols: &[&str], ) -> Result<()>
Convenience: unsubscribe from Level One Equities for given symbols
Sourcepub async fn subscribe_level_one_options(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_level_one_options(&self, symbols: &[&str]) -> Result<()>
Convenience: subscribe to Level One Options
pub async fn unsubscribe_level_one_options( &self, symbols: &[&str], ) -> Result<()>
Sourcepub async fn subscribe_level_one_futures(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_level_one_futures(&self, symbols: &[&str]) -> Result<()>
Convenience: subscribe to Level One Futures
pub async fn unsubscribe_level_one_futures( &self, symbols: &[&str], ) -> Result<()>
Sourcepub async fn subscribe_level_one_futures_options(
&self,
symbols: &[&str],
) -> Result<()>
pub async fn subscribe_level_one_futures_options( &self, symbols: &[&str], ) -> Result<()>
Convenience: subscribe to Level One Futures Options
pub async fn unsubscribe_level_one_futures_options( &self, symbols: &[&str], ) -> Result<()>
Sourcepub async fn subscribe_level_one_forex(&self, pairs: &[&str]) -> Result<()>
pub async fn subscribe_level_one_forex(&self, pairs: &[&str]) -> Result<()>
Convenience: subscribe to Level One Forex
pub async fn unsubscribe_level_one_forex(&self, pairs: &[&str]) -> Result<()>
Sourcepub async fn subscribe_nyse_book(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_nyse_book(&self, symbols: &[&str]) -> Result<()>
Convenience: subscribe to order book services
pub async fn unsubscribe_nyse_book(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_nasdaq_book(&self, symbols: &[&str]) -> Result<()>
pub async fn unsubscribe_nasdaq_book(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_options_book(&self, contracts: &[&str]) -> Result<()>
pub async fn unsubscribe_options_book(&self, contracts: &[&str]) -> Result<()>
Sourcepub async fn subscribe_chart_equity(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_chart_equity(&self, symbols: &[&str]) -> Result<()>
Convenience: subscribe to chart services
pub async fn unsubscribe_chart_equity(&self, symbols: &[&str]) -> Result<()>
pub async fn subscribe_chart_futures(&self, symbols: &[&str]) -> Result<()>
pub async fn unsubscribe_chart_futures(&self, symbols: &[&str]) -> Result<()>
Sourcepub async fn subscribe_screener_equity(&self, keys: &[&str]) -> Result<()>
pub async fn subscribe_screener_equity(&self, keys: &[&str]) -> Result<()>
Convenience: subscribe to screeners
pub async fn unsubscribe_screener_equity(&self, keys: &[&str]) -> Result<()>
pub async fn subscribe_screener_option(&self, keys: &[&str]) -> Result<()>
pub async fn unsubscribe_screener_option(&self, keys: &[&str]) -> Result<()>
Sourcepub async fn subscribe_account_activity(&self) -> Result<()>
pub async fn subscribe_account_activity(&self) -> Result<()>
Convenience: account activity (fixed key)
pub async fn unsubscribe_account_activity(&self) -> Result<()>
pub fn builder() -> StreamClientBuilder
Sourcepub fn set_service_fields(&self, service: StreamService, fields_csv: String)
pub fn set_service_fields(&self, service: StreamService, fields_csv: String)
Set service-specific field IDs (comma-separated) for later
subscriptions and reconnects. Keys already streaming keep their
fields; use StreamClient::view to change those.
Sourcepub async fn view(
&self,
service: StreamService,
fields_csv: String,
) -> Result<()>
pub async fn view( &self, service: StreamService, fields_csv: String, ) -> Result<()>
Change the fields streamed for every subscribed key of service now
(Schwab’s VIEW command), and for later subscriptions and
reconnects. With nothing subscribed on the service this only records
the fields, like StreamClient::set_service_fields.
Account activity has a fixed field set and no VIEW; it is refused.
pub async fn connect(&self) -> Result<()>
Sourcepub async fn disconnect(&self)
pub async fn disconnect(&self)
Stop the reconnect loop and close the underlying socket.
Sends a best-effort ADMIN/LOGOUT first (as the reference client
does) so the streamer can release the session promptly.
Idempotent. After calling disconnect, a subsequent connect
will spin up a fresh loop.
Sourcepub async fn subscribe(
&self,
service: StreamService,
symbols: Vec<String>,
) -> Result<()>
pub async fn subscribe( &self, service: StreamService, symbols: Vec<String>, ) -> Result<()>
Subscribe to service for the given keys.
Uses the streamer ADD command (additive), matching the reference
client — SUBS would replace the service’s entire key list
server-side, silently dropping earlier subscriptions while the
local tracker still believed they were active. Account activity,
which has one fixed key, uses SUBS as Schwab documents.
pub async fn unsubscribe( &self, service: StreamService, symbols: Vec<String>, ) -> Result<()>
Sourcepub fn get_receiver(&self) -> Option<MessageReceiver>
pub fn get_receiver(&self) -> Option<MessageReceiver>
Get the message receiver for streaming messages
Returns the receiver for reading streaming messages. Can only be called once as it takes ownership of the receiver.
The receiver type (bounded or unbounded) is determined by the channel_kind
configuration setting.
pub fn confirmed_subscriptions(&self) -> HashMap<String, Vec<String>>
pub fn status(&self) -> StreamStatus
pub fn is_running(&self) -> bool
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Logged in to the streamer on a live socket. Unlike
StreamStatus::ready, this holds while a slow consumer’s queue has
overflowed, since the connection stays up and takes requests.
Trait Implementations§
Source§impl Clone for StreamClient
impl Clone for StreamClient
Auto Trait Implementations§
impl !RefUnwindSafe for StreamClient
impl !UnwindSafe for StreamClient
impl Freeze for StreamClient
impl Send for StreamClient
impl Sync for StreamClient
impl Unpin for StreamClient
impl UnsafeUnpin for StreamClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more