Hi,
I want to get the past 12 earnings data. These are slow moving factors and don't change everyday. Unfortunately if I try this:
class Quality(CustomFactor):
inputs = [morningstar.income_statement.gross_profit, morningstar.balance_sheet.total_assets]
window_length = 500
def compute(self, today, assets, out, gross_profit, total_assets):
norm = gross_profit * 1.0 / total_assets
out[:] = (norm[-1,:] - np.mean(norm, axis=0)) / np.std(norm, axis=0)
It runs out of memory. Ideally I had like to do something like this:
class Quality(CustomFactor):
inputs = [morningstar.income_statement.gross_profit, morningstar.balance_sheet.total_assets]
window_length = 12 # quarters
def compute(self, today, assets, out, gross_profit, total_assets):
norm = gross_profit * 1.0 / total_assets
out[:] = (norm[-1,:] - np.mean(norm, axis=0)) / np.std(norm, axis=0)