[R-SIG-Finance] Downloading historical prices

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Fri Nov 22 17:52:57 CET 2024


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



More information about the R-SIG-Finance mailing list