finance_query/domains/indices.rs
1//! Stock market index quote handle.
2//!
3//! Created via [`Providers::index`](crate::Providers::index).
4
5use crate::error::Result;
6
7domain_handle! {
8 /// A stock market index backed by configured data providers.
9 ///
10 /// Created via [`Providers::index`](crate::Providers::index).
11 pub struct Index { symbol, symbol }
12 cache: crate::models::indices::IndexQuote
13}
14
15impl Index {
16 /// Fetch the current quote for this index.
17 pub async fn quote(&self) -> Result<crate::models::indices::IndexQuote> {
18 fetch_via!(
19 self,
20 symbol,
21 INDICES,
22 fetch_indices_quote,
23 crate::models::indices::IndexQuote
24 )
25 }
26}