Download yahoo finance data in R

1

How can I download data from yahoo finance at Rstudio? I get the following error:

  

Error in download.file (paste (yahoo.URL, "s=", Symbols.name, "& amp = a",   from.m,: can not open URL   ' link '

library(quantmod) 
library(xts) 
library(zoo) 
library(TTR) 

## Indice de Referencia IPC 
## Creando un nuevo ambiente 
IPC<- new.env() 
## Obteniendo datos desde yahoo finance 
getSymbols("MXX", env = IPC, src = "yahoo", from = as.Date("2014-10-20"), to = as.Date("2016-10-26")

)

    
asked by RichVF 17.05.2017 в 20:18
source

1 answer

1

It seems to be a Yahoo problem. The complete error is this:

    Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  : 
      cannot open URL 'https://ichart.finance.yahoo.com/table.csv?s=BAL&a=0&b=01&c=2007&d=4&e=17&f=2017&g=d&q=q&y=0&z=BAL&x=.csv'
    In addition: Warning message:
    In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
      cannot open URL 'https://ichart.finance.yahoo.com/table.csv?s=BAL&a=0&b=01&c=2007&d=4&e=17&f=2017&g=d&q=q&y=0&z=BAL&x=.csv': HTTP status was '502 Connection refused'

Where the most interesting part says HTTP status was '502 Connection refused' . On the other hand if you try to access the url: link , you will have a nice page that tells you that they will be back soon.

    
answered by 17.05.2017 в 20:54