Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Workflow:AI4Finance Foundation FinRobot Earnings Analysis

From Leeroopedia
Knowledge Sources
Domains Equity_Research, Earnings, Financial_Analysis
Last Updated 2026-10-18 00:00 GMT

Overview

End-to-end process for analyzing a company's earnings quality via deterministic beat/miss classification, surprise statistics, and streak arithmetic, with LLM-narrated interpretation and forward outlook.

Description

This workflow runs the earnings analysis pipeline. It fetches earnings history from FMP, deterministically classifies each quarter as beat/miss/inline at a ±2% threshold, computes the beat rate, average EPS and revenue surprise percentages, and consecutive-beat streaks. The LLM then interprets the beat/miss patterns and generates a forward earnings outlook.

  • Goal: A structured earnings quality assessment with deterministic beat rate, surprise trends, and consecutive streaks, plus an LLM-narrated interpretation and outlook.
  • Scope: From an earnings history fetch through deterministic surprise statistics, LLM pattern interpretation, and a forward outlook.
  • Strategy: Code computes the beat/miss classification and statistics; the LLM interprets patterns and projects the outlook.

Usage

Execute this workflow when you need an earnings quality review — beat rate, surprise trends, and consecutive streaks — for a public company. Requires an FMP API key for earnings surprise data.

  • Input State: A valid public ticker symbol with available earnings history.
  • Desired Output: A deterministic earnings summary (beat rate, average surprise, streak count) and an LLM-narrated analysis and forward outlook.

Execution Steps

Step 1: Earnings Data

Fetch the earnings history and compute deterministic surprise statistics. The executor fetches earnings history from the data layer (FMP provider), then calls `calculate_earnings_surprises` to classify each quarter as beat/miss/inline at a ±2% threshold, compute the beat rate, average EPS and revenue surprise percentages, and consecutive-beat streaks. A fetch miss degrades to empty history inside the executor (and still passes validation).

Key considerations:

  • Pure surprise-statistics compute, zero LLM calls.
  • The beat/miss classification threshold (±2%) is deterministic and reproducible.
  • The validator checks that the beat rate is within [0, 1] — a pure-compute fact a retry cannot change.

Step 2: Financial Context

Fetch the financial snapshot for trend context. The data layer pulls financials from the primary provider (FMP) with failover to yfinance. This provides the multi-year financial trend backdrop the LLM uses to interpret the earnings patterns.

Key considerations:

  • This step requires FINANCIALS data, fetched from the data layer.
  • The validator checks that the output references revenue and EBITDA fields.

Step 3: Earnings Analysis

The analysis agent interprets the beat/miss patterns from the deterministic surprise statistics. The agent receives the computed `EarningsResult` (beat rate, surprises, streaks) and the financial context as input, and produces a narrative analysis of the earnings quality, identifying trends, inflection points, and consistency.

Key considerations:

  • The LLM interprets patterns; it does not compute the beat rate or surprises — those are deterministic.
  • The validator ensures the output is non-empty.

Step 4: Forward Outlook

The synthesis agent generates a forward earnings outlook based on the historical patterns and financial context. The agent receives the earnings analysis and financial trends as input and projects the forward earnings trajectory.

Key considerations:

  • The LLM projects the outlook; the deterministic statistics ground it.
  • The validator ensures the output is non-empty.

Execution Diagram