Hi,
I'm trying to calculate the earnings growth over a 5 year period as measured by a CAGR. When I go more then a year out in my lookback window, performance really suffers. Is there a way to jump back to a specific spot in time without grabbing all the data in between?
class EarningsCAGR(CustomFactor):
inputs = [morningstar.income_statement.net_income_from_continuing_and_discontinued_operation, morningstar.valuation.shares_outstanding]
window_length = 252*5
def compute(self, today, assets, out, income, shares):
Q1 = income[-1] / shares[-1]
Y5 = income[0] / shares[0]
out[:] = ((Q1 / Y5) ** (1/5)) - 1 # annualized CAGR formula
Thank you!