okama.PortfolioDCF.monte_carlo_wealth_pv
- property PortfolioDCF.monte_carlo_wealth_pv
Portfolio discounted random wealth indexes with cash flows (withdrawals/contributions) by Monte Carlo simulation.
Random Monte Carlo simulation monthly time series are discounted using discount_rate parameter. Each wealth index is calculated with rate of return time series of a given distribution.
discount_rate parameter can be set in Portfolio.dcf.discount_rate.
Monte Carlo parameters are defined by Portfolio.dcf.set_mc_parameters() method.
- Returns:
- DataFrame
Table with random discounted 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') >>> pc = ok.PercentageStrategy(pf) # Define withdrawals strategy with fixed percentage >>> pc.frequency = "year" # set withdrawals frequency >>> pc.percentage = -0.08 # investor would take 8% every year >>> pf.dcf.cashflow_parameters = pc # Assign the strategy to Portfolio >>> pf.dcf.discount_rate = 0.05 # set dicount rate value to 5% >>> pf.dcf.set_mc_parameters(distribution="t", period=10, number=100) # Set Monte Carlo parameters >>> df = pf.dcf.monte_carlo_wealth_pv # calculate discounted random wealth indexes >>> df.plot() # create a chart >>> plt.legend("") # no legend is required >>> plt.show()