You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function getQuote does not work when I don't request some specific metrics in the what argument. After taking a deeper look at the code and the JSON, it turns out that Yahoo does not return (anymore?) the regularMarketTime when metrics - such as the price, bid, ask and I don't know what else - are not requested.
For example, if you request only the shares outstanding and earnings per share, then you get an error.
I guess this should not be too difficult to fix in getQuote's code. A possible solution would be tto automatically query the regularMarketTime from Yahoo when the user asks for a customized list of metrics. So if I ask for shares outstanding only, we would append ",regularMarketTime" to the URL, which would then look like: https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL&fields=sharesOutstanding,epsTrailingTwelveMonths,regularMarketTime
This could be done in the getQuote function or the YahooQF function I guess.
Thanks for the report and suggestion! I'm working on getQuote.tiingo() (#247, #250), and I also see the need for some validation of the results returned from the various providers.
Description
The function getQuote does not work when I don't request some specific metrics in the what argument. After taking a deeper look at the code and the JSON, it turns out that Yahoo does not return (anymore?) the regularMarketTime when metrics - such as the price, bid, ask and I don't know what else - are not requested.
For example, if you request only the shares outstanding and earnings per share, then you get an error.
Error returned:
That's normal because if you look at the JSON, there is not regularMarketTime variable: https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL&fields=sharesOutstanding,epsTrailingTwelveMonths
However, if you request also, say, the bid price, then all works well:
That's because the JSON returned by Yahoo actually provides regularMarketTime: https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL&fields=sharesOutstanding,epsTrailingTwelveMonths,bid
I guess this should not be too difficult to fix in getQuote's code. A possible solution would be tto automatically query the regularMarketTime from Yahoo when the user asks for a customized list of metrics. So if I ask for shares outstanding only, we would append ",regularMarketTime" to the URL, which would then look like: https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL&fields=sharesOutstanding,epsTrailingTwelveMonths,regularMarketTime
This could be done in the getQuote function or the YahooQF function I guess.
FYI, here is my R session info:
Cheers,
Mehdi
The text was updated successfully, but these errors were encountered: