A Python library for automated company valuations using Discounted Cash Flow (DCF) analysis, supporting both SEC EDGAR filings and custom financial data.
- Automated DCF valuation using SEC EDGAR filings
- Support for custom financial data input
- Fast processing of bulk SEC filings.
- Comprehensive error handling and validation
- Currency-aware calculations (tbd - currently USD only)
from fairvalue import Stock
from fairvalue.models import SECFilings
# Load SEC filing data
secfiling = SECFilings(
companyfacts='./data/companyfacts/CIK0000320193.json',
submissions='./data/submissions/CIK0000320193.json'
)
# Create stock and calculate fair value
stock = Stock(sec_filing=secfiling)
valuation = stock.predict_fairvalue(
growth_rate=0.02,
number_of_years=10,
discounting_rate=0.04
)Output
{
"ticker_id": "AAPL",
"exchange": "NONE",
"cik": "320193",
"entity_name": "Apple Inc.",
"days_since_filing": 41,
"is_potentially_delisted": False,
"count_filings": 17,
"forecast_date": "2025-02-20",
"forecast_horizon": 10,
"shares_outstanding": 15204137000,
"company_value": 3886523142972.99,
"intrinsic_value": 255.62
}
from fairvalue import Stock
# Prepare your financial data
financials = {
'year_end_dates': ['2025-01-01'],
'free_cashflows': [108807000000],
'shares_outstanding': [15115823000]
}
# Create stock and calculate fair value
stock = Stock(ticker_id='AAPL', historical_financials=financials)
valuation = stock.predict_fairvalue(
growth_rate=0.02,
number_of_years=10,
discounting_rate=0.04
)Output:
{
"ticker_id": "AAPL",
"exchange": "NONE",
"cik": None,
"entity_name": None,
"count_filings": 1,
"forecast_date": "2025-02-20",
"forecast_horizon": 10,
"shares_outstanding": 15115823000,
"company_value": 3886523142972.99,
"intrinsic_value": 257.12
}
The scripts/ directory contains helpful utilities for working with FairValue:
download_sec_filings.py: Download and cache SEC EDGAR filingsbatch_process.py: Process multiple companies in batch mode
Run scripts from the project root:
python scripts/download_sec_filings.py --ticker AAPL- Robust data validation using Pydantic models
- Automated validation of financial data inputs for both SEC EDGAR and custom financial data
- Based on free cash flow projections
- Uses Gordon Growth Model for terminal value. Exit multiple terminal value to be added as an option.
- Does not include debt, assets, or liabilities in calculation. (tbd - will be added in future)
growth_rate: Expected annual growth rate of free cash flowsnumber_of_years: Forecast horizondiscounting_rate: Rate used to discount future cash flows
-
Company Exclusions:
- SPACs and blank check companies
- Non-US incorporated companies
- Companies reporting in non-USD currencies
-
Calculation Scope:
- Focuses solely on free cash flows
- Excludes balance sheet items
- Does not consider market conditions or company-specific risks
- Balance sheet integration for more comprehensive valuations
- Terminal value calculation using exit multiples
- Support for non-US incorporated companies
- data quality indicators
- Automated growth rate suggestions based on historical data
- Multi-currency support for non-USD financial statements
Apache 2.0 - See LICENSE for details.
This software is for educational and research purposes only. It should not be construed as financial advice or a recommendation to buy, sell, or hold any investment or security.
- No Investment Advice: The calculations and outputs provided by this tool are based on historical data and assumptions that may not reflect future performance.
- Not Financial Advice: Always conduct your own due diligence and consult with qualified financial advisors before making investment decisions.
- Limited Scope: The DCF valuation method used here:
- Does not account for all factors that influence stock prices
- Uses simplifying assumptions about growth rates and discount rates
- Does not consider market sentiment, economic conditions, or company-specific risks
- No Warranty: This software is provided "as is" without warranty of any kind, either express or implied.
By using this software, you acknowledge and accept these limitations and risks.