okama.PortfolioDCF.survival_date_hist
- PortfolioDCF.survival_date_hist(threshold=0)
Get the date when the portfolio balance become negative considering withdrawals on the historical data.
The portfolio survival date (longevity date) depends on the investment strategy: asset allocation, rebalancing, withdrawals rate etc.
- Parameters:
- thresholdfloat, default 0
The percentage of the initial investments when the portfolio balance considered voided. This parameter is important to use in cash flow strategies with a fixed whtdrawal percentage (PercentageStrategy).
- Returns:
- pd.Timestamp
The portfolio survival date (longevity period) in years.
Examples
>>> pf = ok.Portfolio( ['SPY.US', 'AGG.US'], ccy='USD', first_date='2010-01', last_date='2024-10' ) >>> # set cash flow strategy >>> 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 = -2_500 # set annual withdrawal size >>> ind.frequency = "year" # set withdrawal frequency to year >>> pf.dcf.cashflow_parameters = ind >>> # Calculate the historical survival period for the cash flow strategy >>> pf.dcf.survival_date_hist(threshold=0) Timestamp('2015-01-31 00:00:00')