Packages used here are shiny (version 1.1.0) and quantmod (version 0.4-13)
The server part of the app contains the following code:
server <- function(input, output) {
dataInput <- reactive({
getSymbols(input$symb, src = "google",
from = input$dates[1],
to = input$dates[2],
auto.assign = FALSE)
})
Running this app results in the error:
''getSymbols.google' is defunct. Google Finance stopped providing data in March 2018. You could try setting src = "yahoo" instead'
So I set src="yahoo", saved and re ran.
I then got this error:
Timeout was reached:Connection timed out after 10000 milliseconds.
Any chance you have a proxy that prevents your shiny app from connecting to yahoo?
For example, on the same machine as your shiny server, can you run the following
library(dplyr)
library(quantmod)
mydata <- getSymbols("SPY",
src = "yahoo",
from = "2013-01-01",
to = "2013-01-31",
auto.assign = FALSE) %>%
tbl_df()
#> 'getSymbols' currently uses auto.assign=TRUE by default, but will
#> use auto.assign=FALSE in 0.5-0. You will still be able to use
#> 'loadSymbols' to automatically load data. getOption("getSymbols.env")
#> and getOption("getSymbols.auto.assign") will still be checked for
#> alternate defaults.
#>
#> This message is shown once per session and may be disabled by setting
#> options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
#>
#> WARNING: There have been significant changes to Yahoo Finance data.
#> Please see the Warning section of '?getSymbols.yahoo' for details.
#>
#> This message is shown once per session and may be disabled by setting
#> options("getSymbols.yahoo.warning"=FALSE).
mydata %>% head()
#> # A tibble: 6 x 6
#> SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 145. 146. 145. 146. 192059000 130.
#> 2 146. 146. 145. 146. 144761800 130.
#> 3 146. 147. 146. 146. 116817700 131.
#> 4 146. 146. 145. 146. 110002500 130.
#> 5 146. 146. 145. 146. 121265100 130.
#> 6 146. 146. 146. 146. 90745600 130.
I am running this code on a work laptop so there is a chance the code has been blocked. On running the code suggested in a normal R script I get this message in the console:
tbl_df()
‘getSymbols’ currently uses auto.assign=TRUE by default, but will
use auto.assign=FALSE in 0.5-0. You will still be able to use
‘loadSymbols’ to automatically load data. getOption("getSymbols.env")
and getOption("getSymbols.auto.assign") will still be checked for
alternate defaults.
This message is shown once per session and may be disabled by setting
options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
WARNING: There have been significant changes to Yahoo Finance data.
Please see the Warning section of ‘?getSymbols.yahoo’ for details.
This message is shown once per session and may be disabled by setting
options("getSymbols.yahoo.warning"=FALSE).
Error in curl::curl_download(cu, tmp, handle = h) :
Timeout was reached: Connection timed out after 10015 milliseconds
This particular learning module does require the ability to connect to yahoo finance to get these prices and your error message suggests to me that the work network is preventing that connection, resulting in the timeout error.
(I might be wrong there.)
A few options:
ask your IT folks if they might have a proxy they would prevent this, and for advice
try these lesions on a different network.
check out the later course modules until you’ve got this resolved.