Back to Community
PE Ratio

Hi
How do set a filter for pe ratio<30
Thanks

4 responses

Simple way to make a filter is first create a factor and then construct a filter using basic operators. Something like this.


# Create a factor to get the latest pe_ratio  
pe_ratio = Fundamentals.pe_ratio.latest

# Now create a filter from that factor  
pe_lt_30 = pe_ratio < 30

See the attached notebook.

Good luck.

Loading notebook preview...
Notebook previews are currently unavailable.

Thanks Dan!
How do I add another filter for
Forward P/E Ratio < P/E Ratio
?

In a similar fashion one can keep adding filters.


# Create a factor to get the latest pe_ratio and forward_pe_ratio  
pe_ratio = Fundamentals.pe_ratio.latest  
forward_pe_ratio = Fundamentals.forward_pe_ratio.latest

# Now create filters from those factors  
pe_lt_30 = pe_ratio < 30  
forward_pe_lt_pe = forward_pe_ratio < pe_ratio

Often the biggest issue is understanding which data to use. Take a look at the fundamentals reference page for help https://www.quantopian.com/help/fundamentals .

See attached notebook.

Loading notebook preview...
Notebook previews are currently unavailable.

BTW

How do I access dividend_rate?