Downloads daily adjusted closing prices from Yahoo Finance for one or more ticker symbols over a given date range. Includes validation and robust error handling.
Usage
get_stock_prices(tickers, from, to = Sys.Date())Value
A tibble with columns:
symbol, date, open, high, low, close, volume, adjusted.
On error, throws with details. Use tryCatch() in calling code.
Examples
if (FALSE) { # \dontrun{
get_stock_prices(c("AAPL", "MSFT"), from = "2023-01-01")
} # }