Core Guide
Historical Data
history() is the workhorse: open, high, low, close, and volume for any period Yahoo serves, returned as a pandas DataFrame.
Basic usage
pythonhistory.py
from yahooquery import Ticker aapl = Ticker('aapl') df = aapl.history(period='1y', interval='1d') df.head()
Periods and intervals
| Argument | Options |
|---|---|
| period | 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max |
| interval | 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo |
Note: intraday intervals are only available for recent windows — e.g. 1-minute data covers roughly the last 30 days.
Explicit date ranges
Prefer exact bounds? Pass start and end instead of period:
pythonrange.py
df = aapl.history(start='2024-01-01', end='2025-01-01')
Working with the DataFrame
pythonanalyze.py
# daily returns returns = df['close'].pct_change() # 20-day rolling mean of the close df['close'].rolling(20).mean() # monthly resample monthly = df['close'].resample('ME').last()
Multiple symbols
On a multi-symbol Ticker, the DataFrame gets a MultiIndex — symbol first, then date:
pythonmulti.py
faang = Ticker(['fb', 'aapl', 'amzn', 'nflx', 'goog']) df = faang.history(period='1mo') df.loc['nflx', 'close'].plot()
Next: add fundamentals to the mix with the Financials guide.