weights_ts
- property Portfolio.weights_ts
Calculate assets weights time series considering rebalancing strategy.
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 = ok.Rebalance(period="none") # The Portfolio is not rebalanced. >>> pf = ok.Portfolio(["SPY.US", "AGG.US"], weights=[0.5, 0.5], rebalancing_strategy=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_strategy = ok.Rebalance(period="year") # set a new rebalancing period >>> pf.weights_ts.plot() >>> plt.show()