okama.Portfolio.weights_ts
- property Portfolio.weights_ts
Calculate assets weights time series.
The weights of assets in Portfolio are not constant if rebalancing_period is different from ‘month’.
- Returns:
- DataFrame
Weights of assets time series.
Examples
>>> import matplotlib.pyplot as plt >>> reb_period='none' # The Portfolio is not rebalanced. >>> pf = ok.Portfolio(['SPY.US', 'AGG.US'], weights=[0.5, 0.5], rebalancing_period=reb_period) >>> pf.weights_ts.plot() >>> plt.show()
The weights of assets time series will differ significantly if the portfolio rebalancing_period is 1 year.
>>> pf.rebalancing_period = 'year' # set a new rebalancing period >>> pf.weights_ts.plot() >>> plt.show()