pub struct Snapshot { /* private fields */ }Expand description
Snapshots for a watchlist spanning several asset classes, from one request.
Routes through Capability::QUOTE. Unlike
Tickers — which is equity-shaped and returns full quote
summaries — this takes provider-spelled symbols from any market ("AAPL",
"X:BTCUSD", "I:SPX", "C:EURUSD", "O:NCLH221014C00005000") and
returns one flattened row each. Polygon is currently the only provider whose
snapshot endpoint spans markets.
Created via Providers::snapshot.
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn cache(self, ttl: Duration) -> Self
pub fn cache(self, ttl: Duration) -> Self
Cache responses for ttl instead of the default 60 seconds,
deduplicating concurrent identical requests.
Sourcepub fn cache_forever(self) -> Self
pub fn cache_forever(self) -> Self
Cache responses for the handle’s lifetime instead of the default 60 seconds.
Source§impl Snapshot
impl Snapshot
Sourcepub async fn get<S: AsRef<str>>(
&self,
symbols: &[S],
) -> Result<Vec<MarketSnapshot>>
pub async fn get<S: AsRef<str>>( &self, symbols: &[S], ) -> Result<Vec<MarketSnapshot>>
Fetch snapshots for symbols, which may span asset classes.
Cached per symbol list. Symbols the provider could not resolve come back
as rows with MarketSnapshot::error set rather than being dropped, so
the result can be aligned with the request.
Auto Trait Implementations§
impl !Freeze for Snapshot
impl !RefUnwindSafe for Snapshot
impl !UnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshot
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> 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