pub struct MoversStream;Expand description
A stream that yields market movers (actives, gainers, losers) at regular intervals.
Implementations§
Source§impl MoversStream
impl MoversStream
Sourcepub fn create(
client: Arc<YahooFinanceClient>,
count: MoverCount,
poll_interval: Duration,
) -> Pin<Box<dyn Stream<Item = Result<MoversUpdate, YahooError>> + Send>>
pub fn create( client: Arc<YahooFinanceClient>, count: MoverCount, poll_interval: Duration, ) -> Pin<Box<dyn Stream<Item = Result<MoversUpdate, YahooError>> + Send>>
Create a new movers stream that fetches market movers at the specified interval.
§Arguments
client- The Yahoo Finance client to use for fetching datacount- Number of movers to return (25, 50, or 100)poll_interval- How often to fetch new data
§Example
ⓘ
use finance_query_core::{MoversStream, YahooFinanceClient, MoverCount};
use std::time::Duration;
use futures_util::StreamExt;
let stream = MoversStream::create(&client, MoverCount::Fifty, Duration::from_secs(5));
while let Some(result) = stream.next().await {
match result {
Ok(update) => {
println!("Actives: {}", update.actives.len());
println!("Gainers: {}", update.gainers.len());
println!("Losers: {}", update.losers.len());
}
Err(e) => eprintln!("Error: {}", e),
}
}Sourcepub fn with_default_interval(
client: Arc<YahooFinanceClient>,
count: MoverCount,
) -> Pin<Box<dyn Stream<Item = Result<MoversUpdate, YahooError>> + Send>>
pub fn with_default_interval( client: Arc<YahooFinanceClient>, count: MoverCount, ) -> Pin<Box<dyn Stream<Item = Result<MoversUpdate, YahooError>> + Send>>
Create a movers stream with a default 5-second interval.
Sourcepub fn with_defaults(
client: Arc<YahooFinanceClient>,
) -> Pin<Box<dyn Stream<Item = Result<MoversUpdate, YahooError>> + Send>>
pub fn with_defaults( client: Arc<YahooFinanceClient>, ) -> Pin<Box<dyn Stream<Item = Result<MoversUpdate, YahooError>> + Send>>
Create a movers stream with default count (50) and interval (5 seconds).
Auto Trait Implementations§
impl Freeze for MoversStream
impl RefUnwindSafe for MoversStream
impl Send for MoversStream
impl Sync for MoversStream
impl Unpin for MoversStream
impl UnsafeUnpin for MoversStream
impl UnwindSafe for MoversStream
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
Mutably borrows from an owned value. Read more