All Projects → halessi → DCF

halessi / DCF

Licence: other
Basic Discounted Cash Flow library written in Python. Automatically fetches relevant financial documents for chosen company and calculates DCF based on specified parameters.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to DCF

Riskfolio Lib
Portfolio Optimization and Quantitative Strategic Asset Allocation in Python
Stars: ✭ 305 (+54.04%)
Mutual labels:  finance, investment
Quantdom
Python-based framework for backtesting trading strategies & analyzing financial markets [GUI ]
Stars: ✭ 449 (+126.77%)
Mutual labels:  finance, investment
Machine Learning For Trading
Code for Machine Learning for Algorithmic Trading, 2nd edition.
Stars: ✭ 4,979 (+2414.65%)
Mutual labels:  finance, investment
investbook
Оценка эффективности инвестиций с учетом комиссий, налогов (удержанных и ожидающихся), дивидендов и купонов.
Stars: ✭ 83 (-58.08%)
Mutual labels:  finance, investment
Qlib Server
Qlib-Server is the data server system for Qlib. It enable Qlib to run in online mode. Under online mode, the data will be deployed as a shared data service. The data and their cache will be shared by all the clients. The data retrieval performance is expected to be improved due to a higher rate of cache hits. It will consume less disk space, too.
Stars: ✭ 81 (-59.09%)
Mutual labels:  finance, investment
simulatePortfolio
class for simulation of stock investing portfolios based on historical data
Stars: ✭ 18 (-90.91%)
Mutual labels:  finance, investment
Financepy
A Python Finance Library that focuses on the pricing and risk-management of Financial Derivatives, including fixed-income, equity, FX and credit derivatives.
Stars: ✭ 416 (+110.1%)
Mutual labels:  finance, investment
py-investment
Extensible Algo-Trading Python Package.
Stars: ✭ 19 (-90.4%)
Mutual labels:  finance, investment
Xalpha
基金投资管理回测引擎
Stars: ✭ 683 (+244.95%)
Mutual labels:  finance, investment
Redtorch
Java开源量化交易开发框架
Stars: ✭ 528 (+166.67%)
Mutual labels:  finance, investment
GOAi
No description or website provided.
Stars: ✭ 57 (-71.21%)
Mutual labels:  finance, investment
Pyportfolioopt
Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
Stars: ✭ 2,502 (+1163.64%)
Mutual labels:  finance, investment
FinMesh
A python package that brings together financial and economic data.
Stars: ✭ 20 (-89.9%)
Mutual labels:  finance, valuation
Financial Machine Learning
A curated list of practical financial machine learning tools and applications.
Stars: ✭ 2,172 (+996.97%)
Mutual labels:  finance, investment
Beibo
🤖 Predict the stock market with AI 用AI预测股票市场
Stars: ✭ 46 (-76.77%)
Mutual labels:  finance, investment
Finquant
A program for financial portfolio management, analysis and optimisation.
Stars: ✭ 395 (+99.49%)
Mutual labels:  finance, investment
Qlib
Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment. With Qlib, you can easily try your ideas to create better Quant investment strategies. An increasing number of SOTA Quant research works/papers are released in Qlib.
Stars: ✭ 7,582 (+3729.29%)
Mutual labels:  finance, investment
Finance
프로그래머가 투자하는 법
Stars: ✭ 121 (-38.89%)
Mutual labels:  finance, investment
Vnpy
基于Python的开源量化交易平台开发框架
Stars: ✭ 17,054 (+8513.13%)
Mutual labels:  finance, investment
WeWorkFinanceSDK
企业微信会话存档SDK(基于企业微信C版官方SDK封装)
Stars: ✭ 223 (+12.63%)
Mutual labels:  finance

DCF: Discounted Cash Flow

If you notice any errors or have any questions/suggestions, please reach out! [email protected]

I've worked to create this Python library as part of an effort to familiarize myself with calculating discounted cash flows working directly with a company's financial statements. 📈 📉

I have found tweaking each of the configurable variables (CapEx growth, Revenue growth, discount rate, etc) to help with developing an insight into how the assumptions made when doing discounted cash flows play a role on the end valuation. This insight is essential to utilizing DCF effectively.

This library also makes possible comparisons to where the underlying entity has traded over the historical DCFs calculated, enabling an immediate illustration of where the stock has traded in relation to its intrinsic value.

Obviously one cannot utilize this visualization to say very much about the quality of their DCF and assumptions made. It is much more helpful when one is very certain of the valuation they've derived and is hoping to understand how the stock has traded in relation to that in the past, i.e., at a premium or discount.

Next steps:

  • implement dynamic discount rate calculation
  • multivariable earnings growth rate calculations (as opposed to hard-coding)
  • EBITDA multiples for terminal value

Dependencies

pip install matplotlib urllib3 seaborn

Basic usage

As of now, command line arguments are used to parse parameters. See main.py for default values. Here is a description of the parameters: (as of now)

python main.py \
        --period        
        --ticker        
        --years         
        --interval      
        --step_increase 
        --steps         
        --variable      
        --discount_rate 
        --earnings_growth_rate 
        --perpetual_growth_rate
        --apikey
Argument Usage
period how many years to directly forecast Free Cash Flows
ticker ticker of the company, used for pulling financials
years if computing historical DCFs (i.e. years > 1), the number of years back to compute
interval can compute DCFs historically on either an 'annual' or 'quarter' basis. if quarter is indicated, total number of DCFS = years * 4
step_increase some sensitivity analysis: if this is specified, DCFs will be computed for default + (step_increase * interval_number), showing specifically how changing the underlying assumption impacts valuation
steps number of steps to take (for step_increase)
variable the variable to increase each step, those available are: earnings_growth_rate, cap_ex_growth_rate, perpetual_growth_rate, discount_rate, [more to come..]
discount_rate specified discount_rate (W.A.C.C., it'd be nice (i think) if we dynamically calculated this)
earnings_growth_rate specified rate of earnings growth (EBIT)
perpetual_growth_rate specified rate of perpetual growth for calculating terminal value after period years, EBITDA multiples coming
apikey (Free) API Key to access financial data from financialmodelingprep -- Can also be provided as APIKEY envrionment variable.

Example

If we want to examine historical DCFS for $AAPL, we can run:

python main.py --t AAPL --i 'annual' --y 3 --eg .15 --steps 2 --s 0.1 --v eg --apikey <secret>

or via:

export APIKEY=<secret>
python main.py --t AAPL --i 'annual' --y 3 --eg .15 --steps 2 --s 0.1 --v eg

This pulls the financials for AAPL for each year 3 years (--y) back to calculate 12 DCFs (3 years * 4 quarters), starting at a base earnings growth of 15% (--eg) and increasing for two steps (--steps) by 10% (--s), with --v specifying that earnings growth is the variable we want to increment.

Terminal outputs some details just for us to keep an eye on:

Forecasting flows for 5 years out, starting at 2018-12-29. 
         DFCF   |    EBIT   |    D&A    |    CWC    |   CAP_EX   | 
2019   2.35E+10 |  2.79E+10 |  3.96E+09 |  2.17E+09 |  -3.51E+09 | 
2020   2.80E+10 |  3.70E+10 |  5.26E+09 |  1.52E+09 |  -3.82E+09 | 
2021   3.82E+10 |  5.54E+10 |  7.86E+09 |  1.06E+09 |  -4.34E+09 | 
2022   5.84E+10 |  9.19E+10 |  1.31E+10 |  7.44E+08 |  -5.12E+09 | 
2023   9.82E+10 |  1.68E+11 |  2.38E+10 |  5.21E+08 |  -6.27E+09 | 

Enterprise Value for AAPL: $1.41E+12. 
Equity Value for AAPL: $1.34E+12. 
Per share value for AAPL: $2.81E+02.

This provides a quick way to dive a bit deeper into what happened in the underlying calculations without necessarily needing to pull apart the code.

Optional Text

Although far from a presentation-ready chart, evident here is an increase in the DCF-forecasted per share value of AAPL that results from our specified increase in forecasted earnings growth (i.e. the variable we're examining). On the quarterly basis we see a large degree of seasonal variation, indicating that perhaps this particular DCF would benefit from a more specific forecasting of cash flows.

References

[1] http://people.stern.nyu.edu/adamodar/pdfiles/eqnotes/dcfcf.pdf
[2] http://people.stern.nyu.edu/adamodar/pdfiles/basics.pdf
[3] https://www.oreilly.com/library/view/valuation-techniques-discounted/9781118417607/xhtml/sec30.html
[4] https://www.cchwebsites.com/content/calculators/BusinessValuation.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].