scheb / yahoo-finance-api

PHP client for Yahoo Finance API 📈
MIT License
275 stars 54 forks source link

Statistics Tab #35

Closed eversionsystems closed 1 year ago

eversionsystems commented 2 years ago

I've checked the code and it doesn't look like the "Statistics" tab data is queryable for a stock.

Is the data on this page able to be returned? I'm trying to access data in the balance sheet for Total Debt/Equity (mrq).

Thanks again love your work!

scheb commented 2 years ago

I'm not aware of an API endpoint to retrieve that data. If you find one, let's talk about adding it to the library. (To be clear, parsing the HTML I'm not considering an option).

As a workaround, some of these stats should be available on the stock object.

eversionsystems commented 2 years ago

Ok thanks for the response. I don't see those stats in the stock object unfortunately.

eversionsystems commented 2 years ago

Good news, I found an endpoint which has the debt to equity value returned. Here is an example of how to use it.

https://query1.finance.yahoo.com/v10/finance/quoteSummary/FMG.AX?modules=assetProfile,defaultKeyStatistics,financialData,recommendationTrend,upgradeDowngradeHistory,majorHoldersBreakdown,insiderHolders,netSharePurchaseActivity,earnings,earningsHistory,earningsTrend,industryTrend,indexTrend,sectorTrend

Do you have time to implement this feature?

scheb commented 2 years ago

The data from defaultKeyStatistics and financialData seems to be pretty much what's shown on that statistics page. I could imagine this being interesting to other people as well.

I'd accept a PR to add a method for retrieving these statistics, my suggestion would be to parse it into a StatisticsData object.

eversionsystems commented 2 years ago

Ok let me code something up then.

scheb commented 2 years ago

Great, a first rough draft would be good enough. Would suggest to implement some of the fields, so we get an idea of the implementation and then we can extend from there.