MCP Server live — AI agents can now query 105M+ SEC facts. Connect your agent →
ValueinValuein
intermediate
8 min

Earnings Momentum Strategy

Build an earnings surprise screen using eps_surprise_pct from earnings_signals.parquet.

earningsmomentumsignalsDuckDB
## Earnings Surprise as a Signal Companies that repeatedly beat their own historical EPS trend tend to outperform. The `earnings_signals` table provides a trailing 4-quarter EPS trend estimate and the actual vs. trend surprise_pct.
python
from valuein_sdk import ValueinClient, ValueinError

try:
    with ValueinClient() as client:
        # Find companies that beat EPS trend by >10% for 3+ consecutive quarters
        momentum = client.query("""
          WITH beats AS (
            SELECT 
              es.entity_id,
              r.symbol, r.name, r.sector,
              es.fiscal_year, es.fiscal_period,
              es.eps_surprise_pct,
              es.eps_actual,
              es.eps_trend_est
            FROM earnings_signals es
            JOIN references r USING (entity_id)
            WHERE r.is_sp500 = TRUE
              AND es.eps_surprise_pct IS NOT NULL
              AND es.eps_surprise_pct > 0.10  -- Beat by >10%
          ),
          consecutive AS (
            SELECT entity_id, symbol, name, sector,
              COUNT(*) AS beat_streak,
              AVG(eps_surprise_pct) AS avg_beat
            FROM beats
            WHERE (fiscal_year, fiscal_period) IN (
              ('2024', 'Q4'), ('2024', 'Q3'), ('2024', 'Q2'), ('2024', 'Q1')
            )
            GROUP BY entity_id, symbol, name, sector
            HAVING COUNT(*) >= 3
          )
          SELECT * FROM consecutive
          ORDER BY avg_beat DESC
          LIMIT 20
        """)
        print(momentum)

except ValueinError as e:
    print(f"Error: {e}")

Try it yourself

Get your API token and run this notebook against 105M+ real SEC EDGAR facts.