=========
## Overview ##
This is a set of common financial calculations. It is a work in progress.
## Functions ##
### pv - Present Value of a Cash Flow[1]
Usage:
pv(cash_flow, period, cost_of_capital)
Arguments:
** cash_flow: this is self-explanatory, it's the amount of cash flowing in or out
** period: the period in which this cash flow occurs. It should match the cost_of_capital's period. For example, if you're paying an quarterly interest rate of 5%, your cash_flow should be a quarterly number and your cost_of_capital should be .05.
** cost_of_capital[2]: The weighted average cost of capital for your business. If you're capital structure is 50% debt and 50% equity, you would calculate your cost_of_capital by evently weighting your interest rate on debt and expected rate of return on equity. If you are simply seeing how much a certain amount of cash will be worth in the future, the cost_of_capital is the risk-free interest rate, a good proxy for that is the rate of a short-term government bond because theoretically, those have no risk of default[4].
Output: the present value of the cash flow.
Sample: the value of recieving $100 in 2 years, assuming an annual risk-free interest rate of 3%:
>>> from finance_tools import pv
>>> pv(100, 2, .03)
94.25959091337543
### dcf - Discounted Cash Flow Valuation[3]
Theoretically, a business is worth the present value of its future cash flows.
Usage:
dcf(cash_flows, cost_of_capital)
Arguments:
** cash_flows: This can be a list or dictionary. If a list, it assumes the index corresponds to the period. If a dictionary, the key:value interpretation is period:cash_flow.
** cost_of_capital: Described above. For a business, a conceptual way to think about this is how risky the business is. A riskier business merits a higher cost of capital. A good approximation for the cost of capital of a business is the rate at which a bank is willing to lend to your business.
Output: The valuation of your cash generating entity/business.
Sample: My business is generating $100 this year, and 10% more every year for the next 2 years. One person owns all of the equity and I can get a business loan at 7% annually.
>>>from finance_tools import pv, dcf
>>>dcf([100, 100*1.1, 100*1.1**2, 100*1.1**3], .07)
417.1390718529881
Sample 2: Suppose a business will lose $200 in its current year of operation, and $100 the next year, and then break even, and grow at a rate of $100 per year for 3 years, assuming a WACC of 10%:
>>>dcf({0:-200, 1:-100, 2: 0, 3:100, 4:200, 5:300}, .10)
107.1014771718275
Equivalently:
>>>dcf([-200, -100, 0, 100, 200, 300], .10)
107.1014771718275
Years do not need to be continuous. This is useful for more abstract investments/businesses:
Recieving $1000 5 quarters from now, and $5452 12 quarters from now, assuming a 17% cost of capital and an initial investment today of $1300:
>>>dcf({0:-1300, 5:1000, 12:5452}, .17)
-15.325903934344126
What if we're able to pay 4 quarters into the future as opposed to today?
>>>dcf({4:-1300, 5:1000, 12:5452}, .17)
590.9290333625488
A positive DCF means this would be a good investment.
This is a useful analysis to run, because seeing how fluctuations in future cash flows impact valuation lets businesses make better decisions from a value-maximizing perspective.
If you see anything incorrect, please let me know. Thank you.
[1] http://en.wikipedia.org/wiki/Present_value
[2] http://en.wikipedia.org/wiki/Weighted_average_cost_of_capital
[3] http://en.wikipedia.org/wiki/Discounted_cash_flow
[4] http://en.wikipedia.org/wiki/Risk-free_interest_rate
Metadata
Release files for finance_tools 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| finance_tools-0.1.tar.gz | 2.5 kB | Without provenance | Details for finance_tools-0.1.tar.gz |
Release files / finance_tools-0.1.tar.gz
| Download URL | finance_tools-0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4cd7820b6b6dd5e040786c2090c783f3c328ccf10aa7b9cd11d863a7cb31ddff
|
|
BLAKE2b-256 checksum How to use checksums |
7efef20c28b91d1f49fce0275cec72886d1ef2fa42d9891eb0fa1e2a9a9301db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for finance_tools 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.