Skip to content

Okama 1.5.0

Latest

Choose a tag to compare

@chilango74 chilango74 released this 25 Jun 08:00
· 11 commits to master since this release

Rebalancing bands - new rebalancing strategies for investment portfolios.

  • Calendar-based rebalancing
  • Rebalancing bands (threshold-based)

Mean-variance optimization with rebalancing-strategy-adjusted Efficient Frontier and asset weight bounds.

rebalancing

New features

Rebalance - new class to define rebalancing strategies

Rebalancing strategies are now defined in both Portfolio and EfficientFrontierReb with Rebalance class.

rs = ok.Rebalance(period="year", abs_deviation=0.10, rel_deviation=0.30)
pf = ok.Portfolio(['SPY.US', 'AGG.US'], rebalancing_strategy=rs)

WARNING:
The previous Portfolio class initialization method is now deprecated.
ok.Portfolio(rebalancing_period="year") will not work anymore.
However, as the default rebalancing strategy is monthly calendar-based. The simple definition without rebalancing strategy is still working:

ok.Portfolio(['SPY.US', 'AGG.US'], weights=[.6, .4])

Rebalance class

  • New Rebalance class has 3 parameters: period, abs_deviation, rel_deviation
  • Rebalance.wealth_ts() calculates wealth index time series of rebalanced portfolio (optionally with assets wealth time series)
  • Rebalance.assets_weights_ts() calculates assets weights monthly time series for rebalanced portfolio
  • Rebalance.return_ror_ts() returns monthly rate of return time series of rebalanced portfolio

New methods and properties in Portfolio class

  • new property rebalancing_strategy to configure rebalancing period, absolute and relative deviations
  • new property rebalancing_events returns time series of rebalancing events and type of rebalancing

Changes in PortoflioDCF class

  • PortfolioDCF.monte_carlo_wealth_pv calculates discounted random wealth indexes with cash flows
  • PortfolioDCF.monte_carlo_wealth_fv calculates not discounted (nominal) random wealth indexes with cash flows
  • PortfolioDCF.find_the_largest_withdrawals_size() now uses bisection method to find the largest withdrawals size.
  • PortfolioDCF.find_the_largest_withdrawals_size() has 3 possible goals: 'maintain_balance_pv', 'maintain_balance_fv' and 'survival_period'
  • PortfolioDCF.find_the_largest_withdrawals_size() new attribute withdrawals_range defines the possible range for withdrawals to speed up the calculations
  • PortfolioDCF.find_the_largest_withdrawals_size() has iter_max attribute to limit the intermediate steps when searching for resolution
  • PortfolioDCF.find_the_largest_withdrawals_size() returns Result class. If the solutions is not found it is still possible to see the intermediate steps

New methods and properties in EfficienFrontierReb class

EfficienFrontierReb class now uses rebalancing_strategy parameter for initialization (the same as Portfolio).
It supports bounds to define the weight limitations for the assets.

  • new rebalancing_strategy parameter to define the rebalancing strategy
  • new bounds parameter defines the bounds for the assets weights
  • new EfficienFrontierReb.plot_pair_ef() method plots the Efficient Frontier of every pair of assets

Changes in EfficientFrontier class

  • EfficientFrontier.get_monte_carlo method generates random rebalanced portfolios with Monte Carlo simulation according to bounds limitations.

New Jupyter Notebook with examples for Rebalancing strategies

New Jupyter Notebook with examples of investment portfolios with different rebalancing strategies:
10 rebalancing portfolio.ipynb