Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Fundamentals min max values

I am trying to normalize the values that I get using fundamentals data (ie: pe_ratio = Fundamentals.pe_ratio.latest ).
How can I extract the maximum || minimum value for the pe_ratio for example in the past x days? This would be done withing the pipeline if it makes a difference.
Thank you for any help (or pointers) that can be provided.

1 response

function:
class min_year(CustomFactor):
window_length = 365
def compute(self, today, assets, out, inputs):
out[:] = np.nanmin(inputs[-365], axis=0)
pass to it the data in which to find the min:
m = min_year(inputs=[Fundamentals.pe_ratio])