Currency conversion¶
The function currency_conversion allows the user to convert an cashflow in a currency to the equivalent flow in other currency using the specified exchange_rate. In addition, it is possible to include the devaluation of the foreign exchange rate.
-
cashflows.currency.
currency_conversion
(cflo, exchange_rate=1, devaluation=None, base_date=0)[source]¶ Converts a cashflow of dollars to another currency.
Parameters: - cflo (TimeSeries) – A cashflow.
- exchange_rate (float) – Exchange rate at time base_date.
- devaluation (TimeSeries) – Devaluation rate per compounding period.
- base_date (int) – Time index for the exchange_rate in current dollars.
Returns: A TimeSeries object.
Examples.
>>> cflo = cashflow(const_value=[100] * 5) >>> currency_conversion(cflo=cflo, exchange_rate=2) Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,)-(4,) [5] 200.00
>>> currency_conversion(cflo=cflo, exchange_rate=2, ... devaluation=interest_rate(const_value=[5]*5), base_date=(2,)) Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,) 181.41 (1,) 190.48 (2,) 200.00 (3,) 210.00 (4,) 220.50
>>> cflo = cashflow(const_value=[100] * 8, pyr=4) >>> currency_conversion(cflo=cflo, ... exchange_rate=2, ... devaluation=interest_rate([1]*8, pyr=4)) Qtr0 Qtr1 Qtr2 Qtr3 0 200.00 202.00 204.02 206.06 1 208.12 210.20 212.30 214.43
>>> cflo = cashflow(const_value=[100] * 5) >>> currency_conversion(cflo=[cflo, cflo], exchange_rate=2) [Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,)-(4,) [5] 200.00 , Time Series: Start = (0,) End = (4,) pyr = 1 Data = (0,)-(4,) [5] 200.00 ]