Ticker#
- class yfinance.Ticker(ticker, session=None)#
Initialize a Yahoo Finance Ticker object.
- Parameters:
ticker (str | tuple[str, str]) – Yahoo Finance symbol (e.g. “AAPL”) or a tuple of (symbol, MIC) e.g. (‘OR’,’XPAR’) (MIC = market identifier code)
session (requests.Session, optional) – Custom requests session.
Attributes
- actions
- analyst_price_targets
- balance_sheet
- balancesheet
- calendar
Returns a dictionary of events, earnings, and dividends for the ticker
- capital_gains
- cash_flow
- cashflow
- dividends
- earnings
- earnings_dates
- earnings_estimate
- earnings_history
- eps_revisions
- eps_trend
- fast_info
- financials
- funds_data
- growth_estimates
- history_metadata
- income_stmt
- incomestmt
- info
- insider_purchases
- insider_roster_holders
- insider_transactions
- institutional_holders
- isin
- major_holders
- mutualfund_holders
- news
- options
- quarterly_balance_sheet
- quarterly_balancesheet
- quarterly_cash_flow
- quarterly_cashflow
- quarterly_earnings
- quarterly_financials
- quarterly_income_stmt
- quarterly_incomestmt
- recommendations
- recommendations_summary
- revenue_estimate
- sec_filings
- shares
- splits
- sustainability
- ttm_cash_flow
- ttm_cashflow
- ttm_financials
- ttm_income_stmt
- ttm_incomestmt
- upgrades_downgrades
- valuation
Methods
- __init__(ticker, session=None)
Initialize a Yahoo Finance Ticker object.
- Parameters:
ticker (str | tuple[str, str]) – Yahoo Finance symbol (e.g. “AAPL”) or a tuple of (symbol, MIC) e.g. (‘OR’,’XPAR’) (MIC = market identifier code)
session (requests.Session, optional) – Custom requests session.
- get_actions(period='max') Series
- get_analyst_price_targets() dict
Keys: current low high mean median
- get_balance_sheet(as_dict=False, pretty=False, freq='yearly')
- Parameters:
- as_dict: bool
Return table as Python dict Default is False
- pretty: bool
Format row names nicely for readability Default is False
- freq: str
“yearly” or “quarterly” Default is “yearly”
- get_balancesheet(as_dict=False, pretty=False, freq='yearly')
- get_calendar() dict
- get_capital_gains(period='max') Series
- get_cash_flow(as_dict=False, pretty=False, freq='yearly') DataFrame | dict
- Parameters:
- as_dict: bool
Return table as Python dict Default is False
- pretty: bool
Format row names nicely for readability Default is False
- freq: str
“yearly” or “quarterly” Default is “yearly”
- get_cashflow(as_dict=False, pretty=False, freq='yearly')
- get_dividends(period='max') Series
- get_earnings(as_dict=False, freq='yearly')
- Parameters:
- as_dict: bool
Return table as Python dict Default is False
- freq: str
“yearly” or “quarterly” or “trailing” Default is “yearly”
- get_earnings_dates(limit=12, offset=0) DataFrame | None
- get_earnings_estimate(as_dict=False)
Index: 0q +1q 0y +1y Columns: numberOfAnalysts avg low high yearAgoEps growth
- get_earnings_history(as_dict=False)
Index: pd.DatetimeIndex Columns: epsEstimate epsActual epsDifference surprisePercent
- get_eps_revisions(as_dict=False)
Index: 0q +1q 0y +1y Columns: upLast7days upLast30days downLast7days downLast30days
- get_eps_trend(as_dict=False)
Index: 0q +1q 0y +1y Columns: current 7daysAgo 30daysAgo 60daysAgo 90daysAgo
- get_fast_info()
- get_financials(as_dict=False, pretty=False, freq='yearly')
- get_funds_data() FundsData | None
- get_growth_estimates(as_dict=False)
Index: 0q +1q 0y +1y +5y -5y Columns: stock industry sector index
- get_history_metadata(repair=<object object>) dict
repair default value depends on whether user requested price repair with previous history() call. If user did not set repair here, then it is set to match previous history() call.
- get_income_stmt(as_dict=False, pretty=False, freq='yearly')
- Parameters:
- as_dict: bool
Return table as Python dict Default is False
- pretty: bool
Format row names nicely for readability Default is False
- freq: str
“yearly” or “quarterly” or “trailing” Default is “yearly”
- get_incomestmt(as_dict=False, pretty=False, freq='yearly')
- get_info() dict
- get_insider_purchases(as_dict=False)
- get_insider_roster_holders(as_dict=False)
- get_insider_transactions(as_dict=False)
- get_institutional_holders(as_dict=False)
- get_isin() str | None
- get_major_holders(as_dict=False)
- get_mutualfund_holders(as_dict=False)
- get_news(count=10, tab='news') list
Allowed options for tab: “news”, “all”, “press releases
- get_recommendations(as_dict=False)
Returns a DataFrame with the recommendations Columns: period strongBuy buy hold sell strongSell
- get_recommendations_summary(as_dict=False)
- get_revenue_estimate(as_dict=False)
Index: 0q +1q 0y +1y Columns: numberOfAnalysts avg low high yearAgoRevenue growth
- get_sec_filings() dict
- get_shares(as_dict=False) DataFrame | dict
- get_shares_full(start=None, end=None)
- get_splits(period='max') Series
- get_sustainability(as_dict=False)
- get_upgrades_downgrades(as_dict=False)
Returns a DataFrame with the recommendations changes (upgrades/downgrades) Index: date of grade Columns: firm toGrade fromGrade action
- get_valuation_measures()
- history(*args, **kwargs) DataFrame
- live(message_handler=None, verbose=True)
- option_chain(date=None, tz=None)