Path: blob/master/examples/PortfolioOptimization.ipynb
1071 views
vectorbt: Random search
One-time allocation
Rebalance monthly
Search and rebalance every 30 days
Utilize low-level API to dynamically search for best Sharpe ratio and rebalance accordingly. Compared to previous method, we won't utilize stacking, but do search in a loop instead. We also will use days instead of months, as latter may contain a various number of trading days.
You can see how weights stabilize themselves with growing data.
A much more volatile weight distribution.
PyPortfolioOpt + vectorbt
One-time allocation
Faster than stacking solution, but doesn't let you compare weights.
Search and rebalance monthly
You can't use third-party optimization packages within Numba (yet).
Here you have two choices:
Use
os.environ['NUMBA_DISABLE_JIT'] = '1'before all imports to disable Numba completelyDisable Numba for the function, but also for every other function in the stack that calls it
We will demonstrate the second option.