Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Trying to compute the distance between 52 week high and current price

I trying to set up a custom factor that is the distance between current price and 52 week high. Here is the code.

class HighPrice(CustomFactor):
window_length=252
outputs=["high"]
inputs=[USEquityPricing.close]

def compute(self, today, assets, out, close):  
    out.high[:] = (np.nanmax(close, axis=0) - close[-1]) / close[-1]

I get an error in the research note book

ValueError: unknown type record64

1 response

Resolved the issue.