mrhappyasthma / IsThisStockGood

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

Fetch pe ratios from stockrow #58

Closed losgrandes closed 1 year ago

losgrandes commented 1 year ago

HI! MSN Money stopped to provide 5-Yeah High and 5-Year Low P/E. See https://github.com/mrhappyasthma/IsThisStockGood/issues/57.

I've changed code to pull these values from StockRow. Thus MSNMoney.py was removed.

It's not ideal, cause StockRow doesn't always have correct PE values, but it's better (?) than nothing. Code ignores zeroes for PE ratios. Not sure if user should be somewhat aware of this. Currently code doesn't throw a warning for this.

I'm new into Rule#1 principles, so please review my code with patience and meticulousness.

Thanks for this app! Appreciate it.

mrhappyasthma commented 1 year ago

Thanks for taking a stab at this. I'll try to get a code review sometime this week so we can get the site (mostly) back to full functionality again. :)

losgrandes commented 1 year ago

I got a feeling that skipping zero PE ratios for 5y average is dangerous. If all PE ratios for the last 5 years are zeroes, it skips generating Sticker Price and Margin of Safety Prices. Although, if at least one PE ratio isn't zero, it generates these prices. If we want to rely on PE Ratios > 0 only, we'll end up with small percentage of successfully generated prices (that's what I assume by doing some manual polls on stockrow).

mrhappyasthma commented 1 year ago

If I understand the concern correctly, I think there are three cases:

  1. No data at all ==> skips generating sticker price
  2. Full data ==> generates sticker price accurately
  3. Partial/limited data ==> generates a non-0 sticker price which may be quite inaccurate.

I believe the # 1 and # 2 are "working as intended". I believe the concern is around # 3.

If I understood that concern properly, my take is that we can just add some kind of heuristic. Such as 'the data must be at least X years old. and we must have at least N data points to average for a minimum sample size'.

Determining what should be X and what should be N will be tricky. And any heuristic we make will be a tradeoff between: not generating a sticker price for a lot of tickers versus better coverage for sticker price generation but less accuracy.

mrhappyasthma commented 1 year ago

Potentially tangential to this: I took a quick look at MSN Money, and the data we used to use is actually still available. The tricky part is that they use an ID instead of a ticker symbol. And I haven't yet found a good way to scrape the ID for a given ticker.

But if we can figure that out, we may be able to reuse the MSN Money data for better coverage. (more details: https://github.com/mrhappyasthma/IsThisStockGood/issues/57#issuecomment-1324354784).

That said, we could still potentially use stockrow as an automatic fallback even if we bring back MSN Money data.

For example:

losgrandes commented 1 year ago

Thanks. Let me look at the MSN approach instead.