importing stock prices


I am trying to upload stock prices for McDonalds and Netflix however I keep getting an error message as follows

what I code:
library(tidyquant)
library(tidyverse)
stocks <- tq_get(c("NFLX", "MCD"), get = "stock.prices", from="2019-01-01")

error message:
Warning: Problem with mutate() column data... :information_source: data.. = purrr::map(...)
. :information_source: x = 'NFLX', get = 'stock.prices': Error in new.session(): Could not establish session after 5 attempts.
Removing NFLX. Warning: Problem with mutate() column data... :information_source: data.. = purrr::map(...).
:information_source: x = 'MCD', get = 'stock.prices': Error in new.session(): Could not establish session after 5 attempts. Removing MCD.

Please help me

2 Likes

This seems like a connectivity issue, either the Yahoo Finance service is unavailable at the moment, or you are experiencing connectivity restrictions of some kind (firewall, proxy server, etc). Can you access Yahoo Finance outside of R?

The Yahoo API slightly changed. quantmod has already sent a fix for this to CRAN, so just use install.packages("quantmod") and restart R and it should work

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.