okama.PercentageStrategy
- class PercentageStrategy(parent)
Bases:
CashFlow
Cash flow strategy with regular fixed percentage withdrawals or contributions.
- Parameters:
- parentPortfolio
Parent Portfolio instance.
Examples
>>> import matplotlib.pyplot as plt >>> pf = ok.Portfolio(first_date="2015-01", last_date="2024-10") # create Portfolio with default parameters >>> pc = ok.PercentageStrategy(portf) # create PercentageStrategy linked to the portfolio >>> pc.initial_investment = 10_000 # add initial investments size >>> pc.frequency = "year" # set cash flow frequency >>> pc.percentage = -0.12 # set withdrawal percentage >>> # Assign the strategy to Portfolio >>> pf.dcf.cashflow_parameters = pc >>> pf.dcf.use_discounted_values = False # do not discount initial investment value >>> # Plot wealth index with cash flow >>> pf.dcf.wealth_index.plot() >>> plt.show()
Methods & Attributes
The frequency of regualr withdrawals or contributions in the strategy.
Portfolio initial investment FV size (at last_date).
The percentage of withdrawals or contributions.
- property frequency
The frequency of regualr withdrawals or contributions in the strategy.
Allowed values for frequency:
‘none’ no frequency (default value)
‘year’ annual cash flows
‘half-year’ 6 months cash flows
‘quarter’ 3 months cash flows
‘month’ 1 month cash flows
- Returns:
- str
The frequency of withdrawals or contributions.
- property initial_investment
Portfolio initial investment FV size (at last_date).
Initial investment must be positive.
- Returns:
- float
Portfolio initial investment.
- NAME = 'fixed_percentage'
- property percentage
The percentage of withdrawals or contributions.
The size of withdrawals or contribution is defined as a percentage of portfolio balance.
- Returns:
- float
The percentage of withdrawals or contributions.