okama.PortfolioDCF.monte_carlo_wealth

property PortfolioDCF.monte_carlo_wealth

Portfolio random wealth indexes with cash flows (withdrawals/contributions) by Monte Carlo simulation.

Monte Carlo simulation generates n random monthly time series. Each wealth index is calculated with rate of return time series of a given distribution.

First date of forecasted returns is portfolio last_date. First value for the forecasted wealth indexes is the last historical portfolio index value. It is useful for a chart with historical wealth index and forecasted values.

Returns:
DataFrame

Table with n random wealth indexes monthly time series.

Examples

>>> import matplotlib.pyplot as plt
>>> pf = ok.Portfolio(['SPY.US', 'AGG.US', 'GLD.US'], weights=[.60, .35, .05], rebalancing_period='month')
>>> pf.dcf.set_mc_parameters(distribution="t", period=10, number=100)  # Set Monte Carlo parameters
>>> # set cash flow parameters
>>> ind = ok.IndexationStrategy(pf)  # create cash flow strategy linked to the portfolio
>>> ind.initial_investment = 10_000  # add initial investment to cash flow strategy
>>> ind.amount = -500  # set withdrawal size
>>> ind.frequency = "year"  # set withdrawal frequency
>>> pf.dcf.cashflow_parameters = ind  # assign cash flow strategy to portfolio
>>> pf.dcf.monte_carlo_wealth.plot()
>>> plt.legend("")  # don't show legend for each line
>>> plt.show()
../_images/okama-PortfolioDCF-monte_carlo_wealth-1.png