pub struct Index { /* private fields */ }Expand description
A stock market index backed by configured data providers.
Created via Providers::index.
Implementations§
Source§impl Index
impl Index
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 Index
impl Index
Sourcepub async fn quote(&self) -> Result<IndexQuote>
pub async fn quote(&self) -> Result<IndexQuote>
Fetch the current quote for this index.
Sourcepub async fn chart(&self, interval: Interval, range: TimeRange) -> Result<Chart>
pub async fn chart(&self, interval: Interval, range: TimeRange) -> Result<Chart>
Fetch historical OHLCV candles for this index.
The symbol is passed to the CHART route as-is, so it should be in the
form the route expects (e.g. Yahoo index symbols like ^GSPC).
Sourcepub async fn history(&self, range: TimeRange) -> Result<Chart>
pub async fn history(&self, range: TimeRange) -> Result<Chart>
Fetch historical candles over range at a sensible default interval
(TimeRange::default_interval).
Sourcepub async fn constituents(&self) -> Result<Vec<IndexConstituent>>
pub async fn constituents(&self) -> Result<Vec<IndexConstituent>>
Fetch the index’s current constituents (major indices only). Not cached — constituent lists change rarely but the call is uncommon.
Sourcepub async fn constituent_changes(&self) -> Result<Vec<IndexConstituentChange>>
pub async fn constituent_changes(&self) -> Result<Vec<IndexConstituentChange>>
Fetch historical changes to the index’s constituency (currently S&P 500 only on FMP).
Source§impl Index
impl Index
Sourcepub async fn indicators(
&self,
interval: Interval,
range: TimeRange,
) -> Result<IndicatorsSummary>
pub async fn indicators( &self, interval: Interval, range: TimeRange, ) -> Result<IndicatorsSummary>
Compute all technical indicators from this handle’s chart data.
Sourcepub async fn indicator(
&self,
indicator: Indicator,
interval: Interval,
range: TimeRange,
) -> Result<IndicatorResult>
pub async fn indicator( &self, indicator: Indicator, interval: Interval, range: TimeRange, ) -> Result<IndicatorResult>
Compute a single technical indicator from this handle’s chart data.
Sourcepub async fn risk(
&self,
interval: Interval,
range: TimeRange,
) -> Result<RiskSummary>
pub async fn risk( &self, interval: Interval, range: TimeRange, ) -> Result<RiskSummary>
Compute a risk summary (VaR, Sharpe/Sortino/Calmar, max drawdown)
from this handle’s chart data. Annualised with this asset class’s
trading calendar, so non-daily intervals scale correctly. beta
is always None (no benchmark for non-equity handles).
Auto Trait Implementations§
impl !Freeze for Index
impl !RefUnwindSafe for Index
impl !UnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
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