Expand description
Async Rust client for Yahoo Finance.
This crate is a port of the popular Python yfinance
library. It provides access to Yahoo Finance market data: quotes, historical OHLCV,
fundamentals, holders, options chains, search, and more.
§Quick start
use yfinance::{YfClient, Ticker, Period, Interval};
let client = YfClient::new()?;
let ticker = Ticker::new(&client, "AAPL");
// 1 month of daily candles
let history = ticker
.history()
.period(Period::M1)
.interval(Interval::D1)
.auto_adjust(true)
.fetch()
.await?;
for row in &history.rows {
println!("{} O={} H={} L={} C={} V={}",
row.timestamp, row.open, row.high, row.low, row.close, row.volume);
}
// Fundamentals
let info = ticker.info().await?;
println!("{}: {}", info.symbol, info.long_name.unwrap_or_default());§Disclaimer
This library is not affiliated with, endorsed, or vetted by Yahoo, Inc. It uses Yahoo’s publicly available APIs. Use at your own risk and respect their terms of service.
Re-exports§
pub use analysis::EarningsEstimate;pub use analysis::EarningsTrendRow;pub use analysis::EpsRevisions;pub use analysis::EpsTrend;pub use analysis::PriceTarget;pub use analysis::RecommendationRow;pub use analysis::RecommendationSummary;pub use analysis::RevenueEstimate;pub use analysis::UpgradeDowngradeRow;pub use calendar::Calendar;pub use client::ApiPreference;pub use client::CacheMode;pub use client::RetryConfig;pub use client::YfClient;pub use client::YfClientBuilder;pub use domain::Industry;pub use domain::Market;pub use domain::Sector;pub use download::download;pub use download::DownloadBuilder;pub use download::MultiHistory;pub use earnings::Earnings;pub use earnings::EarningsEps;pub use earnings::EarningsQuarter;pub use earnings::EarningsYear;pub use error::Error;pub use error::Result;pub use esg::EsgInvolvement;pub use esg::EsgScores;pub use esg::EsgSummary;pub use history::Action;pub use history::History;pub use history::HistoryBuilder;pub use history::OhlcvRow;pub use info::Info;pub use lookup::Lookup;pub use lookup::LookupBuilder;pub use lookup::LookupRow;pub use lookup::LookupType;pub use news::NewsArticle;pub use news::NewsBuilder;pub use news::NewsTab;pub use options::OptionChain;pub use options::OptionContract;pub use profile::Address;pub use profile::CompanyProfile;pub use profile::FundProfile;pub use profile::Profile;pub use quote::batch as batch_quotes;pub use quote::FastInfo;pub use quote::Quote;pub use repair::repair_history;pub use repair::RepairReport;pub use search::Search;pub use search::SearchBuilder;pub use search::SearchNews;pub use search::SearchQuote;pub use ticker::Ticker;pub use types::Interval;pub use types::Period;
Modules§
- analysis
- Analyst data: recommendations, price targets, upgrades/downgrades, earnings trend.
- calendar
- Calendar events: next earnings dates, ex-dividend, dividend-payment date.
- client
- HTTP client with cookie + crumb session management.
- dataframe
dataframe - Polars
DataFrameconversions (dataframefeature). - domain
- Market / Sector / Industry domain objects.
- download
- Multi-ticker batch download with bounded concurrency.
- earnings
- Earnings — actual vs estimated EPS by quarter, plus yearly/quarterly revenue and earnings totals.
- error
- Error and result types.
- esg
- ESG / sustainability scores via Yahoo’s
esgScoresquoteSummary module. - fundamentals
- Financial statements via the timeseries endpoint.
- history
- Historical OHLCV (
v8/finance/chart). - holders
- Ownership and insider data via
quoteSummary. - info
- Full company / fund info from
quoteSummary. - isin
- ISIN lookup via the Business Insider suggest endpoint.
- lookup
- Yahoo Finance lookup (
v1/finance/lookup). - news
- Yahoo Finance company-news feed.
- options
- Options chain (
v7/finance/options). - profile
- Company / fund profile via the
quoteSummarymodulesassetProfile,quoteType, andfundProfile. - quote
- Lightweight quote endpoint (
v7/finance/quote) andFastInfo. - repair
- Local-only repair passes for
History. - search
- Yahoo Finance search.
- shares
- Historical shares outstanding (annual or quarterly).
- stream
stream - Real-time quote streaming (
streamfeature). - test_
fixtures - Fixture recording helpers — gated behind the
test-modefeature. - ticker
Ticker— entry point for everything about a single symbol.- types
- Shared enums:
PeriodandInterval.
Functions§
- init_
tracing_ bridge tracing - Forward our internal
logevents to thetracingecosystem. Idempotent — safe to call multiple times. No-op without thetracingfeature. - init_
tracing_ for_ tests tracing-subscriber - Initialise a default
tracing-subscriberfor tests / examples. ReadsRUST_LOGfor the env-filter and falls back toinfo. Available with thetracing-subscriberfeature.