[R-SIG-Finance] Downloading historical prices
Jeff Ryan
je||@@@ry@n @end|ng |rom gm@||@com
Fri Nov 22 18:16:39 CET 2024
I might be on a lagged version in the session I just was running, but I
don't see an issue either.
> getSymbols("SPY")
[1] "SPY"
> head(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
> packageVersion("quantmod")
[1] ‘0.4.25’
> Sys.time()
[1] "2024-11-22 11:15:48 CST"
>
On Fri, Nov 22, 2024 at 11:13 AM Anatoly Schmidt <as8098 using nyu.edu> 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.
>
> On Fri, Nov 22, 2024 at 12:07 PM Anatoly Schmidt <as8098 using 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"),
> > 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.
> >
> > The same 401 comes out when I run my (more complicated) script.
> >
> > Thanks again, Alec
> >
> >
> > On Fri, Nov 22, 2024 at 11:53 AM Dirk Eddelbuettel <edd using debian.org>
> wrote:
> >
> >>
> >> On 22 November 2024 at 11:41, Anatoly Schmidt wrote:
> >> | I (and my students) used to download historical prices from yahoo
> >> finance
> >> | with the Quantmod function getSymbols(). It seems that it now requires
> >> | yahoo premium service. Is there a way around? If not, are there other
> >> free
> >> | sources for downloading prices?
> >>
> >> Can you show an actual request that fails? I have multiple recurrent
> jobs
> >> using Yahoo!, and I do not have any premium service.
> >>
> >> Current R and quantmod on Ubuntu demo:
> >>
> >> > suppressMessages(library(quantmod))
> >> > X <- getSymbols("SPY", from="2024-11-01") # yahoo by default
> >> > X
> >> 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
> >> >
> >>
> >> and I am running this fairly 'vanilla' apart from the usual behaviour
> >> setters
> >> I had for well over a decade which overcome some of the very initial
> >> design
> >> choices:
> >>
> >> ## quantmod stuff -- see help(getSymbols)
> >> options(getSymbols.auto.assign=FALSE,
> >> getSymbols.warning4.0=FALSE,
> >> getSymbols.yahoo.warning=FALSE)
> >>
> >> Hth, Dirk
> >>
> >> --
> >> dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
> >>
> >
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list