pub struct Ticker { /* private fields */ }Expand description
The primary entry point for querying financial data for a single symbol.
Data is fetched on first access and cached for 60 seconds by default.
Use the builder via Ticker::builder for custom configuration, including
cache and no_cache.
Implementations§
Source§impl Ticker
impl Ticker
Sourcepub async fn new(symbol: impl Into<String>) -> Result<Self>
pub async fn new(symbol: impl Into<String>) -> Result<Self>
Creates a new ticker with default configuration.
Sourcepub fn builder(symbol: impl Into<String>) -> TickerBuilder
pub fn builder(symbol: impl Into<String>) -> TickerBuilder
Creates a new builder for Ticker.
Sourcepub fn client_handle(&self) -> ClientHandle
pub fn client_handle(&self) -> ClientHandle
Returns a handle to the underlying Yahoo Finance session.
Pass to other builders via .client(handle) to share the authenticated
session without a new auth handshake.
§Panics
Panics if this ticker was created via Providers with
no Yahoo provider configured. For session sharing across multiple tickers,
prefer Providers::ticker instead.
Sourcepub async fn quote<F>(&self) -> Result<Quote<F>>
pub async fn quote<F>(&self) -> Result<Quote<F>>
Get full quote data, optionally including logo URLs.
Sourcepub async fn chart(&self, interval: Interval, range: TimeRange) -> Result<Chart>
pub async fn chart(&self, interval: Interval, range: TimeRange) -> Result<Chart>
Get historical OHLCV chart data.
Sourcepub async fn chart_range(
&self,
interval: Interval,
start: i64,
end: i64,
) -> Result<Chart>
pub async fn chart_range( &self, interval: Interval, start: i64, end: i64, ) -> Result<Chart>
Get chart data for a custom start/end timestamp range.
Sourcepub async fn dividend_analytics(
&self,
range: TimeRange,
) -> Result<DividendAnalytics>
pub async fn dividend_analytics( &self, range: TimeRange, ) -> Result<DividendAnalytics>
Compute dividend analytics for the requested time range.
Sourcepub async fn capital_gains(&self, range: TimeRange) -> Result<Vec<CapitalGain>>
pub async fn capital_gains(&self, range: TimeRange) -> Result<Vec<CapitalGain>>
Get capital gains distribution history.
Sourcepub async fn recommendations(&self, limit: u32) -> Result<Recommendation>
pub async fn recommendations(&self, limit: u32) -> Result<Recommendation>
Get analyst recommendations and similar symbols.
Sourcepub async fn news_sentiment(&self) -> Result<Sentiment>
pub async fn news_sentiment(&self) -> Result<Sentiment>
Average sentiment across recent news headlines for this symbol.
Positive = net bullish coverage, negative = net bearish. Returns a neutral, zero-confidence score when there are no headlines.
Only available when the sentiment feature is enabled.
Sourcepub async fn financials(
&self,
stmt_type: StatementType,
frequency: Frequency,
) -> Result<FinancialStatement>
pub async fn financials( &self, stmt_type: StatementType, frequency: Frequency, ) -> Result<FinancialStatement>
Get financial statements.
Sourcepub async fn indicators(
&self,
interval: Interval,
range: TimeRange,
) -> Result<IndicatorsSummary>
pub async fn indicators( &self, interval: Interval, range: TimeRange, ) -> Result<IndicatorsSummary>
Calculate all technical indicators from chart data.
Sourcepub async fn edgar_submissions(&self) -> Result<EdgarSubmissions>
pub async fn edgar_submissions(&self) -> Result<EdgarSubmissions>
Get SEC EDGAR filing history for this symbol.
Always uses EDGAR directly — this is an EDGAR-specific API (CIK-based submission
history and XBRL company facts) that no other provider replicates. For routable
provider-agnostic filing data use filings instead.
Sourcepub async fn edgar_company_facts(&self) -> Result<CompanyFacts>
pub async fn edgar_company_facts(&self) -> Result<CompanyFacts>
Get SEC EDGAR company facts (structured XBRL financial data).
Always uses EDGAR directly — XBRL us-gaap/ifrs/dei fact data is unique
to the SEC’s EDGAR API. For routable filing data use filings.
Sourcepub async fn filings(&self) -> Result<ProviderFilings>
pub async fn filings(&self) -> Result<ProviderFilings>
Fetch SEC filings via the configured Capability::FILINGS provider.
Routes through the provider system; EDGAR is always available as a fallback
(auto-injected when no explicit FILINGS route is set). To prefer Polygon:
.route(Capability::FILINGS, [Provider::Polygon, Provider::Edgar]).
For the full EDGAR submissions response or structured XBRL data, use
edgar_submissions / edgar_company_facts.
Sourcepub async fn short_interest(&self) -> Result<Vec<ShortInterest>>
pub async fn short_interest(&self) -> Result<Vec<ShortInterest>>
Fetch short-interest settlement reports via the configured
Capability::FUNDAMENTALS provider. The default Yahoo route derives
the current and prior-month snapshots from key statistics (keyless);
route to Polygon for the full bi-monthly history:
.route(Capability::FUNDAMENTALS, [Provider::Polygon, Provider::Yahoo]).
Sourcepub async fn short_volume(&self) -> Result<Vec<ShortVolume>>
pub async fn short_volume(&self) -> Result<Vec<ShortVolume>>
Fetch daily short-volume data via the configured
Capability::FUNDAMENTALS provider (currently Polygon only).
Fetch share float and shares outstanding via the configured
Capability::FUNDAMENTALS provider (Yahoo-derived on the default
route; Polygon serves it too).
Sourcepub async fn press_releases(&self, limit: u32) -> Result<Vec<PressRelease>>
pub async fn press_releases(&self, limit: u32) -> Result<Vec<PressRelease>>
Fetch the company’s own press releases via the configured
Capability::CORPORATE provider (currently FMP only). Distinct from
news, which returns press coverage.
Sourcepub async fn price_target_consensus(&self) -> Result<PriceTargetConsensus>
pub async fn price_target_consensus(&self) -> Result<PriceTargetConsensus>
Fetch the aggregated analyst price-target consensus (high/low/mean/median)
via the configured Capability::FUNDAMENTALS provider (currently FMP
only). Route with
.route(Capability::FUNDAMENTALS, [Provider::Fmp, Provider::Yahoo]).
Sourcepub async fn price_target_summary(&self) -> Result<PriceTargetSummary>
pub async fn price_target_summary(&self) -> Result<PriceTargetSummary>
Fetch price-target publication activity over trailing windows (last
month/quarter/year/all time) via the configured
Capability::FUNDAMENTALS provider (currently FMP only).
Sourcepub async fn rating_consensus(&self) -> Result<RatingConsensus>
pub async fn rating_consensus(&self) -> Result<RatingConsensus>
Fetch the aggregated analyst rating consensus (grade distribution plus a
headline label) via the configured Capability::FUNDAMENTALS provider
(currently FMP only). Distinct from
recommendations, which returns similar symbols.
Sourcepub async fn key_metrics_ttm(&self) -> Result<KeyMetricsTtm>
pub async fn key_metrics_ttm(&self) -> Result<KeyMetricsTtm>
Fetch the trailing-twelve-month key-metrics snapshot via the configured
Capability::FUNDAMENTALS provider (currently FMP only).
A TTM snapshot is a single always-current rollup, so callers do not need
to fetch the latest fiscal period and reason about whether it is still
current — see financials for the period series.
Sourcepub async fn ratios_ttm(&self) -> Result<FinancialRatiosTtm>
pub async fn ratios_ttm(&self) -> Result<FinancialRatiosTtm>
Fetch the trailing-twelve-month financial-ratios snapshot via the
configured Capability::FUNDAMENTALS provider (currently FMP only).
Sourcepub async fn executive_compensation(&self) -> Result<Vec<ExecutiveCompensation>>
pub async fn executive_compensation(&self) -> Result<Vec<ExecutiveCompensation>>
Fetch reported executive compensation (most recent fiscal year first)
via the configured Capability::CORPORATE provider (currently FMP
only). Extracted from DEF 14A proxy statements, so it lags the filing.
Sourcepub async fn employee_count(&self) -> Result<Vec<EmployeeCount>>
pub async fn employee_count(&self) -> Result<Vec<EmployeeCount>>
Fetch reported employee headcount history (most recent period first) via
the configured Capability::CORPORATE provider (currently FMP only).
Taken from 10-K cover pages, so it is annual.
Sourcepub async fn etf_profile(&self) -> Result<EtfProfile>
pub async fn etf_profile(&self) -> Result<EtfProfile>
Fetch this fund’s profile and portfolio holdings via the configured
Capability::FUNDAMENTALS provider (currently Alpha Vantage only,
and the only wired source of ETF holdings at all).
Holdings come back heaviest-first. Errors for a symbol that is not a fund.
Sourcepub async fn earnings_surprises(&self) -> Result<Vec<EarningsSurprise>>
pub async fn earnings_surprises(&self) -> Result<Vec<EarningsSurprise>>
Fetch earnings-surprise history (most recent first) via the configured
Capability::FUNDAMENTALS provider (FMP or Alpha Vantage).
Sourcepub async fn grading_actions(&self) -> Result<Vec<GradingAction>>
pub async fn grading_actions(&self) -> Result<Vec<GradingAction>>
Fetch the raw per-analyst grade-action history via the configured
Capability::FUNDAMENTALS provider (currently FMP only). Distinct
from rating_consensus, which returns the
aggregated rollup over this same history.
Sourcepub async fn company_profile(&self) -> Result<CompanyProfile>
pub async fn company_profile(&self) -> Result<CompanyProfile>
Fetch the company’s identity/classification profile via the
configured Capability::FUNDAMENTALS provider (currently Alpha
Vantage only).
Sourcepub async fn earnings_transcript(
&self,
quarter: Option<&str>,
year: Option<i32>,
) -> Result<EarningsTranscript>
pub async fn earnings_transcript( &self, quarter: Option<&str>, year: Option<i32>, ) -> Result<EarningsTranscript>
Fetch an earnings call transcript, provider-neutral shape, via the
configured Capability::CORPORATE provider (Yahoo or Alpha
Vantage). quarter and year narrow to a specific call; Alpha
Vantage requires both, Yahoo defaults to the latest when omitted.
Distinct from the Yahoo-only, richer
finance::earnings_transcript.
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>
Calculate a specific technical indicator over a time range.
Sourcepub async fn backtest<S: Strategy>(
&self,
strategy: S,
interval: Interval,
range: TimeRange,
config: Option<BacktestConfig>,
) -> Result<BacktestResult>
pub async fn backtest<S: Strategy>( &self, strategy: S, interval: Interval, range: TimeRange, config: Option<BacktestConfig>, ) -> Result<BacktestResult>
Run a backtest with the given strategy and configuration.
Sourcepub async fn backtest_with_benchmark<S: Strategy>(
&self,
strategy: S,
interval: Interval,
range: TimeRange,
config: Option<BacktestConfig>,
benchmark: &str,
) -> Result<BacktestResult>
pub async fn backtest_with_benchmark<S: Strategy>( &self, strategy: S, interval: Interval, range: TimeRange, config: Option<BacktestConfig>, benchmark: &str, ) -> Result<BacktestResult>
Run a backtest and compare performance against a benchmark symbol.
Sourcepub async fn risk(
&self,
interval: Interval,
range: TimeRange,
benchmark: Option<&str>,
) -> Result<RiskSummary>
pub async fn risk( &self, interval: Interval, range: TimeRange, benchmark: Option<&str>, ) -> Result<RiskSummary>
Compute a risk summary for this symbol.
Sourcepub async fn calendar(&self, range: TimeRange) -> Result<Vec<CalendarEvent>>
pub async fn calendar(&self, range: TimeRange) -> Result<Vec<CalendarEvent>>
Aggregate upcoming financial events for this ticker into a single time-sorted list.
Combines earnings, ex-dividend and dividend-payment dates with standard
monthly options expirations, plus — when the fred feature is enabled —
a curated set of major economic releases (CPI, NFP, GDP, …). Limited to
the forward window [now, now + range] and sorted ascending by
timestamp.
Options are best-effort: a symbol with no listed options contributes no expiration events rather than failing the call.
Source§impl Ticker
impl Ticker
Sourcepub async fn price(&self) -> Result<Option<Price>>
pub async fn price(&self) -> Result<Option<Price>>
Regular, pre- and post-market price, plus the day’s range and volume.
pub async fn summary_detail(&self) -> Result<Option<SummaryDetail>>
pub async fn financial_data(&self) -> Result<Option<FinancialData>>
pub async fn key_stats(&self) -> Result<Option<DefaultKeyStatistics>>
pub async fn asset_profile(&self) -> Result<Option<AssetProfile>>
pub async fn calendar_events(&self) -> Result<Option<CalendarEvents>>
pub async fn earnings(&self) -> Result<Option<Earnings>>
pub async fn earnings_trend(&self) -> Result<Option<EarningsTrend>>
pub async fn earnings_history(&self) -> Result<Option<EarningsHistory>>
pub async fn recommendation_trend(&self) -> Result<Option<RecommendationTrend>>
pub async fn insider_holders(&self) -> Result<Option<InsiderHolders>>
pub async fn insider_transactions(&self) -> Result<Option<InsiderTransactions>>
pub async fn institution_ownership( &self, ) -> Result<Option<InstitutionOwnership>>
pub async fn fund_ownership(&self) -> Result<Option<FundOwnership>>
pub async fn major_holders(&self) -> Result<Option<MajorHoldersBreakdown>>
pub async fn quote_type(&self) -> Result<Option<QuoteTypeData>>
pub async fn summary_profile(&self) -> Result<Option<SummaryProfile>>
pub async fn sec_filings(&self) -> Result<Option<SecFilings>>
pub async fn grading_history(&self) -> Result<Option<UpgradeDowngradeHistory>>
pub async fn fund_performance(&self) -> Result<Option<FundPerformance>>
pub async fn fund_profile(&self) -> Result<Option<FundProfile>>
pub async fn top_holdings(&self) -> Result<Option<TopHoldings>>
pub async fn index_trend(&self) -> Result<Option<IndexTrend>>
pub async fn industry_trend(&self) -> Result<Option<IndustryTrend>>
pub async fn sector_trend(&self) -> Result<Option<SectorTrend>>
pub async fn equity_performance(&self) -> Result<Option<EquityPerformance>>
Auto Trait Implementations§
impl !Freeze for Ticker
impl !RefUnwindSafe for Ticker
impl !UnwindSafe for Ticker
impl Send for Ticker
impl Sync for Ticker
impl Unpin for Ticker
impl UnsafeUnpin for Ticker
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