pub struct YahooFinanceClient { /* private fields */ }Expand description
Main client for Yahoo Finance API requests.
This client handles authenticated requests to Yahoo Finance, automatically managing crumb tokens and retrying on auth failures.
Implementations§
Source§impl YahooFinanceClient
impl YahooFinanceClient
Sourcepub fn new(
auth_manager: Arc<YahooAuthManager>,
fetch_client: Arc<FetchClient>,
) -> Self
pub fn new( auth_manager: Arc<YahooAuthManager>, fetch_client: Arc<FetchClient>, ) -> Self
Create a new YahooFinanceClient.
§Arguments
auth_manager- Shared authentication managerfetch_client- Shared HTTP client
Sourcepub fn fetch_client(&self) -> Arc<FetchClient> ⓘ
pub fn fetch_client(&self) -> Arc<FetchClient> ⓘ
Expose the underlying fetch client for auxiliary HTTP calls (e.g., logo fetching).
Sourcepub async fn get_quote(&self, symbol: &str) -> Result<Value, YahooError>
pub async fn get_quote(&self, symbol: &str) -> Result<Value, YahooError>
Get detailed quote data for a symbol.
Sourcepub async fn get_simple_quotes(
&self,
symbols: &[&str],
) -> Result<Value, YahooError>
pub async fn get_simple_quotes( &self, symbols: &[&str], ) -> Result<Value, YahooError>
Get simple quote data for multiple symbols.
Sourcepub async fn get_chart(
&self,
symbol: &str,
interval: &str,
range: &str,
) -> Result<Value, YahooError>
pub async fn get_chart( &self, symbol: &str, interval: &str, range: &str, ) -> Result<Value, YahooError>
Get chart data for a symbol.
Sourcepub async fn get_chart_with_periods(
&self,
symbol: &str,
interval: &str,
period1: i64,
period2: i64,
) -> Result<Value, YahooError>
pub async fn get_chart_with_periods( &self, symbol: &str, interval: &str, period1: i64, period2: i64, ) -> Result<Value, YahooError>
Get chart data using period1 and period2 (Unix timestamps) instead of range.
Sourcepub async fn search(
&self,
query: &str,
hits: usize,
) -> Result<Value, YahooError>
pub async fn search( &self, query: &str, hits: usize, ) -> Result<Value, YahooError>
Search for symbols.
Sourcepub async fn get_similar_quotes(
&self,
symbol: &str,
limit: usize,
) -> Result<Value, YahooError>
pub async fn get_similar_quotes( &self, symbol: &str, limit: usize, ) -> Result<Value, YahooError>
Get similar/recommended quotes for a symbol.
Sourcepub async fn get_fundamentals_timeseries(
&self,
symbol: &str,
period1: i64,
period2: i64,
types: &[&str],
) -> Result<Value, YahooError>
pub async fn get_fundamentals_timeseries( &self, symbol: &str, period1: i64, period2: i64, types: &[&str], ) -> Result<Value, YahooError>
Get fundamentals timeseries data.
Sourcepub async fn get_quote_summary(
&self,
symbol: &str,
modules: &[&str],
) -> Result<Value, YahooError>
pub async fn get_quote_summary( &self, symbol: &str, modules: &[&str], ) -> Result<Value, YahooError>
Get quote summary with specified modules.
Sourcepub async fn get_quote_type(&self, symbol: &str) -> Result<Value, YahooError>
pub async fn get_quote_type(&self, symbol: &str) -> Result<Value, YahooError>
Get quote type information.
Sourcepub async fn get_earnings_transcript(
&self,
event_id: &str,
company_id: &str,
) -> Result<Value, YahooError>
pub async fn get_earnings_transcript( &self, event_id: &str, company_id: &str, ) -> Result<Value, YahooError>
Get earnings transcript.
Sourcepub async fn make_request(
&self,
url: &str,
params: Option<&[(&str, &str)]>,
) -> Result<Response, YahooError>
pub async fn make_request( &self, url: &str, params: Option<&[(&str, &str)]>, ) -> Result<Response, YahooError>
Make a Yahoo Finance API request and return the raw response. This is useful for endpoints that need custom handling.
Sourcepub async fn get_actions(
&self,
symbol: &str,
period: &str,
) -> Result<ActionsResponse, YahooError>
pub async fn get_actions( &self, symbol: &str, period: &str, ) -> Result<ActionsResponse, YahooError>
Sourcepub async fn get_dividends(
&self,
symbol: &str,
period: &str,
) -> Result<Vec<Dividend>, YahooError>
pub async fn get_dividends( &self, symbol: &str, period: &str, ) -> Result<Vec<Dividend>, YahooError>
Get only dividends for a symbol
Sourcepub async fn get_splits(
&self,
symbol: &str,
period: &str,
) -> Result<Vec<StockSplit>, YahooError>
pub async fn get_splits( &self, symbol: &str, period: &str, ) -> Result<Vec<StockSplit>, YahooError>
Get only stock splits for a symbol
Sourcepub async fn get_capital_gains(
&self,
symbol: &str,
period: &str,
) -> Result<Vec<CapitalGain>, YahooError>
pub async fn get_capital_gains( &self, symbol: &str, period: &str, ) -> Result<Vec<CapitalGain>, YahooError>
Get only capital gains for a symbol
Sourcepub async fn get_option_chain(
&self,
symbol: &str,
date: Option<&str>,
) -> Result<OptionChain, YahooError>
pub async fn get_option_chain( &self, symbol: &str, date: Option<&str>, ) -> Result<OptionChain, YahooError>
Get option chain for a symbol and expiration date
§Arguments
symbol- The stock symboldate- Optional expiration date (YYYY-MM-DD). If None, returns nearest expiration
§Example
let chain = client.get_option_chain("AAPL", Some("2025-12-19")).await?;
println!("Calls: {}, Puts: {}", chain.calls.len(), chain.puts.len());Sourcepub async fn get_option_expirations(
&self,
symbol: &str,
) -> Result<OptionExpirations, YahooError>
pub async fn get_option_expirations( &self, symbol: &str, ) -> Result<OptionExpirations, YahooError>
Sourcepub async fn get_calendar(&self, symbol: &str) -> Result<Calendar, YahooError>
pub async fn get_calendar(&self, symbol: &str) -> Result<Calendar, YahooError>
Sourcepub async fn get_sec_filings(
&self,
symbol: &str,
) -> Result<SecFilingsResponse, YahooError>
pub async fn get_sec_filings( &self, symbol: &str, ) -> Result<SecFilingsResponse, YahooError>
Sourcepub async fn get_sustainability(
&self,
symbol: &str,
) -> Result<SustainabilityScores, YahooError>
pub async fn get_sustainability( &self, symbol: &str, ) -> Result<SustainabilityScores, YahooError>
Sourcepub async fn get_industry(
&self,
industry_key: &str,
) -> Result<Industry, YahooError>
pub async fn get_industry( &self, industry_key: &str, ) -> Result<Industry, YahooError>
Sourcepub async fn get_market_status(
&self,
market: &str,
) -> Result<MarketStatus, YahooError>
pub async fn get_market_status( &self, market: &str, ) -> Result<MarketStatus, YahooError>
Sourcepub async fn get_market_summary(
&self,
market: &str,
) -> Result<MarketSummaryResponse, YahooError>
pub async fn get_market_summary( &self, market: &str, ) -> Result<MarketSummaryResponse, YahooError>
Sourcepub async fn get_movers(
&self,
count: MoverCount,
) -> Result<(Vec<MarketMover>, Vec<MarketMover>, Vec<MarketMover>), YahooError>
pub async fn get_movers( &self, count: MoverCount, ) -> Result<(Vec<MarketMover>, Vec<MarketMover>, Vec<MarketMover>), YahooError>
Get market movers (most active, gainers, losers)
§Arguments
count- Number of movers to return (25, 50, or 100)
§Example
use finance_query_core::MoverCount;
let (actives, gainers, losers) = client.get_movers(MoverCount::Fifty).await?;
println!("Top gainer: {} ({:+})", gainers[0].name, gainers[0].percent_change);