Constant dollar transformations¶
The function const2curr computes the equivalent generic cashflow in current dollars from a generic cashflow in constant dollars of the date given by base_date. inflation is the inflation rate per compounding period. curr2const computes the inverse transformation.
-
cashflows.inflation.
const2curr
(cflo, inflation, base_date=0)[source]¶ Converts a cashflow of constant dollars to current dollars of the time base_date.
Parameters: - cflo (TimeSeries) – A cashflow.
- inflation (TimeSeries) – Inflation rate per compounding period.
- base_date (int, tuple) – base date.
Returns: A cashflow in current money (TimeSeries)
Examples.
>>> const2curr(cflo=cashflow(const_value=[100] * 5), ... inflation=interest_rate(const_value=[10, 10, 20, 20, 20])) Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,) 100.00 (1,) 110.00 (2,) 132.00 (3,) 158.40 (4,) 190.08
>>> const2curr(cflo=cashflow(const_value=[100] * 5), ... inflation=interest_rate(const_value=[10, 10, 20, 20, 20]), base_date=4) Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,) 52.61 (1,) 57.87 (2,) 69.44 (3,) 83.33 (4,) 100.00
>>> const2curr(cflo=cashflow(const_value=[100] * 8, pyr=4), ... inflation=interest_rate(const_value=1, nper=8, pyr=4)) Qtr0 Qtr1 Qtr2 Qtr3 0 100.00 101.00 102.01 103.03 1 104.06 105.10 106.15 107.21
-
cashflows.inflation.
curr2const
(cflo, inflation, base_date=0)[source]¶ Converts a cashflow of current dollars to constant dollars of the date base_date.
Parameters: - cflo (list, Cashflow) – A cashflow.
- inflation_rate (float, Rate) – Inflation rate per compounding period.
- base_date (int) – base time..
Returns: A cashflow in constant dollars
>>> curr2const(cflo=cashflow(const_value=[100] * 5), ... inflation=interest_rate(const_value=[10, 10, 20, 20, 20])) Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,) 100.00 (1,) 90.91 (2,) 75.76 (3,) 63.13 (4,) 52.61
>>> curr2const(cflo=cashflow(const_value=[100] * 5), ... inflation=interest_rate(const_value=[10, 10, 20, 20, 20]), base_date=4) Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,) 190.08 (1,) 172.80 (2,) 144.00 (3,) 120.00 (4,) 100.00
>>> curr2const(cflo=cashflow(const_value=[100] * 8, pyr=4), ... inflation=interest_rate(const_value=1, nper=8, pyr=4)) Qtr0 Qtr1 Qtr2 Qtr3 0 100.00 99.01 98.03 97.06 1 96.10 95.15 94.20 93.27