2

I am trying to pull in information from Yahoo Finance into my spreadsheet. I am able to pull in some information from Yahoo Finance such as the current stock price, but I would also like to pull in information on when the "Next Earnings Date" will be for a company. For example, I was able to use this function to get the current stock price for Google:

=NUMBERVALUE(WEBSERVICE("http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=l1"))

Yahoo has some built in APIs which are listed on this website: https://greenido.wordpress.com/2009/12/22/yahoo-finance-hidden-api/

However, I do not see an API for Next Earnings Date. Any suggestions on how to pull that type of information into my spreadsheet? I know some basic VBA but I'm not familiar with querying web data using VBA. Anyone know a way to get this done?

Thanks! Let me know if you have any questions.

RubberDuck
  • 11,933
  • 4
  • 50
  • 95
Sami
  • 579
  • 5
  • 25

1 Answers1

4

Based on the documentation you provided for the API, the data you are looking for is not available in the Yahoo Finance API. Because Yahoo does not make this data available, you actually need to find a different API to work with instead of trying to solve the problem via VBA.

Somebody else on StackOverflow seems to have had the same challenge (getting the Next Earnings Date data). Here's the thread: Free API or similar to get Next Earnings Date for stocks

Alternatively, you can use a service like KimonoLabs or Scrapy to build your own API and get the next earnings date.

For example, I just built this API using Kimono: https://www.kimonolabs.com/api/bq0hsy5y?apikey=30ef2f027c78a399898ac016d22dc0e1&s=goog

To use this API, simply replace s=goog with s=[INSERT STOCK SYMBOL]

Using this URL, you will get JSON returned with 2 collections:

  • Collection 1
    • Measure (contains the title of the information you want like "Next Earnings Date:"
    • Data (contains the actual information)
  • Collection 2
    • StockName (contains the full name & symbol for the stock)

While the WEBSERVICE() function is pretty cool, though it seems to have trouble leveraging the KimonoLabs API (it can't parse JSON & I can't get the API to return XML). Instead, you can use PowerQuery to get the information that you want. Here's a great walkthrough of how to do that: http://southbaydba.com/2013/08/30/part-3-power-query-api-table-as-parameter-for-a-query-indeed/

I hope this helps!

Community
  • 1
  • 1
KingOfTheNerds
  • 653
  • 1
  • 6
  • 19