Hi,
how can I would like to create a custom factor, which calculates the value of a certain percentile for me:
class Quantile_today(CustomFactor):
window_length=1
def compute(self, today, assets, out, values,quantile):
out[:] = np.percentile(values[-1],quantile)
I then tried to pass into that Custom factor the following value:
def Q_today():
return Quantile_today(inputs=[Fundamentals.pe_ratio,50])
I then get an attribute error:
AttributeError: 'NoneType' object has no attribute 'format'
I would have expected to get the median value of each time stamp across all stocks that were present at that time stamp.
How can I create a custom factor and pass in other inputs, such as which percentile I want? Obviously this is a simplified example to get my point across and in the end I would like to build a more elaborate custom factor.