PEG Ratio Strategy (US Market)
Strategy Overview
The PEG ratio (Price/Earnings to Growth) measures whether a stock's price is reasonable relative to its earnings growth rate. A lower PEG suggests the stock is undervalued given its growth prospects.
This strategy has two components:
- Revenue Trend Filter: 3-quarter average revenue / 12-quarter average revenue > 1.1, and current quarter revenue is at least 90% of the prior quarter. This ensures the company has an upward revenue trajectory.
- PEG Ranking: Among stocks passing the revenue filter, select the 10 with the lowest PEG ratio.
from finlab import data
from finlab.backtest import sim
from finlab.market import USMarket
data.set_market('us')
close = data.get('price:adj_close')
close = close[close.index.dayofweek < 5] # remove weekends
# Revenue data from US income statement
revenue = data.get('us_income_statement:revenue')
rev_ma3 = revenue.average(3)
rev_ma12 = revenue.average(12)
# Revenue trend filter
cond1 = rev_ma3 / rev_ma12 > 1.1
cond2 = revenue / revenue.shift(1) > 0.9
cond_all = cond1 & cond2
# PE ratio and earnings growth
pe = data.get('us_key_metrics:peRatio')
net_income = data.get('us_income_statement:netIncome')
earnings_growth = net_income / net_income.shift(4) - 1
# PEG ratio = PE / Earnings Growth Rate (in %)
peg = pe / (earnings_growth * 100)
# Multiply PEG by revenue condition; non-qualifying stocks become 0
position = peg * cond_all
# Remove stocks that do not pass the revenue filter
# Without this line, is_smallest might fill remaining slots with non-qualifying stocks
position = position[position > 0]
# Select the 10 stocks with the lowest PEG
position = position.is_smallest(10)
report = sim(position, resample='M', stop_loss=0.1,
market=USMarket(), fee_ratio=0.001, tax_ratio=0)
report.display()
Key Parameters
rev_ma3 / rev_ma12 > 1.1: The 3-quarter moving average of revenue must exceed the 12-quarter average by at least 10%. This confirms an accelerating revenue trend rather than a one-time spike.revenue / revenue.shift(1) > 0.9: Current quarter revenue must be at least 90% of the prior quarter, preventing sudden revenue collapses from entering the portfolio.pe / (earnings_growth * 100): Computes PEG by dividing the P/E ratio by the year-over-year earnings growth rate expressed as a percentage. A PEG of 1.0 is often considered "fair value"; below 1.0 suggests the stock is cheap relative to its growth.position[position > 0]: Filters out stocks with zero or negative PEG values. This is critical -- without it,is_smallestcould select non-qualifying stocks to fill the 10-stock target.is_smallest(10): Selects the 10 cheapest stocks by PEG among those passing the revenue filter.stop_loss=0.1: A 10% stop-loss protects against rapid declines in individual holdings.resample='M': Monthly rebalancing to incorporate the latest quarterly earnings data.
Expected Behavior
The PEG strategy targets growth at a reasonable price (GARP). By requiring both revenue momentum and low PEG, it avoids two common pitfalls: (1) buying cheap stocks with deteriorating fundamentals, and (2) overpaying for high-growth stocks. The 10% stop-loss provides downside protection for individual positions. In the US market, where earnings growth data is reported quarterly, the strategy naturally updates its selections as new financial data becomes available. This approach tends to perform well during periods of earnings-driven market rallies and may underperform during speculative momentum bubbles where valuations are ignored.