Skip to content

Downloading historical prices

6 messages · Ilya Kipnis, Jeff Ryan, Anatoly Schmidt +1 more

#
I had to delete the screenshot as my message below violates the size
constraint imposed by r-sig-finance. It can be seen on the yahoo finance
website.
On Fri, Nov 22, 2024 at 12:07?PM Anatoly Schmidt <as8098 at nyu.edu> wrote:

            

  
  
#
I just tried a basic getSymbols('SPY', from = '1990-01-01'), and it went
off without a hitch.
On Fri, Nov 22, 2024 at 12:13?PM Anatoly Schmidt <as8098 at nyu.edu> wrote:

            

  
  
#
I might be on a lagged version in the session I just was running, but I
don't see an issue either.
[1] "SPY"
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted

2007-01-03   142.25   142.86  140.57    141.37   94807600     100.9006

2007-01-04   141.23   142.05  140.61    141.67   69620600     101.1147

2007-01-05   141.33   141.40  140.38    140.54   76645300     100.3082

2007-01-08   140.82   141.41  140.25    141.19   71655000     100.7721

2007-01-09   141.31   141.60  140.40    141.07   75680100     100.6865

2007-01-10   140.58   141.57  140.30    141.54   72428000     101.0219
[1] ?0.4.25?
[1] "2024-11-22 11:15:48 CST"

        
On Fri, Nov 22, 2024 at 11:13?AM Anatoly Schmidt <as8098 at nyu.edu> wrote:

            

  
  
#
On 22 November 2024 at 12:13, Anatoly Schmidt wrote:
| I had to delete the screenshot as my message below violates the size constraint
| imposed by r-sig-finance. It can be seen on the yahoo finance website.?

Yep. And we are not fan of screen shots either.
| On Fri, Nov 22, 2024 at 12:07?PM Anatoly Schmidt <as8098 at nyu.edu> wrote:
| 
|     Thank?you Dirk,
|     I concluded that yahoo requires premium service after seeing the lock on
|     the download? link. Here is a screenshot. When I click?on the lock, yahoo
|     invites me to subscribe a premium service:
| 
| 
|     When I run your example
|     X <- getSymbols("SPY", from="2024-11-01"),?

You can't do the assignment unless you set the option I showed in my initial email.

|     I have the following output:
| 
|     Warning: SPY download failed; trying again.
|     Error in getSymbols.yahoo(Symbols = "SPY", env = <environment>, verbose = FALSE,  :
|       Unable to import ?SPY?.
|     SPY download failed after two attempts. Error message:?
| 
|     HTTP error 401.

So we need to debug this.

For kicks, I just installed quantmod and its five depedencies on a fresh r2u
container running Ubuntu 24.04.  No options, no nothing:

  root at d17b04bef87d:/# R -q
  > library(quantmod)
  Loading required package: xts
  Loading required package: zoo
  
  Attaching package: ?zoo?
  
  The following objects are masked from ?package:base?:
  
      as.Date, as.Date.numeric
  
  Loading required package: TTR
  Registered S3 method overwritten by 'quantmod':
    method            from
    as.zoo.data.frame zoo 
  > getSymbols("SPY", from="2024-11-01")
  [1] "SPY"
  > SPY
             SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
  2024-11-01   571.32   575.55  570.62    571.04   45667500       571.04
  2024-11-04   571.18   572.50  567.89    569.81   38217000       569.81
  2024-11-05   570.74   576.74  570.52    576.70   39478300       576.70
  2024-11-06   589.20   591.93  585.39    591.04   68182000       591.04
  2024-11-07   593.08   596.65  593.00    595.61   47233200       595.61
  2024-11-08   596.17   599.64  596.17    598.19   46444900       598.19
  2024-11-11   599.81   600.17  597.00    598.76   37586800       598.76
  2024-11-12   598.68   599.29  594.37    596.90   43006100       596.90
  2024-11-13   597.37   599.23  594.96    597.19   47388600       597.19
  2024-11-14   597.32   597.81  592.65    593.35   38904100       593.35
  2024-11-15   589.72   590.20  583.86    585.75   75988800       585.75
  2024-11-18   586.22   589.49  585.34    588.15   37084100       588.15
  2024-11-19   584.71   591.04  584.03    590.30   49412000       590.30
  2024-11-20   590.38   590.79  584.63    590.50   50032600       590.50
  2024-11-21   593.40   595.12  587.45    593.67   46565100       593.67
  > 

So the arrow still points at your setup. 

Dirk
#
I reloaded quantmod, and my script works now fine.
Still, one cannot download prices from the yahoo finance website to a xls
file for free anymore.
Thank you all.
Alec
On Fri, Nov 22, 2024 at 12:40?PM Dirk Eddelbuettel <edd at debian.org> wrote:

            

  
  
#
On 22 November 2024 at 12:48, Anatoly Schmidt wrote:
| I reloaded quantmod, and my script?works now fine.

Good, and as expected. There were recent changes in the code one needs to
accommodate recent changes at the website.

| Still, one cannot download prices from the yahoo finance website to a xls file
| for free anymore.

Well for that you may have to talk to Yahoo! rather than this list.

It was _years_ ago that exchanges started to derive more than half their
total revenue from data sales. That we still get this data this is a small
miracle, and in large part due to some folks tirelessly toiling away to
update the code. It is appreciated.

Cheers, Dirk