I'm a quantopian newbie. I've coded a custom function for Scaled Total Accrual (STA), which helps detect earning manipulators, and used in Grey and Carlisle's Quantitative Value. In a research notebook, this custom factor executes well, but running the pipline fails. Following is my code, and the error I'm receiving. It would be great if any savvy user can point me to what I may be doing wrong. Thanks.
My code for the custom factor:
#STA custom factor
# aliases were defined for the inputs but I did not copy them here
class sta_factor(CustomFactor):
inputs = [current_assets, cash_eq,current_liabilities,
depreciation, tot_assets, tot_debt,
LT_debt_lease, change_tax_payable
]
window_length = 252
def compute(self, today, assets, out, inputs):
out[:] = ((current_assets[-1]-current_assets[0]) -
(cash_eq[-1]-cash_eq[0]) - (
(current_libilities[-1]-current_liabilities[0]) -
((tot_debt[-1]-tot_debt[0])-(LT_debt_lease[-1]-LT_debt_lease[0]))
# - (change_tax_payable[-1] - change_tax_payable[0])
) -
depreciation[-1]) / tot_assets[-1]
My code for the pipeline:
my_screen = MarketCap() > 1e11
pipe = Pipeline(
columns={'STA' : sta_factor(),
'market_cap' : MarketCap()
},
screen=(my_screen),
)
run_pipeline(pipe, start_date='2015-11-01', end_date='2015-11-01')
The error I'm getting:
NotImplementedError Traceback (most recent call last)
in ()
6 screen=(my_screen),
7 )
----> 8 run_pipeline(pipe, start_date='2015-11-01', end_date='2015-11-01')
/build/src/extensions/extensions/main.py in run_pipeline(pipeline, start_date, end_date)
396 start_date=adjust_date,
397 end_date=adjust_date,
--> 398 )
399 def run_pipeline(pipeline, start_date, end_date):
400 """
/build/src/extensions/extensions/main.py in run_pipeline(pipeline, start_date, end_date)
404 PipelineEngine.run_pipeline.
405 """
--> 406 return engine.run_pipeline(pipeline, start_date, end_date)
407 return run_pipeline
408
/build/src/qexec_repo/zipline_repo/zipline/pipeline/engine.pyc in run_pipeline(self, pipeline, start_date, end_date)
171 dates,
172 assets,
--> 173 initial_workspace={self._root_mask_term: root_mask_values},
174 )
175
/build/src/qexec_repo/zipline_repo/zipline/pipeline/engine.pyc in compute_chunk(self, graph, dates, assets, initial_workspace)
360 mask_dates,
361 assets,
--> 362 mask,
363 )
364 if term.ndim == 2:
/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in compute(self, windows, dates, assets, mask)
191 inputs = format_inputs(windows, inputs_mask)
192
--> 193 compute(date, maskedassets, out_row, *inputs, **params)
194 out[idx][out_mask] = out_row
195 return out
/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in compute(self, today, assets, out, *arrays)
124 Override this method with a function that writes a value into out
.
125 """
--> 126 raise NotImplementedError()
127
128 def _allocate_output(self, windows, shape):
NotImplementedError: