okama.PortfolioDCF.find_the_largest_withdrawals_size
- PortfolioDCF.find_the_largest_withdrawals_size(withdrawal_steps, confidence_level, goal, threshold=0, target_survival_period=25)
Find the largest withdrawals size for Monte Carlo simulation according to Cashflow Strategy.
It’s possible to find the largest withdrawl with 2 kind of goals:
- — ‘maintain_balance’ to keep the purchasing power of the invesments after inflation
for the whole period defined in Monte Carlo parameteres.
- — ‘survival_period’ to keep positive balance for a period defined by ‘target_survival_period’.
The method works with IndexationStrategy and PercentageStrategy only.
The withdrawal size defined in cash flow strategy must be negative.
- Parameters:
- withdrawal_stepsint
The number of intermediate steps during the iteration of values fom maximum to minimum of the withdrawal size. The withdrawal size varies from 100% of the initial investment to zero.
- confidence_levelfloat
Confidence level must be form 0 to 1. Confidence level defines the percentile of Monte Carlo time series. 0.01 or 0.05 are the examples of “bad” scenarios. 0.50 is mediane (50% percentile). 0.95 or 0.99 are optimiststic scenarios.
- goal{‘maintain_balance’, ‘survival_period’}
‘maintain_balance’ - the goal is to keep the purchasing power of the invesments after inflation for the whole period defined in Monte Carlo parameteres. ‘survival_period’ - the goal is to keep positive balance for a period defined by ‘target_survival_period’.
- thresholdfloat, default 0
The percentage of initial investments when the portfolio balance is considered voided. Important for the “fixed_percentage” Cash flow strategy.
- target_survival_period: int, default 25
The smallest acceptable survival period. It wokrs with the ‘survival_period’ goal only.
- Returns:
- float
the largest withdrawals size according to Cashflow Strategy.
Examples
>>> pf = ok.Portfolio( ... assets=["MCFTR.INDX", "RUCBTRNS.INDX"], ... weights=[.3, .7], ... inflation=True, ... ccy="RUB", ... rebalancing_period="year", ... ) >>> # Fixed Percentage strategy >>> pc = ok.PercentageStrategy(pf) >>> pc.initial_investment = 10_000 >>> pc.frequency = "year" >>> # Assign a strategy >>> pf.dcf.cashflow_parameters = pc >>> # Set Monte Carlo parameters >>> pf.dcf.set_mc_parameters( ... distribution="norm", ... period=50, ... number=200 ...) >>> pf.dcf.find_the_largest_withdrawals_size( ... withdrawal_steps=30, ... confidence_level=0.50, ... goal="survival_period", ... threshold=0.05, ... target_survival_period=25 ...) np.float64(-0.10344827586206895)