'Error in tq_get, x = 'MKL', get = 'stock.prices': Error in new.session(): Could not establish session after 5 attempts [duplicate]
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)
})
Solution 1:[1]
I had the same issue this morning and found this post a few hours later.
https://github.com/joshuaulrich/quantmod/issues/358
The repository owner was notified of the issue and pushed a patch.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | gitbud |
