Asset Allocation Models¶
-
class
RiskParity
(sigma=None, cor=None, cov=None, ret=None, budget=None, longshort=1)[source] Risk parity (equal risk contribution) asset allocation.
References
Maillard S, Roncalli T, Teïletche J (2010) The Properties of Equally Weighted Risk Contribution Portfolios. The Journal of Portfolio Management 36:60–70. https://doi.org/10.3905/jpm.2010.36.4.060
Choi J, Chen R (2022) Improved iterative methods for solving risk parity portfolio. Journal of Derivatives and Quantitative Studies 30. https://doi.org/10.1108/JDQS-12-2021-0031
Examples
>>> import numpy as np >>> import pyfeng as pf >>> cov = np.array([ [ 94.868, 33.750, 12.325, -1.178, 8.778 ], [ 33.750, 445.642, 98.955, -7.901, 84.954 ], [ 12.325, 98.955, 117.265, 0.503, 45.184 ], [ -1.178, -7.901, 0.503, 5.460, 1.057 ], [ 8.778, 84.954, 45.184, 1.057, 34.126 ] ])/10000
>>> m = pf.RiskParity(cov=cov) >>> m.weight() array([0.125, 0.047, 0.083, 0.613, 0.132]) >>> m._result {'err': 2.2697290741335863e-07, 'n_iter': 6}
>>> m = pf.RiskParity(cov=cov, budget=[0.1, 0.1, 0.2, 0.3, 0.3]) >>> m.weight() array([0.077, 0.025, 0.074, 0.648, 0.176])
>>> m = pf.RiskParity(cov=cov, longshort=[-1, -1, 1, 1, 1]) >>> m.weight() array([-0.216, -0.162, 0.182, 0.726, 0.47 ])
-
classmethod
init_random
(n_asset=10, zero_ev=0, budget=False)[source] Randomly initialize the correlation matrix
- Parameters
n_asset – number of assets
zero_ev – number of zero eivenvalues. 0 by default
budget – randomize budget if True. False by default.
- Returns
RiskParity model object
-
weight
(tol=1e-06)[source] Risk parity weight using the improved CCD method of Choi and Chen (2022)
- Parameters
tol – error tolerance
- Returns
risk parity weight
References
Choi J, Chen R (2022) Improved iterative methods for solving risk parity portfolio. Journal of Derivatives and Quantitative Studies 30. https://doi.org/10.1108/JDQS-12-2021-0031
-
weight_ccd_original
(tol=1e-06)[source] Risk parity weight using original CCD method of Griveau-Billion et al (2013). This is implemented for performance comparison. Use weight() for better performance.
- Parameters
tol – error tolerance
- Returns
risk parity weight
References
Griveau-Billion T, Richard J-C, Roncalli T (2013) A Fast Algorithm for Computing High-dimensional Risk Parity Portfolios. arXiv:13114057 [q-fin]
-
weight_newton
(tol=1e-06)[source] Risk parity weight using the ‘improved’ Newton method by Choi & Chen (2022). This is implemented for performance comparison. Use weight() for better performance.
- Parameters
tol – error tolerance
- Returns
risk parity weight
References
Spinu F (2013) An Algorithm for Computing Risk Parity Weights. SSRN Electronic Journal. https://doi.org/10.2139/ssrn.2297383
Choi J, Chen R (2022) Improved iterative methods for solving risk parity portfolio. Journal of Derivatives and Quantitative Studies 30. https://doi.org/10.1108/JDQS-12-2021-0031