I'm in the process of building a Python library to value stocks using a FCF model and one of the first steps is calculating an implied equity premium. I know there a few ways of doing this, but looking at previous correlations (current implied ERPs apparently have 0.763 correlation to next year's implied premium, historical ERP has -0.497) it seems like a cash-flow based valuation model on an index like the S&P 500 is the most reliable way to calculate ERP.
Following Aswath Damodaran's notes and spreadsheet, I collected a list of dividends and stock buy-backs for the S&P 500 for the past 10 years in order to get the TTM and previous years cash to equity. However it's quite toilsome to populate this data because S&P release it in Excel spreadsheets and PDF documents every quarter. Here are some examples:
This got me thinking:
Are there any APIs to retrieve historical dividends and stock buybacks per quarter or year? It seems the dividend yield is widely published but that doesn’t include buybacks (I also couldn’t find a reliable data source). I'm also wondering if there's a way to calculate this for any world index like the FTSE 100 or Nikkei.
Are there any APIs to retrieve the overall market cap of an index? I know this can be done for the S&P 500 with its index divisor and current price, but the divisor changes every quarter and I want to automate where possible.
Are there any ways to retrieve earnings growth forecasts for indexes? I’ve found some in S&P and GS press releases but I’m wondering if I can find a growth rate more consistently from a specific source. I guess I could compare 2020 earnings to 2010 and use that historical rate.