Skip to main content
Download historical market data for one or more ticker symbols. This is a high-performance tool that can fetch data for multiple tickers simultaneously.

Parameters

tickers
string
required
Space-separated ticker symbols (e.g., ‘SPY AAPL MSFT’). Must contain at least one ticker.
period
string
Time period to download. Valid values include:
  • 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max
Cannot be used with start and end parameters.
interval
string
Data interval/granularity. Valid values include:
  • 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo
Default is 1d (daily).
start
string
Start date for the download (format: YYYY-MM-DD). Use with end instead of period.
end
string
End date for the download (format: YYYY-MM-DD). Use with start instead of period.
group_by
string
How to group the returned data:
  • column (default): Group by data columns
  • ticker: Group by ticker symbol
auto_adjust
boolean
Automatically adjust OHLC data for splits and dividends. Default is true.
actions
boolean
Include dividend and split events in the data. Default is false.
threads
boolean
Use multithreading for faster downloads when fetching multiple tickers. Default is true.
response_format
string
Format of the response:
  • json (default): Return structured JSON data
  • markdown: Return formatted markdown table
preview_limit
number
Number of rows to include in markdown preview. Must be between 1 and 200. Default is 25.
save
object
Save the result to a file:
  • format: Either csv or json
  • filename (optional): Custom filename (defaults to yf_download-{timestamp}.{format})

Example Usage

Download multiple tickers for the last year

{
  "tickers": "AAPL MSFT GOOGL",
  "period": "1y",
  "interval": "1d"
}

Download with custom date range

{
  "tickers": "SPY QQQ",
  "start": "2024-01-01",
  "end": "2024-12-31",
  "interval": "1d",
  "group_by": "ticker"
}

Download and save to CSV

{
  "tickers": "TSLA NVDA",
  "period": "6mo",
  "save": {
    "format": "csv",
    "filename": "tech_stocks.csv"
  }
}

Get intraday data with actions

{
  "tickers": "AAPL",
  "period": "5d",
  "interval": "15m",
  "actions": true,
  "auto_adjust": false
}

Response Format

JSON Response (default)

The response contains a data field with the market data and an optional saved_path if the save parameter was used:
{
  "data": {
    "__type__": "dataframe",
    "columns": ["Open", "High", "Low", "Close", "Volume"],
    "index": ["2024-01-01", "2024-01-02", "..."],
    "data": [
      [150.0, 152.5, 149.5, 151.0, 50000000],
      [151.0, 153.0, 150.0, 152.5, 48000000]
    ]
  },
  "saved_path": null
}

Markdown Response

When response_format is set to markdown, returns a formatted table:
index | Open | High | Low | Close | Volume
--- | --- | --- | --- | --- | ---
2024-01-01 | 150.0 | 152.5 | 149.5 | 151.0 | 50000000
2024-01-02 | 151.0 | 153.0 | 150.0 | 152.5 | 48000000

Notes

  • Use period for relative time ranges or start/end for absolute dates, but not both
  • When downloading multiple tickers, the group_by parameter controls data organization
  • The threads parameter can significantly speed up multi-ticker downloads
  • Intraday intervals (1m, 5m, etc.) have limited historical availability (typically 1-60 days)
  • The auto_adjust parameter adjusts prices for corporate actions to maintain continuity

Build docs developers (and LLMs) love