Implementation:AI4Finance Foundation FinRobot calculate wacc
| Knowledge Sources | |
|---|---|
| Domains | Finance, domain:Valuation, Deterministic_Compute |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Concrete tool for computing the Weighted Average Cost of Capital via CAPM and capital-structure weighting, provided by the FinRobot compute layer.
Description
The calculate_wacc function computes the cost of equity using the Capital Asset Pricing Model (CAPM) and blends it with the after-tax cost of debt according to the firm's capital structure. It is called internally by calculate_dcf when no WACC override is supplied.
The companion adjust_beta_blume function applies the Blume/Bloomberg beta adjustment asymmetrically: only high-beta names (>1.0) are mean-reverted toward 1.0, while structurally low-beta defensive franchises keep their raw beta. This prevents inflating WACC for defensive names like KO or utilities.
Usage
- DCF computation: Called internally by calculate_dcf to derive the discount rate from CAPM inputs.
- Import this directly when you need to compute WACC separately from a DCF run, or to inspect the cost-of-equity / WACC decomposition.
Code Reference
Source Location
- Repository: FinRobot
- File: finrobot_desktop/finrobot/engine/compute/operators/wacc.py
Signature
def calculate_wacc(
risk_free_rate: float,
beta: float,
equity_risk_premium: float,
cost_of_debt: float,
tax_rate: float,
debt_ratio: float,
) -> tuple[float, float]:
"""Calculate Weighted Average Cost of Capital.
Returns:
(cost_of_equity, wacc)
Formula:
Cost of Equity = Risk-Free Rate + Beta × Equity Risk Premium (CAPM)
WACC = E/(D+E) × Cost of Equity + D/(D+E) × Cost of Debt × (1 - Tax Rate)
"""
def adjust_beta_blume(raw_beta: float) -> float:
"""Blume / Bloomberg adjustment, applied ASYMMETRICALLY.
For raw β > 1.0: β_adj = 2/3 × β_raw + 1/3 × 1.0 (Blume 1971)
For raw β ≤ 1.0: β_adj = β_raw (no up-adjust)
High-beta estimates mean-revert toward 1.0; low-beta defensive
franchises keep their structural beta.
"""
Import
from finrobot.engine.compute.operators.wacc import calculate_wacc, adjust_beta_blume
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| risk_free_rate | float | Yes | 10Y Treasury yield |
| beta | float | Yes Levered equity beta (pre- or post-Blume adjustment) | |
| equity_risk_premium | float | Yes | Market risk premium (Damodaran ERP) |
| cost_of_debt | float | Yes | Pre-tax cost of debt (yield on outstanding debt) |
| tax_rate | float | Yes | Effective tax rate (for debt tax shield) |
| debt_ratio | float | Yes | D/(D+E) — proportion of debt in capital structure |
Outputs
| Name | Type | Description |
|---|---|---|
| cost_of_equity | float | CAPM cost of equity: rf + β × ERP |
| wacc | float | Weighted average cost of capital |
Usage Examples
Compute WACC
from finrobot.engine.compute.operators.wacc import calculate_wacc, adjust_beta_blume
# Raw beta from provider (e.g. 1.35)
raw_beta = 1.35
adjusted_beta = adjust_beta_blume(raw_beta) # → 1.23 (mean-reverted)
cost_of_equity, wacc = calculate_wacc(
risk_free_rate=0.043,
beta=adjusted_beta,
equity_risk_premium=0.0423,
cost_of_debt=0.055,
tax_rate=0.21,
debt_ratio=0.25,
)
print(f"Cost of Equity: {cost_of_equity:.2%}") # ~9.5%
print(f"WACC: {wacc:.2%}") # ~8.3%
Related Pages
Implements Principle
- Principle:AI4Finance_Foundation_FinRobot_WACC_Calculation
- Principle:AI4Finance_Foundation_FinRobot_Discounted_Cash_Flow_Valuation