mrhappyasthma / IsThisStockGood

A tool for evaluating companies using the Rule #1 investing principles.
http://www.isthisstockgood.com
25 stars 12 forks source link

Add payback time calculation #4

Closed mrhappyasthma closed 3 years ago

mrhappyasthma commented 5 years ago

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)
mrhappyasthma commented 5 years ago

The goal here is to be <6 is great, <8 is good, <10 solid. >10 ehhh

mrhappyasthma commented 5 years ago

Added the calculation and test here: https://github.com/mrhappyasthma/IsThisStockGood/commit/b642061a587c4c542baf4a1c07c8867ff621d7e0

Still need to integrate this calculation into the website.

mrhappyasthma commented 3 years ago

It appears the marketCap still needs to be parsed. It's the only parameter missing for this calculation.

I also need to decide how to color code this. If it's >10 is that 'bad' or just 'not a good candidate for payback time'. Also how to differentiate between 'great', 'good'. 'solid'.

To be honest I may need to re-read parts of Payback Time to refresh my memory on how these are distinguished.

mrhappyasthma commented 3 years ago

An alternative to using TTM Net Income and Market Cap would be to use EPS and Stock Price as proxies. The calculation is essentially the same.

Although I already have this implemented, so there's no real benefit to changing it now. (It could avoid parsing the TTM Net income. But I am gonna need to parse the Market Cap anyway. So let's just leave it.)