survival_period_hist
- PortfolioDCF.survival_period_hist(threshold=0)
Calculate the period when the portfolio has positive balance considering withdrawals on the historical data.
The portfolio survival period (longevity period) 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 withdrawal percentage (PercentageStrategy).
- Returns:
- float
The portfolio survival period (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. >>> # The balance is considered voided when it's equal to 0 (threshold=0) >>> pf.dcf.survival_period_hist(threshold=0) 5.1