Project Description
Release History
## Release History

Download Files
## Download Files

python_finance_tools

=========

## 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

=========

## 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

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help | Version | File Type | Upload Date |
---|---|---|---|

finance_tools-0.1.tar.gz (2.5 kB) Copy SHA256 Checksum SHA256 | – | Source | Apr 6, 2012 |