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 calculate multiples

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

Overview

Concrete tool for computing EV/EBITDA, EV/Revenue, P/E, and P/B multiples for a single company with sanity-bound gating, provided by the FinRobot compute layer.

Description

The calculate_multiples function computes trading multiples for a single CompanyFinancials object. It returns a deep copy with computed fields set; the input is not mutated. All multiples are gated through _sanity with published bounds:

  • EV/EBITDA: [0.5x, 300x]
  • EV/Revenue: [0.1x, 100x]
  • P/E: [1.0x, 300x]
  • P/B: sanity-gated

Values outside these bounds are returned as None so calculate_peer_statistics excludes them from median/mean. Each drop is recorded on sanity_drops so the validator can surface the thinned set.

EV is only computed when BOTH total_debt and total_cash are reported; a missing balance-sheet component leaves EV undefined rather than assuming zero. P/E is equity-only and survives a missing balance sheet.

Usage

  • Comps_Analysis workflow (Step 2): Called per peer (and the target) to compute multiples before aggregation.
  • Equity_Research workflow (Step 3): Called as part of peer analysis.
  • Import this when you need deterministic, sanity-gated trading multiples for a single company.

Code Reference

Source Location

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

Signature

def calculate_multiples(company: CompanyFinancials) -> CompanyFinancials:
    """Compute EV/EBITDA, EV/Revenue, P/E, P/B for a single company.

    Uses company.total_debt and company.total_cash for EV calculation.
    Returns a new copy with computed fields set (input is not mutated).

    All three ratios are gated through _sanity with published bounds.
    Values outside bounds are returned as None so calculate_peer_statistics
    excludes them from median/mean. Each drop is recorded on result.sanity_drops.
    """

Import

from finrobot.engine.compute.operators.multiples import calculate_multiples

I/O Contract

Inputs

Name Type Required Description
company CompanyFinancials Yes Market cap, revenue, EBITDA, net income, total_debt, total_cash, preferred_stock, noncontrolling_interest, pb_ratio

Outputs

Name Type Description
result CompanyFinancials Deep copy with enterprise_value, ev_ebitda, ev_revenue, pe_ratio, pb_ratio set; sanity_drops list

Usage Examples

Compute Multiples for One Company

from finrobot.engine.compute.operators.multiples import calculate_multiples

# company: CompanyFinancials extracted from provider data
result = calculate_multiples(company)
print(f"EV/EBITDA: {result.ev_ebitda}")
print(f"P/E: {result.pe_ratio}")
if result.sanity_drops:
    print(f"Sanity drops: {result.sanity_drops}")

Related Pages

Implements Principle

Requires Environment

Uses Heuristics

Page Connections

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