Docs
Open Studio

US examples

REIT sector strategy

On this page4

Sector strategies use financial metrics that mean most within one industry. Real Estate Investment Trusts (REITs) and real estate companies have distinctive traits (steady rental income, high dividend yields and sensitivity to interest rate cycles) that suit targeted fundamental screening. This strategy works only within the Real Estate sector, combining a revenue growth quality signal with a moving-average trend filter.

Strategy logic

  1. Universe: companies classified under the "Real Estate" sector in us_company_profile. This avoids cross-sector comparisons where financial metrics may not be directly comparable.
  2. Year-over-year quarterly revenue growth above 5%: the company is growing its top line, a sign of improving fundamentals or rising rental income.
  3. Price above the 50-day moving average: the stock is in a technical uptrend, so the market agrees with the fundamental improvement.
  4. Stocks meeting both conditions are ranked by revenue growth, and the top 10 are held in an equal-weight portfolio, rebalanced 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

# Filter to Real Estate sector using company profile
profile = data.get('us_company_profile')
real_estate = profile[profile['sector'] == 'Real Estate']['symbol'].tolist()
close_re = close[[c for c in close.columns if c in real_estate]]

# Revenue growth as quality signal
revenue = data.get('us_income_statement:revenue')
rev_growth = revenue / revenue.shift(4) - 1  # YoY quarterly growth

position = (rev_growth > 0.05) & (close_re > close_re.average(50))
position = position.is_largest(10)

report = sim(position, resample='M', market=USMarket(), fee_ratio=0.001, tax_ratio=0)
report.display()

How to adjust it

  • us_company_profile: gives each US stock's sector. sector == 'Real Estate' captures REITs, real estate developers and real estate service companies. The same pattern works for any sector: change the string to 'Technology', 'Healthcare', 'Financial Services' and so on.
  • revenue.shift(4): compares each quarter with the same quarter a year earlier, removing the seasonality common in real estate revenue recognition.
  • close_re.average(50): the 50-day simple moving average, a trend filter that avoids buying fundamentally improving companies still in a price downtrend.
  • is_largest(10): selects the top 10 stocks by the combined signal, a concentrated portfolio that is still diversified within the sector.
  • resample='M': rebalances monthly, following the quarterly cadence of fundamental data while still letting the trend filter adapt.
  • fee_ratio=0.001: a 0.1% commission, a reasonable estimate for US brokerage fees.
  • tax_ratio=0: US stock trades carry no transaction tax.
↑↓ Move Enter Open Esc Close