Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Unknown Error Help

Hi, I got this unknown error. Anyone have any ideas? Thanks so much, it's my first time here.

Here's the source code:

# Custom Factor for 10 day trading range  
class TenDayRange(CustomFactor):  
    """  
    Computes the difference between the highest high in the last 10  
    days and the lowest low.

    Pre-declares high and low as default inputs and `window_length` as  
    10.  
    """

    inputs = [USEquityPricing.high, USEquityPricing.low]  
    outputs = ['range_low_price','range_percent']  
    window_length = 10

    def compute(self, today, assets, out, highs, lows):

        highest_highs = nanmax(highs, axis=0)  
        lowest_lows = nanmin(lows, axis=0)  
        out.range_low_price[:] = lowest_lows  
        out.range_percent[:] = (highest_highs - lowest_lows) / lowest_lows

# Doesn't require passing inputs or window_length because they're  
# pre-declared as defaults for the TenDayRange class.

ten_day_range.range_percent = TenDayRange(mask=tradeable_stocks)  
ten_day_range.range_low_price = TenDayRange(mask=tradeable_stocks)  
# Filter using Custom Factor of 10 day range, filtering by under 5%  
valid_ten_day_range = (ten_day_range.range_percent < 0.05)  
# Custom Factor for 52 week high  
class FiftyTwoWeekHigh(CustomFactor):  
    """  
    Computes the highest high in the last X weeks.

    Pre-declares `window_length` as 52.  
    """

    inputs = [USEquityPricing.high]  
    window_length = 252

    def compute(self, today, assets, out, highs):  
        highest_highs = nanmax(highs, axis=0)  
        out[:] = highest_highs  
fifty_two_week_high = FiftyTwoWeekHigh(mask=valid_ten_day_range)  
# Filter for average of 10 day range within 10% of 52 week high  
under_52_week_high = ((fifty_two_week_high - ten_day_range.range_low_price)  
                      / ten_day_range.range_low_price) < 0.1  
def make_pipeline():  
    return Pipeline(  
    columns={  
      '10 day average price': ten_day_range.range_low_price,  
      '52 week high': fifty_two_week_high,  
      'difference': (fifty_two_week_high - ten_day_range.range_low_price) / ten_day_range.range_low_price  
    },  
    screen=under_52_week_high  
  )  
my_pipe = make_pipeline()  
result = run_pipeline(my_pipe, '2017-04-24', '2017-04-24')  
result