SimFin Screener and Backtesting Tutorial
Full tutorial covering basics and advanced topics.
Dynamic Filter and Scoring Values
When defining filters or scorings, you can not just choose "static" values (such as Revenues > 100M) but you can also define "dynamic" values such as Revenues > Median, or Revenues in the top 10th percentile.
The key concept to understand here is that filters and scorings are applied sequentially, that is first all filters are applied and then the scorings relate to all companies AFTER filtering.
Let's look for example at the 1 year revenue growth rates. Let's define a filter with revenue growth > Median:
We can see that now around 1600 companies are left for the current time period. 50% of all companies have been filtered out due to the filter and some more due to missing data points (might be companies that were trading in the past and have been delisted, we keep these to make the backtesting results accurate and avoid "survivorship bias").
Let's now create a scoring on top of the filter with again revenue growth > Median:
We can see that the number of companies is still the same now as before. This is because "scorings" don't filter out companies directly, but rather show in the value table if the scoring is positive or negative (and also add up to a "Total Score"). That's why some scorings in the table are also negative.
Let's create a filter now for the "Total Score" which is shown in the last column of the table.
As we just have one scoring, we can just set the filter for the total score to "equals 1":
We can see now that there are only 821 companies left, exactly half of the companies we had before. This is because the scoring condition is calculated AFTER the filters are applied. So when we first filtered for companies with revenue growth > median, the median is calculated on ALL the companies in the universe. When the scoring is calculated, the median is calculated on all companies AFTER filtering, so the median is essentially calculated twice: once on all the companies, and once only on the companies that are left after all filters have been applied.
We do this so that you can for example create portfolios such as: FILTERS: All companies in the tech sector that are profitable (net profit > 0)
SCORINGS: Revenue growth > Median
TOTAL SCORE FILTER: Scoring = 1
The result is: All companies in the tech sector that are profitable (net profit > 0) AND that have an above average revenue growth rate (only looking at profitable tech companies to compute the average).
Backtesting
"Backtesting" is basically trying to answer the question: "For a given strategy, what would be the value of my portfolio today if I would have continuously invested according the filters defined in the strategy?".
The important thing to understand is that we calculate the portfolio composition for the backtesting not just once, but many times over the backtesting period depending on the "reshuffle interval".
Let's say we want to test the performance of a strategy like "Revenue growth rate (1 year) bigger than 10%.
If the backtests starts in 2010 for example and the reshuffle period is weekly, we go back in the past starting in 2010 and every week we check which companies at that point in the past have a revenue growth rate over 10% and we only keep these in the portfolio.
We then simulate holding all the companies in the portfolio for the duration of the "reshuffle period" and then check the stock price increase/decrease over the period. We make the average for the portfolio and then repeat this process until reaching the end date of the backtesting period.