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
_______________________________________________
[email protected] 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.