Learn R Programming

yfhist (version 0.1.3)

get_data: 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")

Value

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

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").

Examples

Run this code
if (FALSE) {
data <- get_data(c("AAPL", "MSFT"))
}

Run the code above in your browser using DataLab