Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How To Weight By Fundamental Value?

Hi,

I was wondering if it was possible to weight the stocks by their FCF Yield value.

I know it would be something along the lines of:

weight = (this_stocks_value)/(sum_of_all_values)  

However, I'm not entirely sure how to do this, can someone show me how? I'm aiming to assign a higher weight to stocks with a higher FCF Yield.

4 responses

Some routes to consider, log values preview, and comments in the code.

I would use this:

def to_weights(factor):  
    demeaned_vals = factor - factor.mean()  
    return demeaned_vals / demeaned_vals.abs().sum()  

Ah, I forgot. The pipeline factors have the .zscore() method too.

Thank you very much for your help