An R6 class to manage and aggregate data from multiple Yahoo Finance tickers
simultaneously. It wraps the Ticker class to provide a unified,
long-format data interface suitable for bulk analysis and visualization.
Details
The Tickers class automates the process of iterating over a vector of
symbols. It handles per-symbol errors gracefully via an internal
aggregate_data helper, ensuring that a failure in one symbol does
not prevent the collection of data for others.
Most properties return a data.frame where the first column is
symbol, facilitating easy filtering and joining in tidy workflows.
See also
Other historical data:
Index-class,
Ticker-class,
yf_download_prices(),
yf_get_index_quotes()
Public fields
symbolsA unique character vector of symbols being tracked.
ticker_objsA named list of underlying
TickerR6 objects.
Active bindings
recommendationsRelated symbols suggested by Yahoo Finance and their relevance scores.
valuation_measuresQuarterly valuation statistics including PE and Enterprise Value.
technical_insightsTechnical indicator snapshots (e.g., RSI, Moving Averages).
regular_market_priceThe current market price for each symbol.
regular_market_timeThe timestamp of the last market trade.
regular_market_volumeThe current trading volume.
regular_market_day_highThe highest price during the current trading session.
regular_market_day_lowThe lowest price during the current trading session.
previous_closeThe closing price of the previous trading day.
fifty_two_week_highThe highest price over the last 52 weeks.
fifty_two_week_lowThe lowest price over the last 52 weeks.
currencyThe currency code (e.g., "USD") for the symbols.
exchange_nameThe short name of the stock exchange.
full_exchange_nameThe full name of the stock exchange.
first_trade_dateThe Unix timestamp of the first recorded trade.
timezoneThe timezone code (e.g., "EDT").
exchange_timezone_nameThe full name of the exchange's timezone.
Methods
Method get_history()
Retrieve historical market data for all symbols.
Arguments
periodLength of time. Defaults to
'1y'. Valid values:"1d","5d","1mo","3mo","6mo","1y","2y","5y","10y","ytd","max". Ignored whenstartis provided.intervalTime between data points. Defaults to
'1d'. Valid values:"1m","2m","5m","15m","30m","60m","90m","1h","1d","5d","1wk","1mo","3mo".startSpecific starting date.
StringorDateobject in"YYYY-MM-DD"format.endSpecific ending date.
StringorDateobject in"YYYY-MM-DD"format. Defaults to today whenstartis provided butendisNULL.
Returns
A tidy tibble containing historical prices and volumes.
Columns: symbol, date, open, high, low,
close, adj_close, volume.
Method aggregate_data()
Internal helper to execute a method across all symbols and combine results. Not intended for direct end-user use.
Examples
if (FALSE) { # \dontrun{
# Initialize for a set of tech stocks
stocks <- Tickers$new(c("AAPL", "MSFT", "GOOGL"))
# 1. Get 1 month of historical daily prices
hist_data <- stocks$get_history(period = "1mo", interval = "1d")
head(hist_data)
# 2. Get current market prices for the group
current_prices <- stocks$regular_market_price
# 3. View recommended related symbols and scores
recs <- stocks$recommendations
# 4. Get technical insights (RSI, Moving Averages)
tech <- stocks$technical_insights
} # }