I am having difficulties pulling stock data. The code has worked earlier today, however this afternoon I became unable to pull any stock data at all. Is anyone else experiencing this error or have you figured out a solution.
Here is a selection of my code
library(here)
library(purrr)
library(ggplot2)
library(furrr)
library(tidyquant)
library(tidyr)
library(dplyr)
set.seed(123)
plan(multisession, workers = 4)
# Set time frame
end <- "2021-12-31"
beg <- "2016-12-31"
risk_free_rate <- 0.02
# Import data ----
stock_sp <- readxl::read_xlsx(path = here("Stock_List_Port_2.xlsx")) %>%
setNames(c("ticker", "sic"))
tickers <- sample(x = stock_sp$ticker, size = 1)
#tickers <- stock_sp$ticker
stock_data_full <- map(tickers, function(ticker){
tidyquant::tq_get(x = ticker,
get = "stock.prices",
verbose = TRUE,
from = beg, to = end)
})