Skip to content
Back to formatted view

Raw Message

Message-ID: <B036F3F2-A999-4F24-AE7E-80C99485E458@plessthan.com>
Date: 2023-05-05T16:53:05Z
From: Dennis Fisher
Subject: Downloaded stock prices from Yahoo Finance
In-Reply-To: <CAPPM_gTaNYseF7BjPTva05dwz6nwe1BChCLeOjxgJLjY11G1_g@mail.gmail.com>

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 at 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 at 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 at 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