The Greenblatt Screener is a small, practical implementation of Joel Greenblatt’s Magic Formula investing framework.
The idea behind the Magic Formula is simple. You want businesses that are both cheap and good. Cheap in the sense that you are paying a low price for operating earnings. Good in the sense that the business earns strong returns on the capital it employs.
This screener ranks companies by combining those two ideas into a single list.
It uses two core measures:
- Earnings Yield: EBIT / Enterprise Value - a way of asking how cheaply the entire business can be purchased.
- Return on Tangible Capital: EBIT / (Net Working Capital + Net Fixed Assets) - a way of measuring how efficiently the business turns operating assets into profit.
Each company is ranked on both dimensions, and the combined ranking produces a shortlist of candidates.
Example output:

How it works
The script takes a list of tickers and pulls financial statement data using external data sources. It calculates earnings yield and return on capital for each company, ranks them independently, then combines the rankings into a final score.
The output is a simple table rather than a prediction. It does not tell you what will work. It narrows the field to companies that meet a specific economic profile.
A typical output looks like this:
- Stock A - high returns on capital and a low enterprise multiple
- Stock B - solid operating efficiency at a reasonable price
- Stock C - an asset-light business priced below peers
The list is a starting point, not a conclusion.
Why it matters
Most investors struggle because they mix good businesses with bad prices, or cheap prices with poor businesses.
Greenblatt’s framework forces discipline. It removes stories and narratives and replaces them with two questions that matter over long periods of time: how good is the business, and how much am I paying for it?
This tool makes that discipline repeatable. You can adjust inputs, change universes, test variations, or simply use it to understand why certain companies rise to the top of the list.
Sample portfolio
To see how the output behaves in practice, the screener was run across London’s AIM All-Share universe below a £400m market capitalisation.
The top ten ranked companies were selected into a simple, equal-weighted model portfolio.
Usage
Clone the repository and run:
python Greenblatt-Screener.py
