pub struct Commodity { /* private fields */ }Expand description
A commodity backed by configured data providers.
Created via Providers::commodity.
Implementations§
Source§impl Commodity
impl Commodity
Sourcepub async fn quote(&self) -> Result<CommodityQuote>
pub async fn quote(&self) -> Result<CommodityQuote>
Fetch the current quote for this commodity.
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 commodity.
The symbol is passed to the CHART route as-is. Note this expects the
route’s chart-symbol form (e.g. the Yahoo futures symbol GC=F for
gold), which differs from the commodity names (WHEAT) some providers
use for quote.
Source§impl Commodity
impl Commodity
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 Commodity
impl !RefUnwindSafe for Commodity
impl !UnwindSafe for Commodity
impl Send for Commodity
impl Sync for Commodity
impl Unpin for Commodity
impl UnsafeUnpin for Commodity
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
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