
Last chance! 50% off unlimited learning
Sale ends in
tibble
formatGet all stocks in a stock index or stock exchange in tibble
format
tq_index(x, use_fallback = FALSE)tq_exchange(x)
tq_index_options()
tq_exchange_options()
A single character string, a character vector or tibble representing a single stock index or multiple stock indexes.
A boolean that can be used to return a fallback data set
last downloaded when the package was updated. Useful if the website is down.
Set to FALSE
by default.
Returns data in the form of a tibble
object.
tq_index()
returns the stock symbol, company name, weight, and sector of every stock
in an index. Nine stock indices are available. The source is
www.us.spdrs.com.
tq_index_options()
returns a list of stock indexes you can
choose from.
tq_exchange()
returns the stock symbol, company, last sale price,
market capitalization, sector and industry of every stock
in an exchange. Three stock exchanges are available (AMEX, NASDAQ, and NYSE).
The source is
NASDAQ.
tq_exchange_options()
returns a list of stock exchanges you can
choose from. The options are AMEX, NASDAQ and NYSE.
tq_get()
to get stock prices, financials, key stats, etc using the stock symbols.
# NOT RUN {
# Load libraries
library(tidyquant)
# Get the list of stock index options
tq_index_options()
# Get all stock symbols in a stock index
# }
# NOT RUN {
tq_index("DOW")
# }
# NOT RUN {
# Get the list of stock exchange options
tq_exchange_options()
# Get all stocks in a stock exchange
# }
# NOT RUN {
tq_exchange("NYSE")
# }
Run the code above in your browser using DataLab