JECSand / yahoofinancials

A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
https://pypi.python.org/pypi/yahoofinancials
MIT License
911 stars 215 forks source link

.get_stock_outstanding #9

Closed ForgeFin closed 6 years ago

ForgeFin commented 6 years ago

Hey JECSand, could you also write a function to retrieve the number of shares outstanding? - or am I missing that it already exists? - No. of shares is necessary for me to link the statement data to the price data .. I already tried to work around with EPS but this seems error-prone.

Btw. thanks for the help in stackoverflow ;-)

JECSand commented 6 years ago

Hey there,

I just added a new function to the module called get_num_shares_outstanding() and released a new version of the module (v8.0). This new method calculates the current shares outstanding by dividing the current market cap by the current stock price. I was unable to find an easy way to calculate historical shares outstanding and I was unable to find a pre-calculated value directly from yahoo finance to use instead.

Another option with that method is to run it as get_num_shares_outstanding('average'), which will execute the method by dividing the current market cap by the daily average price instead. Just in-case that outputs a more accurate value for you.

Let me know how this works and thank you for using YahooFinancials again.

Also feel free to open another issue detailing any errors/bugs from the EPS method. I'd be happy to fix them.

Not a problem, always glad to help!