Hi
How do set a filter for pe ratio<30
Thanks
Hi
How do set a filter for pe ratio<30
Thanks
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.
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.