I'm confused about the output this snippet of factor code is giving me in Research. FCF and IC both produce real values, but the CROIC ends up being NAN.
class CROIC(CustomFactor):
window_length = 1
inputs = [morningstar.cash_flow_statement.free_cash_flow, morningstar.balance_sheet.invested_capital]
def compute(self, today, assets, out, fcf, ic):
results = fcf[-1]/ic[-1]
out[:] = results[-1]
class Testme(CustomFactor):
window_length = 1
inputs = [morningstar.cash_flow_statement.free_cash_flow, morningstar.balance_sheet.invested_capital]
outputs = ['fc', 'i']
def compute(self, today, assets, out, fcf, ic):
out.fc[:] = fcf[-1]
out.i[:] = ic[-1]
croic = CROIC()
fcf, ic = Testme()
pipe.add(fcf, 'fcf')
pipe.add(ic, 'ic')
pipe.add(croic, 'CROIC')
2016-01-04 00:00:00+00:00
CROIC fcf ic
Equity(24 [AAPL]) NaN 9.817000e+09 1.838170e+11
Equity(700 [BAC]) NaN 3.466000e+10 5.054380e+11
Equity(3149 [GE]) NaN - -8.460000e+08 3.864000e+11
Equity(16841 [AMZN]) NaN 1.415000e+09 2.067300e+10
Equity(23709 [NFLX]) NaN - -2.482560e+08 4.567318e+09
Equity(42950 [FB]) NaN 1.412000e+09 4.142000e+10
Any idea what I'm doing incorrectly? I appreciate the help.