[R-SIG-Finance] Downloaded stock prices from Yahoo Finance

Dennis Fisher ||@her @end|ng |rom p|e@@th@n@com
Fri May 5 18:53:05 CEST 2023


Joshua

Thanks for replying.  It looks as if I am not alone.
The final message appearing on GitHub included:

#My workaround:
library(yfinance)
priceact <- get_price(c("DBC","FAS","GLD","IVOL","LTPZ","QLD","SPY","EURUSD=X"))
priceact <- priceact[,c(1,9)]
colnames(priceact)[c(1, 2)] <- c("name", "last")
tail(priceact,15)

Where do I find 
	yfinance
In OS X, when I attempt to install that package, it does not find it.

Dennis



Dennis Fisher MD
P < (The "P Less Than" Company)
Phone / Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com




> On May 5, 2023, at 9:40 AM, Joshua Ulrich <josh.m.ulrich using gmail.com> wrote:
> 
> See the discussion and work arounds here:
> https://github.com/joshuaulrich/quantmod/issues/382
> 
> On Fri, May 5, 2023 at 10:31 AM Dennis Fisher <fisher using plessthan.com> wrote:
>> 
>> R 4.2.3
>> OS X
>> 
>> Colleagues
>> 
>> For years, I have been downloaded stock prices using something like:
>>        require("jsonlite")
>>        cmd <- "https://query1.finance.yahoo.com/v7/finance/quote?fields=symbol,longName,regularMarketPrice,regularMarketTime,regularMarketChange&formatted=false&symbols=AAPL"
>>        fromJSON(cmd)
>> 
>> Yesterday, this stopped working -- the message is:
>> Error in open.connection(con, "rb") :
>>  cannot open the connection to 'https://query1.finance.yahoo.com/v7/finance/quote?fields=symbol,longName,regularMarketPrice,regularMarketTime,regularMarketChange&formatted=false&symbols=AAPL'
>> In addition: Warning message:
>> In open.connection(con, "rb") :
>>  cannot open URL 'https://query1.finance.yahoo.com/v7/finance/quote?fields=symbol,longName,regularMarketPrice,regularMarketTime,regularMarketChange&formatted=false&symbols=AAPL': HTTP status was '401 Unauthorized'
>> 
>> When I paste that code directly into a browser, I get:
>>        {"finance":{"result":null,"error":{"code":"Unauthorized","description":"Invalid Crumb"}}}
>> 
>> I need the most recent closing price and the today's real-time price.  What other options exist to download prices for multiple stocks?
>> 
>> Dennis
>> 
>> 
>> Dennis Fisher MD
>> P < (The "P Less Than" Company)
>> Phone / Fax: 1-866-PLessThan (1-866-753-7784)
>> www.PLessThan.com
>> 
>> _______________________________________________
>> 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.
> 
> 
> 
> -- 
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list