cash_flow_ts

PortfolioDCF.cash_flow_ts(discounting, remove_if_wealth_index_negative=True)

Cash flow Future Values (FV) or Present Values (PV) time series for the portfolio.

The cash flow time series presents the values of contributions and withdrawals over historical time period.

Parameters:
discounting{‘fv’, ‘pv’}

Type of discounting to apply: - ‘fv’: Future Values - nominal values without discounting - ‘pv’: Present Values - values discounted to present using the discount rate

remove_if_wealth_index_negativebool, default True

If True, cash flow values are replaced with 0 when wealth index is negative (or zero).

Returns:
pd.Series

Time series of cash flow values for portfolio.

Examples

>>> import matplotlib.pyplot as plt
>>> pf = ok.Portfolio(["VOO.US", "GLD.US"], weights=[0.8, 0.2])
>>> ind = ok.IndexationStrategy(pf)  # Set Cash Flow Strategy parameters
>>> ind.initial_investment = 100  # initial investments value
>>> ind.frequency = "year"  # withdrawals frequency
>>> ind.amount = -0.5 * 12  # initial withdrawals amount
>>> ind.indexation = "inflation"  # the indexation is equal to inflation
>>> pf.dcf.cashflow_parameters = ind  # assign the strategy to Portfolio
>>> pf.dcf.cash_flow_ts(discounting="fv", remove_if_wealth_index_negative=True).plot()
>>> plt.show()
../_images/okama-PortfolioDCF-cash_flow_ts-1.png