mrhappyasthma / isthisstockgood Goto Github PK
View Code? Open in Web Editor NEWA tool for evaluating companies using the Rule #1 investing principles.
Home Page: http://www.isthisstockgood.com
A tool for evaluating companies using the Rule #1 investing principles.
Home Page: http://www.isthisstockgood.com
Particularly useful for the analysis. URL = https://finance.yahoo.com/quote/<symbol>/analysis
.
Looking at the Next 5 Years (per annum)
.
Compensation information:
http://insiders.morningstar.com/insiders/trading/executive-compensation-list.action?&t=
Bar graph data: http://insiders.morningstar.com/insiders/trading/executive-compensation-chart.action?&t=
Insider trading url: http://insiders.morningstar.com/trading/executive-compensation.action?t=GOOG®ion=usa&culture=en-US
Activity: http://insiders.morningstar.com/trading/insider-activity.action?t=GOOG®ion=usa&culture=en-US
Key ratio base URL: `http://financials.morningstar.com/ajax/exportKR2CSV.html?
Then it's just t=ticker
. No ".csv" or anything at the end.
For example https://financials.morningstar.com/ratios/r.html?t=goog could be obtained using http://financials.morningstar.com/ajax/exportKR2CSV.html?t=goog
.
Example output:
Growth Profitability and Financial Ratios for Alphabet Inc Class C
Financials
,2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,TTM
Revenue USD Mil,"21,796","23,651","29,321","37,905","50,175","59,825","66,001","74,989","90,272","110,855","129,866"
Gross Margin %,60.4,62.6,64.5,65.2,58.9,56.8,61.1,62.4,61.1,58.9,57.0
Operating Income USD Mil,"6,632","8,312","10,381","11,742","12,760","13,966","16,496","19,360","23,716","28,882","30,853"
Operating Margin %,30.4,35.1,35.4,31.0,25.4,23.3,25.0,25.8,26.3,26.1,23.8
Net Income USD Mil,"4,227","6,520","8,505","9,737","10,737","12,920","14,444","16,348","19,478","12,662","18,768"
Earnings Per Share USD,6.66,10.21,13.17,14.89,16.16,18.79,20.57,22.84,27.85,18.00,26.65
Dividends USD,,,,,,,,,,,
Payout Ratio % *,,,,,,,,,,,
Shares Mil,634,638,646,654,665,678,687,693,699,704,704
Book Value Per Share * USD,,,,,,,145.08,169.12,193.99,226.11,244.21
Operating Cash Flow USD Mil,"7,853","9,316","11,081","14,565","16,619","18,659","22,376","26,024","36,036","37,091","45,252"
Cap Spending USD Mil,"-2,358",-810,"-4,018","-3,438","-13,841","-8,806","-15,847","-10,151","-11,198","-13,471","-23,831"
Free Cash Flow USD Mil,"5,494","8,506","7,063","11,127","2,778","9,853","6,529","15,873","24,838","23,620","21,421"
Free Cash Flow Per Share * USD,,,,,,,9.98,20.42,33.20,33.24,
Working Capital USD Mil,"17,876","26,419","31,566","43,845","46,117","56,978","63,880","70,804","88,652","100,125",
Key Ratios -> Profitability
Margins % of Sales,2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,TTM
Revenue,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00
COGS,39.56,37.39,35.53,34.79,41.12,43.22,38.93,37.56,38.92,41.12,43.04
Gross Margin,60.44,62.61,64.47,65.21,58.88,56.78,61.07,62.44,61.08,58.88,56.96
SG&A,17.20,15.44,16.24,20.61,19.91,20.14,21.18,20.25,19.35,17.83,18.04
R&D,12.82,12.02,12.83,13.62,13.54,13.29,14.90,16.38,15.45,15.00,15.16
Other,,,,,,,,,,,
Operating Margin,30.43,35.15,35.40,30.98,25.43,23.34,24.99,25.82,26.27,26.05,23.76
Net Int Inc & Other,-3.57,0.29,1.42,1.54,1.25,0.89,1.16,0.39,0.48,-1.52,1.54
EBT Margin,26.86,35.44,36.82,32.52,26.68,24.23,26.15,26.21,26.75,24.53,25.30
Profitability,2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,TTM
Tax Rate %,27.79,22.20,21.22,21.00,19.41,15.74,19.30,16.81,19.35,53.44,42.88
Net Margin %,19.39,27.57,29.01,25.69,21.40,21.60,21.88,21.10,21.58,11.42,14.45
Asset Turnover (Average),0.76,0.65,0.60,0.58,0.60,0.58,0.55,0.54,0.57,0.61,0.63
Return on Assets %,14.80,18.05,17.30,14.93,12.91,12.62,11.93,11.36,12.37,6.94,9.13
Financial Leverage (Average),1.13,1.12,1.25,1.25,1.31,1.27,1.25,1.23,1.20,1.29,1.30
Return on Equity %,16.60,20.30,20.68,18.66,16.54,16.25,15.06,14.08,15.02,8.69,11.48
Return on Invested Capital %,15.49,19.74,18.05,15.89,14.66,14.52,13.77,12.82,14.02,8.08,10.50
Interest Coverage,,,,213.52,160.36,175.65,171.88,189.95,195.76,250.48,272.56
Key Ratios -> Growth
,2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,Latest Qtr
Revenue %
Year over Year,,8.51,23.98,29.28,32.37,19.23,10.32,13.62,20.38,22.80,21.49
3-Year Average,,30.65,20.90,20.26,28.49,26.83,20.31,14.33,14.70,18.87,
5-Year Average,,49.29,36.72,29.01,24.77,22.38,22.78,20.66,18.95,17.18,
10-Year Average,,,108.26,83.74,60.60,44.90,35.39,28.44,23.88,20.92,
Operating Income %
Year over Year,,25.34,24.89,13.11,8.67,9.45,18.12,17.36,22.50,21.78,6.78
3-Year Average,,32.79,26.86,20.98,15.36,10.39,12.00,14.91,19.30,20.53,
5-Year Average,,66.99,38.77,27.03,20.20,16.06,14.69,13.27,15.10,17.75,
10-Year Average,,,,70.76,52.59,44.89,38.39,25.38,20.92,18.97,
Net Income %
Year over Year,,54.26,30.44,14.49,10.27,20.33,11.80,13.18,19.15,-34.99,
3-Year Average,,28.44,26.48,32.07,18.09,14.96,14.05,15.04,14.66,-4.29,
5-Year Average,,74.84,42.15,25.91,20.63,25.04,17.24,13.96,14.87,3.35,
10-Year Average,,,,106.27,59.68,61.71,43.17,27.28,20.26,11.66,
EPS %
Year over Year,,53.34,28.91,13.11,8.57,18.01,10.15,8.66,21.94,-35.37,36.47
3-Year Average,,27.10,25.56,30.76,16.55,13.17,12.17,12.20,13.43,-5.04,
5-Year Average,,69.47,39.28,24.52,19.44,23.43,15.53,11.64,13.33,2.17,
10-Year Average,,,,93.71,54.76,57.34,39.92,24.70,18.80,10.47,
Key Ratios -> Cash Flow
Cash Flow Ratios,2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,TTM
Operating Cash Flow Growth % YOY,,0.19,0.19,0.31,0.14,0.12,0.20,0.16,0.38,0.03,
Free Cash Flow Growth % YOY,,0.55,-0.17,0.58,-0.75,2.55,-0.34,1.43,0.56,-0.05,
Cap Ex as a % of Sales,10.82,3.42,13.70,9.07,27.59,14.72,24.01,13.54,12.40,12.15,18.35
Free Cash Flow/Sales %,25.21,35.97,24.09,29.35,5.54,16.47,9.89,21.17,27.51,21.31,16.49
Free Cash Flow/Net Income,1.30,1.30,0.83,1.14,0.26,0.76,0.45,0.97,1.28,1.87,1.14
Key Ratios -> Financial Health
Balance Sheet Items (in %),2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,Latest Qtr
Cash & Short-Term Investments,49.88,60.46,60.46,61.49,51.27,52.94,49.11,49.55,51.54,51.63,48.04
Accounts Receivable,8.32,7.91,8.65,8.50,9.15,8.47,8.81,9.43,8.50,9.48,8.16
Inventory,,,,,0.54,0.38,,,0.16,0.38,0.55
Other Current Assets,5.32,3.66,2.74,2.70,3.49,3.92,3.61,2.13,2.73,1.51,1.81
Total Current Assets,63.52,72.02,71.84,72.70,64.45,65.71,61.53,61.11,62.93,63.01,58.55
Net PP&E,16.48,11.96,13.41,13.23,12.64,14.90,18.21,19.68,20.44,21.48,24.96
Intangibles,18.37,14.02,12.62,12.30,19.20,15.83,15.41,13.37,11.81,9.85,9.18
Other Long-Term Assets,1.63,1.99,2.13,1.78,3.71,3.56,4.85,5.84,4.82,5.66,7.31
Total Assets,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00
Accounts Payable,0.56,0.53,0.83,0.81,2.15,2.21,1.31,1.31,1.22,1.59,1.71
Short-Term Debt,,,5.99,1.68,2.72,2.70,1.52,2.03,,,
Taxes Payable,0.26,,0.06,0.27,0.26,0.02,0.07,0.20,0.33,0.45,
Accrued Liabilities,3.19,3.12,5.63,3.50,5.04,4.94,4.87,4.81,2.51,2.77,2.43
Other Short-Term Liabilities,3.24,3.13,4.76,6.02,5.12,4.46,5.04,4.73,5.95,7.45,9.99
Total Current Liabilities,7.25,6.78,17.28,12.28,15.28,14.34,12.82,13.09,10.00,12.26,14.13
Long-Term Debt,,,,4.11,3.19,1.79,2.28,1.35,2.35,2.00,1.78
Other Long-Term Liabilities,3.86,4.31,2.79,3.49,5.07,5.15,5.21,3.95,4.64,8.45,7.42
Total Liabilities,11.11,11.09,20.07,19.88,23.54,21.29,20.31,18.40,16.99,22.70,23.34
Total Stockholders' Equity,88.89,88.91,79.93,80.12,76.46,78.71,79.69,81.60,83.01,77.30,76.66
Total Liabilities & Equity,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00
Liquidity/Financial Health,2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,Latest Qtr
Current Ratio,8.77,10.62,4.16,5.92,4.22,4.58,4.80,4.67,6.29,5.14,4.14
Quick Ratio,8.03,10.08,4.00,5.70,3.95,4.28,4.52,4.50,6.00,4.98,3.97
Financial Leverage,1.13,1.12,1.25,1.25,1.31,1.27,1.25,1.23,1.20,1.29,1.30
Debt/Equity,,,,0.05,0.04,0.03,0.03,0.02,0.03,0.02,0.02
Key Ratios -> Efficiency Ratios
Efficiency,2008-12,2009-12,2010-12,2011-12,2012-12,2013-12,2014-12,2015-12,2016-12,2017-12,TTM
Days Sales Outstanding,40.23,44.92,46.25,46.60,48.42,51.15,50.50,50.96,51.94,53.46,46.64
Days Inventory,,,,,8.93,6.57,,,2.78,4.07,6.45
Payables Period,9.74,8.13,12.24,14.82,22.99,31.51,29.61,23.63,20.63,20.73,21.10
Cash Conversion Cycle,,,,,34.36,26.21,,,34.10,36.80,32.00
Receivables Turnover,9.07,8.13,7.89,7.83,7.54,7.14,7.23,7.16,7.03,6.83,7.83
Inventory Turnover,,,,,40.86,55.55,,,131.11,89.64,56.55
Fixed Assets Turnover,4.70,4.69,4.65,4.37,4.68,4.22,3.27,2.84,2.85,2.89,2.72
Asset Turnover,0.76,0.65,0.60,0.58,0.60,0.58,0.55,0.54,0.57,0.61,0.63
Example stock: wing
Shows years to pay off debt of 6 as green.
It's unclear if it's a problem with the appengine instance, or the tap handling is failing, or what.
But it often takes 2-3 taps of the button before it succeeds and actually updates the UI.
data = fetchDataForTickerSymbol(ticker)
File "D:\GitHub\Rule1-StockScreener\IsThisStockGood\src\DataFetcher.py", line 50, in fetchDataForTickerSymbol
rpc.result()
File "C:\Users\MrHappyAsthma\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\_base.py", line 432, in result
return self.__get_result()
File "C:\Users\MrHappyAsthma\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\_base.py", line 388, in __get_result
raise self._exception
File "C:\Users\MrHappyAsthma\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\MrHappyAsthma\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\MrHappyAsthma\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 650, in send
r = dispatch_hook('response', hooks, r, **kwargs)
File "C:\Users\MrHappyAsthma\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\hooks.py", line 31, in dispatch_hook
_hook_data = hook(hook_data, **kwargs)
File "D:\GitHub\Rule1-StockScreener\IsThisStockGood\src\DataFetcher.py", line 204, in parse_morningstar_finances
success = self.ratios.parse_finances(parsed_content.split('\n'))
AttributeError: 'NoneType' object has no attribute 'parse_finances'
Not exactly sure how it's possible to crash on this line:
https://github.com/mrhappyasthma/IsThisStockGood/blob/master/src/DataFetcher.py#L204
When we ensure it's non-nil here:
https://github.com/mrhappyasthma/IsThisStockGood/blob/master/src/DataFetcher.py#L202
I'm seeing this error now. Likely because of the change from CSV to scraping that data.
The tooltips were disabled in 102e3c1
The UI as a whole is super minimalistic. It could use some serious UX love.
It expects them with a hyphen BRK-B
.
This should be in the morningstar data already. Just need to surface it.
This could be useful for folks to know when it is a good time to sell. Perhaps can just be mentioned in part of the "margin of safety" price.
thank you for your great work
Something must be going wrong with the data fetching. I need to look further into it, but seems to be failing for all queries.
PBT? MOS? or 10cap?
Raw data can be found here: http://www.econ.yale.edu/~shiller/data.htm
However can we exploit this site's data: http://www.multpl.com/shiller-pe/
I noticed that all requests are returning empty data for most requests. I suspect the morningstar scraping is failing.
Hi,
I see that the margin of safety is calculated based on the Trailing 12 Months EPS.
Do you think that the FCF per share is more reliable? Or the 3-year average EPS reflects better the company long-term performance in the future?
For example, ATKR and AMD have surprisingly high EPS in 2021 because of the pandemic but that does not necessarily reflect the long-term trend.
To avoid risky stocks with low liquidity, it will also be nice to check on market cap / trade volume, per the appendix chapters of Rule #1. I have a spot for this in the UI, but don't populate it with any info yet.
DIS
(disney) stock is failing to parse EPS averages.
The logs themselves don't have a lot of context, so I'll need to reproduce locally and then debug further.
FWIW - morningstar seems to have the appropriate data. So something must be going wrong.
This seems to be a problem after 6a61151
If morningstar reports no long term debt (i.e. '-') then this should be treated as 0
. Otherwise the UI looks a bit wonky.
The payback time calculation is basically how long until you get all your money back based on earnings of a company compared to market cap (from PaybackTime book by Phil Town).
marketCap = 17680
yearlyIncome = 2115
rate = 0.12
totalPayback = 0
years = 0
while (totalPayback < marketCap):
if yearlyIncome <= 0 or rate <= 0:
years = -1
break;
yearlyIncome += (yearlyIncome * rate)
totalPayback += yearlyIncome
years += 1
print(years)
Traceback (most recent call last):
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "D:\GitHub\IsThisStockGood\main.py", line 28, in search
template_values = fetchDataForTickerSymbol(ticker)
File "D:\GitHub\IsThisStockGood\src\DataFetcher.py", line 60, in fetchDataForTickerSymbol
margin_of_safety_price, sticker_price = _calculateMarginOfSafetyPrice(ratios, pe_ratios, yahoo_finance_analysis)
File "D:\GitHub\IsThisStockGood\src\DataFetcher.py", line 134, in _calculateMarginOfSafetyPrice
margin_of_safety_price, sticker_price = \
TypeError: cannot unpack non-iterable NoneType object
Line: https://github.com/mrhappyasthma/IsThisStockGood/blob/master/src/DataFetcher.py#L134
Root cause is that the function can return None:
I suspect this needs to return None, None
.
Example ticker AMCR
.
This will be useful for headless usage of the calculations on the site.
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/en-us/money/stockdetails/analysis/fi-a1slm7?symbol=fb">here</a>.</h2>
</body></html>
Has a free tier API. They don't have the most up-to-date financial info, but should work great for background on the company.
https://api.polygon.io/v1/meta/symbols/BABA/company?apiKey=<key>
This one is trickier. Haven't found a good way to format the URL. It seems to be:
https://www.msn.com/en-us/money/stockdetails/analysis/fi-126.1..<abbreviation_for_stock_exchange>.
We'd also need to scrape the price ratios. Ideally this would be a csv download of some sort, but cant seem to find one.
Seems like they updated the csv downloads to be dynamically generated such that they cannot be requested via urlfetch.
A workaround might be with the following JSONP queries:
The initial implementation shows the ROIC growth rate, but the book recommends just looking at the averages.
This will be a more consistent experience with the valuation methods in the book.
For instance HOME stock is showing positive growth rate for FCF, but really it's getting more and more negative.
Title.
Perhaps the input should be customized. The first will be a dropdown selector allowing the user to choose the market of the stock. The second will be a text input where the user can type the ticker of the stock.
This can be fetched from the YahooFinance modules. See more details in #3
We could consider even trying to write end-to-end tests that actually fetch data from a production URL, too. But then the asserts need to be fuzzy since we won't be able to have an expected output that's fixed.
The sandbox environment of Intrino provides some useful metrics:
Market Cap
https://api-v2.intrinio.com/data_point/AAPL/marketcap/number?api_key=
Description
https://api-v2.intrinio.com/data_point/AAPL/short_description/text?api_key=
The direct URLs no longer work. Seems to be a refactoring of their website.
However I found out that local library cards get free premium access, so I should be able to reuse that ID to make premium requests.
The biggest drawback is that I need to send a dummy request for the ticker symbol in order to parse out the unique ticker ID that the API requires. I have not found a more robust way to do this.
This also is subject to breaking if the url ever changes.
Background on this approach: https://stackoverflow.com/a/57449982/1366973
It would be useful to display the cash on hand for companies, and how that compares to their debt. It could go under Management where we show debt/equity.
On app engine the data fetches tend to be slow. Particularly the first time the instance is spun back up (it seems).
It would be nice to show some kind of loading spinner of "fetching data" affordance to users.
The size of the cells in the table do not fit the contents that get updated via javascript.
iframe the docs: https://doc.morningstar.com/companydoc.aspx?ticker=CMG
Not sure what's wrong in the calculation but noticed DPZ has tons of debt but shows -1 and green on the site.
My guess here might be 'yes'.
Other Long-Term Liabilities is broken out in the morningstar data, but I believe these are also long term debt: https://www.investopedia.com/terms/o/otherlongtermliabilities.asp
More research may be needed.
The yahoo_finance_analysis
still exists, but yahoo_finance_analysis.five_year_growth_rate
is null.
This is occurring even for tickers with valid data. E.g. https://finance.yahoo.com/quote/FB/analysis?p=FB
I need to determine a good TTL, but a cache layer might be nice for speed and to avoid external URL fetch costs.
Data updates, at most, once a quarter. So caching for week or maybe months at a time is probably pretty safe without losing much accuracy.
https://fred.stlouisfed.org/graph/?g=qLC
Has CSV data link. Probably need to parse it via BeautifulSoup
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.