Use Case

How to Build a Stock Screener with SEC EDGAR Data

Build a fundamental stock screener that filters by P/E ratio, free cash flow, and revenue growth — using clean, structured data sourced directly from SEC EDGAR.

Why SEC EDGAR Data for Stock Screening?

Most stock screeners rely on third-party data that may be delayed, aggregated, or derived from unknown sources. By going straight to SEC EDGAR — the official source of public company filings — you get:

Audited Numbers

Financial statements from official SEC filings, not estimates

10-Year History

Screen using long-term trends, not just the latest quarter

Real Fundamentals

Revenue, net income, free cash flow — directly from 10-K/10-Q

Step-by-Step: Build a P/E + FCF Stock Screener

Step 1: Install the Python Client

pip install factstream

Step 2: Full Screener Code

This script screens a list of tickers by P/E ratio and free cash flow yield, using data sourced from SEC EDGAR via FactStream:

import factstream

client = factstream.Client(api_key="your_api_key")

# Define your universe — could be S&P 500, a sector, or custom list
tickers = [
    "AAPL", "MSFT", "GOOGL", "AMZN", "META",
    "JNJ", "JPM", "V", "PG", "UNH",
    "HD", "MA", "NVDA", "PFE", "KO"
]

# Screening criteria
MAX_PE = 25          # Maximum P/E ratio
MIN_FCF_YIELD = 0.03 # Minimum 3% free cash flow yield

print("Stock Screener: P/E < 25 & FCF Yield > 3%")
print("=" * 55)

results = []

for ticker in tickers:
    try:
        # Get valuation metrics
        metrics = client.metrics.get(ticker=ticker)

        pe = metrics.pe_ratio
        fcf_yield = metrics.free_cash_flow_yield

        # Skip if data is missing
        if pe is None or fcf_yield is None:
            continue

        # Apply filters
        if pe < MAX_PE and pe > 0 and fcf_yield > MIN_FCF_YIELD:
            # Get latest income statement for context
            income = client.financials.income_statement(
                ticker=ticker,
                period="annual",
                limit=2
            )

            revenue = income[0].revenue
            prev_revenue = income[1].revenue if len(income) > 1 else None
            rev_growth = ((revenue - prev_revenue) / prev_revenue * 100
                          if prev_revenue else None)

            results.append({
                "ticker": ticker,
                "pe": pe,
                "fcf_yield": fcf_yield,
                "revenue": revenue,
                "rev_growth": rev_growth,
            })

    except Exception as e:
        print(f"  Skipping {ticker}: {e}")

# Sort by FCF yield (highest first)
results.sort(key=lambda x: x["fcf_yield"], reverse=True)

# Display results
for r in results:
    growth_str = f"{r['rev_growth']:+.1f}%" if r["rev_growth"] else "N/A"
    print(f"{r['ticker']:>6}  P/E: {r['pe']:5.1f}  "
          f"FCF Yield: {r['fcf_yield']:5.1%}  "
          f"Revenue Growth: {growth_str}")

Step 3: Interpret the Results

The screener filters for stocks with:

  • P/E under 25 — potentially undervalued relative to earnings
  • FCF yield above 3% — generating real cash relative to market cap
  • Revenue growth data — shows whether the business is growing or contracting

Because FactStream sources from SEC EDGAR, these numbers come from audited financial statements — not third-party estimates.

Extend Your Screener

With FactStream's API, you can add more sophisticated criteria:

Debt-to-Equity Filter

Use balance sheet data to screen for low-leverage companies.

Earnings Consistency

Check 10 years of net income to find companies that never had a loss.

Dividend Coverage

Compare dividends paid vs free cash flow to find sustainable payers.

Insider Activity

Cross-reference with Form 4 filings to see if insiders are buying.

Build Your Stock Screener Today

Get your API key in 2 minutes. 30-day free trial, no credit card required on Starter.