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 DCF Valuation

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

Overview

End-to-end process for producing a deterministic discounted cash flow (DCF) valuation from real SEC filings, with sensitivity analysis and an LLM-narrated interpretation.

Description

This workflow runs the standalone DCF pipeline. Every financial assumption is seeded from the company's own 3-year historical medians or Damodaran industry medians — the LLM never picks numbers. The pipeline computes the base-case implied price, a WACC×terminal-growth sensitivity grid, and a margin-swing analysis, then hands the seeded result to an LLM that only narrates the interpretation.

  • Goal: A per-share intrinsic value, a sensitivity range, and a natural-language explanation — all traceable to filed financials.
  • Scope: From a financial snapshot and multi-year history through seeded DCF inputs, deterministic compute, and an LLM-narrated output.
  • Strategy: `seed_dcf_inputs` derives every parameter from filings; `calculate_dcf` computes the valuation; the LLM explains, never selects.

Usage

Execute this workflow when you need a defensible DCF valuation for a non-financial company. The CLI auto-switches to the DDM pipeline for banks and financial institutions (detected via industry/sector); pass `--force-dcf` to override.

  • Input State: A valid public ticker symbol for a non-financial company.
  • Desired Output: An implied per-share value, a WACC/terminal-growth sensitivity table, and a narrative explaining the seeded assumptions and result.

Execution Steps

Step 1: Historical Data

Fetch the financial snapshot and price for the ticker, plus multi-year historical metrics. The data layer pulls financials and price from the primary provider (FMP) with failover to yfinance. The executor produces a validated FinancialData object carrying revenue, EBITDA, net income, market cap, and quote currency.

Key considerations:

  • This step is critical — the DCF seed reads this FinancialData, so a validation failure aborts the pipeline.
  • Foreign issuers are FX-normalized to canonical USD before seeding so a native-currency numerator never mixes with a USD market cap.
  • Forward analyst consensus (revenue growth) is fetched opportunistically to seed Stage-1 growth.

Step 2: DCF Calculation

Derive every DCF input deterministically from the company's filings. The executor calls `seed_dcf_inputs` to build a `DCFInputs` object: revenue growth from analyst consensus or trailing CAGR, margins from 3-year medians, WACC components from CAPM (risk-free rate, beta, equity risk premium, cost of debt, tax rate, debt ratio), and terminal growth from a calibrated estimate. For commodity-cyclicals, through-cycle earnings normalization anchors on normalized earnings power. The executor then runs `calculate_dcf` (base case) and `calculate_sensitivity` (WACC×TG grid), plus a margin-swing and latest-year actuals reconciliation.

Key considerations:

  • No LLM call — the executor ignores the re-prompt entirely (deterministic flag).
  • Every assumption carries provenance in `assumption_provenance` for the UI's detail panel.
  • For balance-sheet financials (banks/insurers), the DCF degrades to a text-only "not applicable" step before seeding — free cash flow is ill-defined for a deposit-funded balance sheet.
  • Gordon Growth is undefined when terminal growth ≥ WACC (low-WACC utilities/REITs); the pipeline degrades gracefully rather than printing a nonsense negative fair value.

Step 3: Narrative Output

The report agent writes a natural-language interpretation of the seeded DCF result. The LLM receives the computed implied price, WACC, terminal growth, sensitivity range, and assumption provenance as context, and explains the valuation — it does not select any number.

Key considerations:

  • The LLM only narrates; every figure it cites was computed by code.
  • The validator ensures the output is non-empty and references the DCF result.

Execution Diagram