Okama 1.4.3 is dedicated to Cash Flow strategies and Monte Carlos simulations.
New features
3 new classes to set up Cash Flow strategies
Cash flow parameters for investment portfolios are now configured in the corresponding classes.
- `IndexationStrategy` for strategies with regular indexed withdrawals / contributions
- `PercentageStrategy` for strategies weith regualr fixed percentage withdrawals / contributions
- `TimeSeriesStrategy` for strategies with user-defined withdrawals and contributions. Withdrawals, contributions, as well as their dates, are defined in the dictionary.
All 3 classes are inhereted from parent class `CashFlow`.
`Portfolio` class does not have cash flow parameters (`initial_amount`, `cashflow`, `discount_rate`) anymore.
New class to set up Monte Carlo simulation parameters
`MonteCarlos` class has several properties:
- `distribution` - the type of a distribution to generate random rate of return
- `period` - forecast period in years for portfolio wealth index time series
- `number` - number of random wealth indexes to generate with Monte Carlo simulation
All Monte Carlos properties are linked to `PortfolioDCF` instance and can be accessed by `Portfolio().dcf.mc` construction. For example the type of random distribution is available through `Portfolio().dcf.mc.disctribution`.
New methods and properties in PortfolioDCF
PortfolioDCF has a new parameter `use_discounted_values` (default is False). Id defines whether to use discounted values in backtesting wealth indexes (initial investments, withdrawal or contribution size). `discount_rate` parameter is shifted from `Portfolio` to `PortfolioDCF`.
- `find_the_largest_withdrawals_size` - find the largest withdrawals size for Monte Carlo simulation according to Cashflow Strategy. This method works with `IndexationStrategy` and `PercentageStrategy`
- `initial_investment_fv` property to calculate the future value (FV) of the initial investments at the end of forecast period.
- `initial_investment_pv` property to calculate the discounted value (PV) of the initial investments at the historical first date
- `wealth_index_with_assets` works as the same property of `Portfolio` but considers cash flow (contributions and withdrawals)
- `set_mc_parameters` method is a shortcut to add Monte Carlo simulation parameters
Changes in methods and properties in PortfolioDCF
- `monte_carlo_survival_period`, `survival_date_hist` and `survival_period_hist` methods have now new parameter `threshold`. The threshold defines the percentage of the initial investments when the portfolio balance considered voided
- `plot_forecast_monte_carlo` number of parameters is reduced to: `backtest` and `figsize`