PriceHistory class#

class yfinance.scrapers.history.PriceHistory(data, ticker, tz, session=None)#
get_actions(period='max') Series#
get_capital_gains(period='max', repair=False) Series#
get_dividends(period='max', repair=False) Series#
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_splits(period='max', repair=False) Series#
history(period='1mo if start & end None', interval='1d', start=None, end=None, prepost=False, actions=True, auto_adjust=True, back_adjust=False, repair=False, keepna=False, rounding=False, timeout=10, raise_errors=False) DataFrame#
Parameters:
periodstr
Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
Default: ‘1mo’ if start & end None
Can combine with start/end e.g. end = start + period
intervalstr
Valid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo
Intraday data cannot extend last 60 days
startstr
Download start date string (YYYY-MM-DD) or _datetime, inclusive.
Default: 99 years ago
E.g. for start=”2020-01-01”, first data point = “2020-01-01”
endstr
Download end date string (YYYY-MM-DD) or _datetime, exclusive.
Default: now
E.g. for end=”2023-01-01”, last data point = “2022-12-31”
prepostbool
Include Pre and Post market data in results?
Default: False
auto_adjustbool
Adjust all OHLC automatically?
Default: True
back_adjustbool
Back-adjusted data to mimic true historical prices
repairbool
Fixes price errors in Yahoo data: 100x, missing, bad dividend adjust.
Default: False
Full details at: Price Repair.
keepnabool
Keep NaN rows returned by Yahoo?
Default: False
roundingbool
Optional: Round values to 2 decimal places?
Default: False = use precision suggested by Yahoo!
timeoutNone or float
Optional: timeout fetches after N seconds
Default: 10 seconds
raise_errorsbool

If True, then raise errors as Exceptions instead of logging.