Back to Community
Single Parameter to Custom Filter -- bug??

If params is a list with only one argument -- it complains -- with two elements it works. Is this a bug? Any work around besides adding a dummy second argument??

class Prices(CustomFactor):

params = ('sel')  
inputs = [USEquityPricing.open, USEquityPricing.close]  
window_length = 1

def compute(self, today, assets, out, open, close, sel):  
    out[:] = sel  
1 response

Any custom factors (one or more) need to be defined as a list. The following will work with a single parameter. Note the brackets around 'sel'.

params = (['sel'])  
inputs = [USEquityPricing.open, USEquityPricing.close]  
window_length = 1

def compute(self, today, assets, out, open, close, sel):  
    out[:] = sel