Type: Package
Title: Yahoo Finance 'history' API
Version: 0.1.3
Date: 2026-01-19
Description: Simple and efficient access to Yahoo Finance's historical data API https://finance.yahoo.com/ for querying and retrieval of financial data. The core functionality of the 'yfhist' package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management, crumb and cookie handling, query construction, date validation, and interval management. This abstraction allows users to focus on retrieving data rather than managing API details. Use cases include historical data across a range of security types including equities & ETFs, indices, and other tickers. The package supports flexible query capabilities, including customizable date ranges, multiple time intervals, and automatic data validation. It automatically manages interval-specific limitations, such as lookback periods for intraday data and maximum date ranges for minute-level intervals. The implementation leverages standard HTTP libraries to handle API interactions efficiently and provides support for both R and 'Python' to ensure accessibility for a broad audience.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Encoding: UTF-8
URL: https://github.com/jasonjfoster/hist
BugReports: https://github.com/jasonjfoster/hist/issues
Depends: R (≥ 3.5.0)
Imports: curl, jsonlite
Suggests: covr, testthat
LazyData: true
RoxygenNote: 7.3.3
NeedsCompilation: no
Packaged: 2026-01-19 21:02:59 UTC; jason
Author: Jason Foster [aut, cre]
Maintainer: Jason Foster <jason.j.foster@gmail.com>
Repository: CRAN
Date/Publication: 2026-01-23 14:30:02 UTC

Intervals Data for the Yahoo Finance API

Description

A data frame with the available intervals data for the Yahoo Finance API.

Usage

data_intervals

Format

A data frame.


Get a Column from the Yahoo Finance API

Description

A function to get a column from the Yahoo Finance API for symbols using a date range and interval.

Usage

get_col(data, col)

Arguments

data

data frame or list. Data that contains an index column and the requested column created using the get_data function.

col

string. Column name to get (i.e., "open", "high", "low", "close", "adjclose", "volume").

Value

A data frame with rows as the index and columns as the symbols.

Examples

## Not run: 
data <- get_data(c("AAPL", "MSFT"))

adj <- get_col(data, "adjclose")

## End(Not run)

Get Data from the Yahoo Finance API

Description

A function to get data from the Yahoo Finance API for symbols using a date range and interval.

Usage

get_data(symbols, from_date = "2007-01-01", to_date = NULL,
  interval = "1d")

Arguments

symbols

string. Symbol or vector of symbols.

from_date

string. Start date in "YYYY-MM-DD" format (e.g., "2007-01-01").

to_date

string. End date in "YYYY-MM-DD" format.

interval

string. Data interval (see "data_intervals").

Value

A data frame or list of data frame(s) that contains data from the Yahoo Finance API for the specified symbol(s).

Examples

## Not run: 
data <- get_data(c("AAPL", "MSFT"))

## End(Not run)

Get the Crumb, Cookies, and Handle for Yahoo Finance API

Description

A function to get the crumb, cookies, and handle required to authenticate and interact with the Yahoo Finance API.

Usage

get_session()

Value

A list containing the following elements:

handle

A curl handle object for subsequent requests.

crumb

A string representing the crumb value for authentication.

cookies

A data frame of cookies for the request.

Examples

session <- get_session()