[R] Quantmod cant download data

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Tue Apr 18 19:13:13 CEST 2017


The download works for me without any warning message.  The following is my session info.

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] quantmod_0.4-7 TTR_0.23-1     xts_0.9-7      zoo_1.7-14    

loaded via a namespace (and not attached):
[1] tools_3.3.3     grid_3.3.3      lattice_0.20-35
>

And here is the download result.


> getSymbols("SPY", verbose = TRUE)
    As of 0.4-0, 'getSymbols' uses env=parent.frame() and
 auto.assign=TRUE by default.

 This  behavior  will be  phased out in 0.5-0  when the call  will
 default to use auto.assign=FALSE. getOption("getSymbols.env") and 
 getOptions("getSymbols.auto.assign") are now 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 more details.
downloading  SPY .....

trying URL 'http://ichart.finance.yahoo.com/table.csv?s=SPY&a=0&b=01&c=2007&d=3&e=18&f=2017&g=d&q=q&y=0&z=SPY&x=.csv'
Content type 'text/csv' length unknown
downloaded 187 KB

done.
[1] "SPY"
>


Hope this is useful,

Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services

> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Joshua
> Ulrich
> Sent: Tuesday, April 18, 2017 9:16 AM
> To: Christofer Bogaso
> Cc: r-help
> Subject: Re: [R] Quantmod cant download data
> 
> See https://github.com/joshuaulrich/quantmod/issues/149
> 
> On Tue, Apr 18, 2017 at 11:14 AM, Christofer Bogaso
> <bogaso.christofer at gmail.com> wrote:
> > Hi again,
> >
> > I generally use Quantmod package to download stock data. However
> > recently I observed that it is unable to download the data although
> > Source file is available.
> >
> > Below is Error I found when I use Quantmod :
> >
> >> library(quantmod)
> >> getSymbols("^NSEI")
> > Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
> from.m,  :
> >   cannot open URL
> >
> 'http://ichart.finance.yahoo.com/table.csv?s=^NSEI&a=0&b=01&c=2007&d=
> 3&e=18&f=2017&g=d&q=q&y=0&z=^NSEI&x=.csv'
> >
> > However the Source file
> >
> "http://ichart.finance.yahoo.com/table.csv?s=^NSEI&a=0&b=01&c=2007&d=
> 3&e=18&f=2017&g=d&q=q&y=0&z=^NSEI&x=.csv"
> > is available for manual download.
> >
> > R version :
> >
> > R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
> > Copyright (C) 2016 The R Foundation for Statistical Computing
> > Platform: x86_64-apple-darwin13.4.0 (64-bit)
> >
> >> sessionInfo()
> > R version 3.3.2 (2016-10-31)
> > Platform: x86_64-apple-darwin13.4.0 (64-bit)
> > Running under: macOS Sierra 10.12.3
> >
> > locale:
> > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-
> 8
> >
> > attached base packages:
> > [1] stats     graphics  grDevices utils     datasets  methods   base
> >
> > other attached packages:
> > [1] quantmod_0.4-7    TTR_0.23-1        xts_0.9-7         zoo_1.8-0
> >      data.table_1.10.0
> >
> > loaded via a namespace (and not attached):
> > [1] grid_3.3.2      lattice_0.20-35
> >
> > Could you please help to resolve this issue.
> >
> > Thanks for your time.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list