Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dcf-model

DCF valuation for any US public company — one command, no API key, no Bloomberg terminal.

pip install dcf-model
dcf value AAPL

CI Python 3.9+ License: MIT


The Problem

Every investment banking analyst and equity researcher spends 4–6 hours per company doing this manually:

  1. Pull financial data from 10-K filings (Bloomberg costs $25K/year)
  2. Build a 3-statement model in Excel
  3. Calculate WACC (cost of equity, cost of debt, tax shield)
  4. Project 5 years of Unlevered Free Cash Flow
  5. Compute terminal value (Gordon Growth + exit multiple)
  6. Build a sensitivity table: WACC × terminal growth rate

This library automates all of it using free SEC EDGAR data. In 10 seconds.


What You Get

╭──────────────── DCF Valuation ────────────────╮
│  AAPL · Apple Inc.                             │
│  SEC CIK: 0000320193  ·  Base Year: 2023       │
╰────────────────────────────────────────────────╯

Historical Financials
 Year   Revenue    EBITDA    EBITDA %   Net Inc    CapEx     Net Debt
 2019   $260.17B   $81.86B   31.5%      $55.26B   $10.50B   $59.20B
 2020   $274.52B   $81.02B   29.5%      $57.41B    $7.31B   $73.48B
 ...

WACC Build-up
 Risk-Free Rate (10Y UST)    4.3%
 Equity Risk Premium         5.5%
 Beta                        1.20
 Cost of Equity (CAPM)       11.1%
 Cost of Debt (after-tax)    3.8%
 WACC                        9.7%

DCF Projections
 Period  Revenue    Rev Growth  EBITDA    UFCF     PV of UFCF
 FY+1    $413.3B    7.8%        $130.2B   $82.1B   $74.8B
 FY+2    $441.8B    6.9%        $139.2B   $87.8B   $72.9B
 ...

Valuation Summary
                       Gordon Growth   Exit Multiple   Blended (50/50)
 PV of FCFs            $342.1B         $342.1B         $342.1B
 PV of Terminal Value  $1,847.3B       $2,104.5B       —
 Enterprise Value      $2,189.4B       $2,446.6B       $2,318.0B
 (−) Net Debt          $42.0B          $42.0B          $42.0B
 Equity Value          $2,147.4B       $2,404.6B       $2,276.0B
 Implied Share Price   $139.83         $156.51         $148.17   ←

Sensitivity — Implied Share Price
WACC \ TGR    1.5%     2.0%     2.5%     3.0%     3.5%
  7.7%       $175     $185     $197     $212     $232
  8.7%       $150     $158     $167     $179     $195
  9.7%       $130     $137     $148     $158     $171   ← base case
 10.7%       $114     $120     $128     $137     $149
 11.7%       $100     $106     $113     $120     $130

Installation

pip install dcf-model

CLI Usage

# Full DCF valuation
dcf value AAPL

# Override key assumptions
dcf value MSFT --beta 1.1 --terminal-growth 0.03 --exit-multiple 14

# Override WACC manually (skip calculation)
dcf value GOOGL --wacc 0.085

# Fix revenue growth rate assumption
dcf value AMZN --growth 0.12

# Skip sensitivity table for speed
dcf value TSLA --no-sensitivity

# Just see historical financials
dcf financials NVDA --years 7

Python API

from dcf_model.edgar import fetch_financials
from dcf_model.wacc import WACCInputs, calculate_wacc
from dcf_model.dcf import DCFAssumptions, run_dcf
from dcf_model.sensitivity import build_sensitivity
from dcf_model.report import print_full_report

# Pull real SEC EDGAR data
company = fetch_financials("MSFT", years=5)

# Calculate WACC using CAPM
wacc_inputs = WACCInputs(
    risk_free_rate=0.043,       # 10-year Treasury
    equity_risk_premium=0.055,  # Damodaran ERP
    beta=0.9,
)
wacc = calculate_wacc(company, wacc_inputs)
print(f"WACC: {wacc:.1%}")  # e.g. WACC: 9.0%

# Set DCF assumptions (or use historical averages as defaults)
assumptions = DCFAssumptions(
    projection_years=5,
    terminal_growth_rate=0.025,
    exit_ebitda_multiple=14.0,
    # revenue_growth_rates=[0.10, 0.09, 0.08, 0.07, 0.06]  # optional override
    # ebitda_margin=0.40                                      # optional override
)

# Run the model
result = run_dcf(company, assumptions, wacc)

print(f"Enterprise Value:   ${result.ev_blended / 1e9:.1f}B")
print(f"Implied Share Price: ${result.implied_price_blended:,.2f}")
print(f"TV as % of EV: {result.pv_tv_gordon / result.ev_gordon:.0%}")

# Build sensitivity table
table = build_sensitivity(company, assumptions, base_wacc=wacc)

# Print full report to terminal
print_full_report(company, result, wacc_inputs, table)

The Math

Unlevered Free Cash Flow (UFCF)

UFCF = EBIT × (1 − tax_rate)    ← NOPLAT (tax-affected operating profit)
     + Depreciation & Amortization
     − Capital Expenditures
     − Change in Net Working Capital

This is the unlevered view — independent of capital structure, standard in IB.

WACC (Weighted Average Cost of Capital)

Cost of Equity  (Ke) = Rf + β × ERP          [CAPM]
Cost of Debt    (Kd) = Interest Expense / Debt
After-tax Kd         = Kd × (1 − tax rate)

WACC = Ke × (E/V) + Kd_at × (D/V)

Defaults: Rf = 4.3% (10Y UST), ERP = 5.5% (Damodaran 2025), β = 1.0

Terminal Value (two methods)

Gordon Growth:   TV = UFCF_n × (1 + g) / (WACC − g)
Exit Multiple:   TV = EBITDA_n × EV/EBITDA

Blended: 50% Gordon + 50% Exit Multiple

Equity Bridge

Enterprise Value = PV(FCFs) + PV(Terminal Value)
Equity Value     = Enterprise Value − Net Debt
Implied Price    = Equity Value / Diluted Shares Outstanding

Data Source

All financial data comes from SEC EDGAR's free public API:

  • https://data.sec.gov/api/xbrl/companyfacts/CIK{cik}.json — XBRL financial facts
  • https://www.sec.gov/files/company_tickers.json — ticker → CIK mapping

No API key. No subscription. All US public companies that file 10-K reports.


Limitations

  • Historical basis only — projections use historical averages as defaults. Override with --growth, --ebitda-margin, etc. for company-specific assumptions.
  • No market cap inputs — WACC capital structure estimated from balance sheet (not market-cap-weighted). Override with --wacc for precision.
  • US-listed companies only — requires SEC EDGAR filings (10-K).
  • Not investment advice — verify assumptions and use judgment before acting on outputs.

License

MIT


"The stock market is a device for transferring money from the impatient to the patient." — Warren Buffett

About

DCF valuation for any US public company using free SEC EDGAR data — one command, no API key

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages