US examples
Quality small caps
On this page4
Small-cap stocks can deliver outsized returns when they are picked with fundamental quality filters. This strategy screens US small caps on cash flow, profitability, growth and valuation, and suits investors seeking long-term capital appreciation from small caps with the discipline of quality screens.
Strategy logic
A stock is held only when it meets all five conditions at once:
- Market cap under $2 billion: small caps tend to have more room for excess returns than large caps.
- Free cash flow above 0: the company generates real cash, not just accounting profits. Free cash flow is operating cash flow minus capital expenditure, averaged over 4 quarters to smooth out seasonal swings.
- ROE above 0: the company is profitable.
- Revenue growth above 0: revenue is growing year over year, a sign of business momentum.
- Price-to-sales under 5: the valuation is not excessive, which avoids stocks priced at extreme multiples of their revenue. Price-to-sales is daily market cap divided by trailing four-quarter revenue.
Every qualifying stock gets an equal weight, and the portfolio rebalances monthly.
Code
strategy.py
from finlab import data
from finlab.backtest import sim
from finlab.markets.us import USMarket
data.set_market('us')
close = data.get('price:adj_close')
close = close[close.index.dayofweek < 5] # remove weekends
# Market capitalization
marketcap = data.get('etl:us_market_value')
# Free cash flow (operating cash flow - capital expenditure), smoothed over 4 quarters
operating_cf = data.get('us_cash_flow:operating_cash_flow')
capex = data.get('us_cash_flow:capital_expenditure')
free_cash_flow = (operating_cf - capex.abs()).rolling(4).mean()
# ROE from financial statements
net_income = data.get('us_income_statement:net_income')
equity = data.get('us_balance_sheet:total_stockholders_equity')
roe = net_income / equity
# Revenue growth (YoY)
revenue = data.get('us_income_statement:revenue')
revenue_growth = revenue / revenue.shift(4) - 1
# Price-to-Sales ratio
trailing_revenue = revenue.rolling(4).sum()
ps_ratio = marketcap / trailing_revenue
# All five conditions must be met
condition1 = marketcap < 2e9
condition2 = free_cash_flow > 0
condition3 = roe > 0
condition4 = revenue_growth > 0
condition5 = ps_ratio < 5
position = condition1 & condition2 & condition3 & condition4 & condition5
report = sim(position, resample='M', market=USMarket(), fee_ratio=0.001, tax_ratio=0)
report.display()How to adjust it
marketcap < 2e9: under $2 billion, a common definition of a US small cap.free_cash_flow > 0: positive free cash flow. The 4-quarter rolling mean smooths out lumpy capital expenditure cycles.roe > 0: a basic profitability check. Companies with negative ROE are often distressed, or in early-stage growth without earnings.revenue_growth > 0: compares this quarter's revenue with the same quarter a year ago (a shift of 4 quarters).ps_ratio < 5: keeps the portfolio away from highly speculative, overvalued names.resample='M': monthly rebalancing picks up new quarterly financial data promptly.
Related pages
- Penny stock risk filter Add price, volume and size floors to any strategy.
- PEG ratio strategy Growth at a reasonable price, ranked by PEG.
- ADR financial filter Cash-flow quality, without foreign listings.
- Load more data Find US statement fields with
data.get()anddata.search().
Was this page helpful?