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

Implementation:AI4Finance Foundation FinRobot seed dcf inputs

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

Overview

Concrete tool for deterministically seeding all DCF input assumptions from real financial filings and historical metrics, provided by the FinRobot compute layer.

Description

The seed_dcf_inputs function is the single authoritative builder of DCFInputs in the codebase. It replaces the legacy path where an LLM would "pick" assumptions from a prompt. Instead, every DCF assumption is deterministically derived from the provider's reported financials and multi-year history, falling back through a fixed precedence: ticker historical median (3y) → industry median (Damodaran) → market median.

Every field gets an entry in assumption_provenance so the UI can show where each number came from (e.g. "EBITDA 利润率 31.4%,过去 3 年财报中位数"). Direct construction of DCFInputs with hardcoded numerics is a red-line violation.

Usage

  • DCF_Valuation workflow (Step 2): Called after the financial data step to build DCFInputs from FinancialData + HistoricalMetrics.
  • Equity_Research workflow (Step 4): Called as part of financial modeling.
  • IC_Memo workflow (Step 2): Called to seed DCF inputs for the inline DCF in the IC memo.
  • Import this when you need to produce a typed, provenance-tracked DCFInputs object from real filings. Pass forward_growth (analyst consensus) to seed the explicit window; pass cyclical=True for commodity-cyclical issuers to apply through-cycle normalization.

Code Reference

Source Location

  • Repository: FinRobot
  • File: finrobot_desktop/finrobot/engine/compute/operators/dcf_seed.py

Signature

def seed_dcf_inputs(
    financials: FinancialData,
    historical: HistoricalMetrics,
    *,
    risk_free_rate: float = DEFAULT_RISK_FREE_RATE,         # ~0.043
    equity_risk_premium: float = DEFAULT_EQUITY_RISK_PREMIUM,  # ~0.0423
    terminal_growth_rate: float = DEFAULT_TERMINAL_GROWTH,  # ~0.03
    projection_years: int = DEFAULT_PROJECTION_YEARS,      # 10
    forward_growth: list[float] | None = None,
    cyclical: bool = False,
) -> DCFInputs:
    """Build a complete DCFInputs from one ticker's financials + historical data.

    Args:
        financials: Latest snapshot (LTM revenue, EBITDA, debt, cash, shares).
        historical: Multi-year history (extracted by historical_extractor).
        risk_free_rate: 10Y Treasury yield. Default static; caller can pass live.
        equity_risk_premium: Market risk premium. Default Damodaran 2026 ERP.
        terminal_growth_rate: Perpetuity growth. Default US nominal GDP.
        projection_years: Length of explicit forecast schedule (default 10).
        forward_growth: Analyst-consensus YoY revenue-growth path for the
            first explicit years. Seeds the explicit window IN PLACE OF the
            trailing CAGR. None/empty → trailing-CAGR seeding.
        cyclical: True for commodity/deep-cyclical — switches to through-cycle
            normalization (Damodaran cyclical口径). The EBITDA margin, CapEx%
            and D&A% are taken across the full cycle window, not trailing 3y.
            revenue_base stays at current TTM.

    Returns:
        DCFInputs ready to pass to calculate_dcf. da_pct_revenue is always
        non-None (industry fallback guarantees it).
    """

Import

from finrobot.engine.compute.operators.dcf_seed import seed_dcf_inputs

I/O Contract

Inputs

Name Type Required Description
financials FinancialData Yes Latest snapshot: LTM revenue, EBITDA, debt, cash, shares, market data
historical HistoricalMetrics Yes Multi-year history: CAGRs, margin medians, capex/revenue ratios
risk_free_rate float No 10Y Treasury yield (default ~0.043)
equity_risk_premium float No Market risk premium (default ~0.0423)
terminal_growth_rate float No Perpetuity growth (default ~0.03)
projection_years int No Explicit forecast horizon (default 10)
forward_growth list[float] No Analyst-consensus revenue growth path for early years
cyclical bool No If True, apply through-cycle normalization (default False)

Outputs

Name Type Description
DCFInputs DCFInputs Fully seeded inputs: revenue_base, ebitda_margin, da_pct_revenue, capex_pct_revenue, nwc_pct_revenue, revenue_growth_rates, terminal_growth_rate, risk_free_rate, beta, equity_risk_premium, cost_of_debt, tax_rate, debt_ratio, shares_outstanding, net_debt, currency, assumption_provenance

Usage Examples

Standard DCF Seeding

from finrobot.engine.compute.operators.dcf_seed import seed_dcf_inputs

# financials: FinancialData from execute_financial_data_step
# historical: HistoricalMetrics from fetch_historical_metrics
dcf_inputs = seed_dcf_inputs(
    financials=financial_data,
    historical=historical_metrics,
)

# Inspect provenance — every field traces to its source
for field, source in dcf_inputs.assumption_provenance.items():
    print(f"{field}: {source}")

With Analyst Consensus and Cyclical Normalization

# Forward growth from analyst consensus (seeds explicit window)
forward_growth = [0.12, 0.10, 0.08, 0.06, 0.05]  # Year 1-5

dcf_inputs = seed_dcf_inputs(
    financials=financial_data,
    historical=historical_metrics,
    forward_growth=forward_growth,
    cyclical=True,  # Memory/steel/oil — through-cycle normalization
)

Related Pages

Implements Principle

Requires Environment

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment