qfinbox.tvm.cashflow
Cash flow analysis and investment evaluation.
Functions
|
Calculate discounted payback period for cash flows. |
|
Find the roots of a function. |
|
Calculate internal rate of return for cash flows. |
|
Calculate net present value of cash flows. |
|
Calculate payback period for cash flows. |
|
Calculate profitability index for cash flows. |
|
Validate that a value is positive. |
- qfinbox.tvm.cashflow.net_present_value(cash_flows: List[float] | ndarray, discount_rate: float) float[source]
Calculate net present value of cash flows.
- Parameters:
cash_flows (array-like) – Series of cash flows, with initial investment as negative value.
discount_rate (float) – Discount rate (as decimal).
- Returns:
Net present value.
- Return type:
Examples
>>> cash_flows = [-100000, 30000, 40000, 50000] >>> net_present_value(cash_flows, 0.10) 4349.34
- qfinbox.tvm.cashflow.internal_rate_of_return(cash_flows: List[float] | ndarray, initial_guess: float = 0.1) float[source]
Calculate internal rate of return for cash flows.
- Parameters:
cash_flows (array-like) – Series of cash flows, with initial investment as negative value.
initial_guess (float, default 0.1) – Initial guess for IRR calculation.
- Returns:
Internal rate of return (as decimal).
- Return type:
Examples
>>> cash_flows = [-100000, 30000, 40000, 50000] >>> internal_rate_of_return(cash_flows) 0.1627
- qfinbox.tvm.cashflow.payback_period(cash_flows: List[float] | ndarray) float[source]
Calculate payback period for cash flows.
- Parameters:
cash_flows (array-like) – Series of cash flows, with initial investment as negative value.
- Returns:
Payback period in years.
- Return type:
Examples
>>> cash_flows = [-100000, 30000, 40000, 50000] >>> payback_period(cash_flows) 2.6
- qfinbox.tvm.cashflow.discounted_payback_period(cash_flows: List[float] | ndarray, discount_rate: float) float[source]
Calculate discounted payback period for cash flows.
- Parameters:
cash_flows (array-like) – Series of cash flows, with initial investment as negative value.
discount_rate (float) – Discount rate (as decimal).
- Returns:
Discounted payback period in years.
- Return type:
Examples
>>> cash_flows = [-100000, 30000, 40000, 50000] >>> discounted_payback_period(cash_flows, 0.10) 2.8
- qfinbox.tvm.cashflow.profitability_index(cash_flows: List[float] | ndarray, discount_rate: float) float[source]
Calculate profitability index for cash flows.
- Parameters:
cash_flows (array-like) – Series of cash flows, with initial investment as negative value.
discount_rate (float) – Discount rate (as decimal).
- Returns:
Profitability index.
- Return type:
Examples
>>> cash_flows = [-100000, 30000, 40000, 50000] >>> profitability_index(cash_flows, 0.10) 1.043