A Python implementation of Discounted Cash Flow (DCF) analysis that calculates the intrinsic value per share of a company using the Gordon Growth Model for terminal value.
I am a Mechatronics Engineering graduate and a postgraduate in Finance from Henley Business School, looking to enter the field of finance in data science, machine learning, or quantitative finance.
- 💼 LinkedIn: linkedin.com/in/sauravsen34
- 📧 Email: saurav0sen34@gmail.com
A Discounted Cash Flow model calculates what a company's future earnings are worth in today's money. Money today is worth more than the same money tomorrow — due to both inflation and investment risk. The DCF discounts each future cash flow back to its present value using a rate (WACC) that captures both factors combined.
Add up all the discounted cash flows and you get the intrinsic value of the company — what it should theoretically be worth regardless of what the market currently prices it at.
A company doesn't stop generating cash after year 10. Terminal value captures all cash flows from year 11 to infinity in a single number, using the Gordon Growth Model:
Terminal Value = Final Year FCF × (1 + g) / (WACC - g)
Where g is the long-term growth rate (typically 2-3%, in line with GDP). Terminal value typically accounts for 60-80% of total intrinsic value — which is why assumptions matter enormously. A 1% change in WACC can swing the valuation by hundreds of billions.
| Input | Value |
|---|---|
| Current FCF | $108.8B |
| Growth Rate (10yr) | 8% |
| WACC | 9% |
| Terminal Growth Rate | 2.5% |
| Shares Outstanding | 15.4B |
| Output | Value |
|---|---|
| Projected FCF Range | $117.5B → $234.9B |
| Terminal Value | $3,704.1B |
| Total Intrinsic Value | $2,599.2B |
| Intrinsic Value Per Share | $168.78 |
| Current Market Price | ~$220 |
| Verdict | Overvalued |
What this tells us: Our base case suggests Apple trades at a premium to its intrinsic value. However, a DCF is only as reliable as its assumptions. As George Box said — "all models are wrong, but some are useful." This model is a framework for thinking about value, not a definitive sell signal. Apple's brand strength and ecosystem may justify a market premium.
WACC — Weighted Average Cost of Capital. The discount rate representing the minimum return required given the risk of investing in this company. WACC and intrinsic value move in opposite directions — lower WACC means future cash flows are worth more today.
Free Cash Flow — cash a company actually generates after capital expenditure, as opposed to accounting profit which can be manipulated. FCF is what funds dividends, buybacks, and growth.
Sensitivity — small changes in WACC or growth rate produce large changes in valuation. Always treat DCF outputs as a range, not a single number.
git clone https://github.com/sauravsen3/dcf-valuation.git
cd dcf-valuation
pip install -r requirements.txt
python dcf.pydcf-valuation/
│
├── dcf.py # DCF logic, terminal value, chart
├── requirements.txt # Python dependencies
└── dcf_valuation.png # Generated on first run
- pandas / numpy — cash flow calculations
- matplotlib — projected vs discounted FCF bar chart
Part of a series of quantitative finance projects. Previous: Pairs Trading Strategy. Next: Comparable Companies Analysis.