The Price to Earnings ratio, also known as the P/E ratio, is the ratio of a company's market price per share to the company's earnings per share.

\[P/E \ Ratio =\frac{p}{EPS}\]

where \(p\) is the stock price and \(EPS\) is the earnings per share from the most recent financial year. The P/E ratio is often used by investors to determine the valuation of a company's stock. Research suggests that a portfolio that consists of stocks with relatively low P/E ratio outperforms a portfolio that consists of stocks with relatively high P/E ratio.


We pick the 10 stocks that have the lowest P/E ratio in our universe, at the beginning of each year, and we invest an equal amount of capital in each stock.

To construct the universe, first, we eliminate stocks which don't have fundamental data and stocks that have a lower price than $5 per share, using the CoarseSelectionFunction.

def CoarseSelectionFunction(self, coarse):

    if self.Time.year == self.year:
        return self.symbols

    # drop stocks which have no fundamental data or have low price
    CoarseWithFundamental = [x for x in coarse if x.HasFundamentalData and x.Price > 5]
    sortedByDollarVolume = sorted(CoarseWithFundamental, key=lambda x: x.DollarVolume, reverse=False) 

    return [i.Symbol for i in sortedByDollarVolume[:self._NumCoarseStocks]] 

Then, in the FineSelectionFunction, we retrieve the list of 10 stocks, that have the lowest P/E ratio.

def FineSelectionFunction(self, fine):

    if self.Time.year == self.year:
        return self.symbols

    self.year = self.Time.year

    fine = [x for x in fine if x.ValuationRatios.PERatio > 0]
    sortedPERatio = sorted(fine, key=lambda x: x.ValuationRatios.PERatio)

    self.symbols = [i.Symbol for i in sortedPERatio[:self._NumStocksInPortfolio]]
    return self.symbols

In OnData(), we buy the 10 stocks that have the lowest P/E ratio in our universe. We rebalance the portfolio at the beginning of each year.


The portfolio significantly outperforms the benchmark, S&P 500, during the three and half years backtest period, from the beginning of the year 2016 to July of the year 2019.

The universe of stocks is filtered using dollar volume and price criteria. Most of the stocks chosen by the algorithm during the backtest period are small market capitalization stocks.

In theory, there is an additional factor to the small P/E ratio factor contributing to the excess returns of the portfolio relative to the benchmark. This additional factor is known as the size factor, where size in this respect, is the market capitalization of a stock.

Ranking portfolios on market capitalization and subsequently tracking their performance has demonstrated that portfolio of stocks with a small market capitalization outperforms a portfolio of stocks with large market capitalization. Another investment strategy in the strategy library, Small Market Capitalization Stock Premium, demonstrates how to form a portfolio that only consists of stocks with relatively low market capitalization.


  1. Persson E, Ståhlberg C (2006). P/E and EV/EBITDA Investment Strategies vs. the Market (Master's thesis, Linköping University, Linköping, Sweden). Online Copy
  2. Fama, Eugene F. and French, Kenneth R., Multifactor Explanations of Asset Pricing Anomalies. J. OF FINANCE, Vol. 51 No. 1, March 1996. Available at SSRN: